ZCMD to strcmp
#1

pawn Код:
if(IsPlayerAdmin(playerid))
    {
        new string[128], choice[32], garageid, amount;

        if(sscanf(params, "s[32]dD", choice, garageid, amount))
        {
            SendClientMessage(playerid, 0xFFFFFFAA, "USAGE: /editgarage [name] [houseid] [(Optional)amount]");
            SendClientMessage(playerid, 0xFFFFFFAA, "Available names: Exterior, Interior, Price");
            return 1;
        }
        if(strcmp(choice,"interior",true) == 0)
        {
            GetPlayerPos(playerid, GarageInfo[garageid][gInteriorX], GarageInfo[garageid][gInteriorY], GarageInfo[garageid][gInteriorZ]);
            GetPlayerFacingAngle(playerid, GarageInfo[garageid][gInteriorA]);
            GarageInfo[garageid][gHInteriorWorld] = GetPlayerInterior( playerid );
            SendClientMessage( playerid, 0x33AA33AA, "Server: You have changed the interior!" );
            SaveGarages();

            return 1;
        }
        else if(strcmp(choice,"exterior",true) == 0)
        {
            GetPlayerPos(playerid, GarageInfo[garageid][gExteriorX], GarageInfo[garageid][gExteriorY], GarageInfo[garageid][gExteriorZ]);
            GetPlayerFacingAngle(playerid, GarageInfo[garageid][gExteriorA]);
            SendClientMessage( playerid, 0xFFFFFFAA, "Server:You have changed the exterior!" );
            DestroyDynamicPickup(GarageInfo[garageid][gPickupID]);
            SaveGarages();
            if(GarageInfo[garageid][gOwned] == 0)
            {
                DestroyDynamicPickup(GarageInfo[garageid][gPickupID]);
                DestroyDynamic3DTextLabel(GarageInfo[garageid][gTextID]);
                format(string, sizeof(string), "This Garage is\n for sale!\nCost: $%d\nID: %d\nTo buy this type /buygarage",GarageInfo[garageid][gValue],garageid);
                GarageInfo[garageid][gTextID] = CreateDynamic3DTextLabel( string, 0x33AA33AA, GarageInfo[garageid][gExteriorX], GarageInfo[garageid][gExteriorY], GarageInfo[garageid][gExteriorZ]+0.5,30.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, -1, -1,  -1, 30.0);
                GarageInfo[garageid][gPickupID] = CreateDynamicPickup(1318, 23, GarageInfo[garageid][gExteriorX], GarageInfo[garageid][gExteriorY], GarageInfo[garageid][gExteriorZ]);
            }
        }
        else if(strcmp(choice,"price",true) == 0)
        {
            GarageInfo[garageid][gValue] = amount;
            format(string, sizeof(string), "Server: You have set the houses price to $%d.", amount );
            SendClientMessage(playerid, 0x33AA33AA, string);
            if(GarageInfo[garageid][gOwned] ==0)
            {
                format(string, sizeof(string), "This Garage is\n for sale!\nCost: $%d\nID: %d\nTo buy this Garage type /buygarage",GarageInfo[garageid][gValue],garageid);
                UpdateDynamic3DTextLabelText(GarageInfo[garageid][gTextID],0x33AA33AA , string);
            }
        }
    }
    else
    {
        SendClientMessage(playerid, 0xFFFFFFAA, "You are not RCON Admin.");
    }
    return 1;
}
Can you transfer this to strcmp? [NO ZCMD plz], if you did = +rep
Reply
#2

this?

pawn Код:
if(strcmp(cmdtext, "/editgarage", true) == 0)
{
    if(IsPlayerAdmin(playerid))
    {
        new string[128], choice[32], garageid, amount;

        if(sscanf(cmdtext, "s[32]dD", cmd, choice, garageid, amount))
        {
            SendClientMessage(playerid, 0xFFFFFFAA, "USAGE: /editgarage [name] [houseid] [(Optional)amount]");
            SendClientMessage(playerid, 0xFFFFFFAA, "Available names: Exterior, Interior, Price");
            return 1;
        }
        if(strcmp(choice,"interior",true) == 0)
        {
            GetPlayerPos(playerid, GarageInfo[garageid][gInteriorX], GarageInfo[garageid][gInteriorY], GarageInfo[garageid][gInteriorZ]);
            GetPlayerFacingAngle(playerid, GarageInfo[garageid][gInteriorA]);
            GarageInfo[garageid][gHInteriorWorld] = GetPlayerInterior( playerid );
            SendClientMessage( playerid, 0x33AA33AA, "Server: You have changed the interior!" );
            SaveGarages();

            return 1;
        }
        else if(strcmp(choice,"exterior",true) == 0)
        {
            GetPlayerPos(playerid, GarageInfo[garageid][gExteriorX], GarageInfo[garageid][gExteriorY], GarageInfo[garageid][gExteriorZ]);
            GetPlayerFacingAngle(playerid, GarageInfo[garageid][gExteriorA]);
            SendClientMessage( playerid, 0xFFFFFFAA, "Server:You have changed the exterior!" );
            DestroyDynamicPickup(GarageInfo[garageid][gPickupID]);
            SaveGarages();
            if(GarageInfo[garageid][gOwned] == 0)
            {
                DestroyDynamicPickup(GarageInfo[garageid][gPickupID]);
                DestroyDynamic3DTextLabel(GarageInfo[garageid][gTextID]);
                format(string, sizeof(string), "This Garage is\n for sale!\nCost: $%d\nID: %d\nTo buy this type /buygarage",GarageInfo[garageid][gValue],garageid);
                GarageInfo[garageid][gTextID] = CreateDynamic3DTextLabel( string, 0x33AA33AA, GarageInfo[garageid][gExteriorX], GarageInfo[garageid][gExteriorY], GarageInfo[garageid][gExteriorZ]+0.5,30.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, -1, -1,  -1, 30.0);
                GarageInfo[garageid][gPickupID] = CreateDynamicPickup(1318, 23, GarageInfo[garageid][gExteriorX], GarageInfo[garageid][gExteriorY], GarageInfo[garageid][gExteriorZ]);
            }
        }
        else if(strcmp(choice,"price",true) == 0)
        {
            GarageInfo[garageid][gValue] = amount;
            format(string, sizeof(string), "Server: You have set the houses price to $%d.", amount );
            SendClientMessage(playerid, 0x33AA33AA, string);
            if(GarageInfo[garageid][gOwned] ==0)
            {
                format(string, sizeof(string), "This Garage is\n for sale!\nCost: $%d\nID: %d\nTo buy this Garage type /buygarage",GarageInfo[garageid][gValue],garageid);
                UpdateDynamic3DTextLabelText(GarageInfo[garageid][gTextID],0x33AA33AA , string);
            }
        }
    }
    else
    {
        SendClientMessage(playerid, 0xFFFFFFAA, "You are not RCON Admin.");
    }
    return 1;
}
i dont use strcmp anymore, sorry i said the code with error's
Reply
#3

params un defined symoble
if(sscanf(params, "s[32]dD", choice, garageid, amount)) //This line
Reply
#4

THANKS! +reped
Reply
#5

Quote:
Originally Posted by Jermi
Посмотреть сообщение
params un defined symoble
if(sscanf(params, "s[32]dD", choice, garageid, amount)) //This line
What? i don't put that
Reply
#6

No offense, but why would someone transfer from ZCMD to STRCMP?!
Reply
#7

Quote:
Originally Posted by Red_Dragon.
Посмотреть сообщение
No offense, but why would someone transfer from ZCMD to STRCMP?!
I don't understand too but i only do what he wanted..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)