PDA

View Full Version : ZCMD to strcmp


Jermi
23/07/2013, 12:38 AM
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

PT
23/07/2013, 12:44 AM
this?


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

Jermi
23/07/2013, 12:47 AM
params un defined symoble
if(sscanf(params, "s[32]dD", choice, garageid, amount)) //This line

Jermi
23/07/2013, 12:52 AM
THANKS! +reped

PT
23/07/2013, 12:58 AM
params un defined symoble
if(sscanf(params, "s[32]dD", choice, garageid, amount)) //This line

What? i don't put that :s

Red_Dragon.
23/07/2013, 01:29 AM
No offense, but why would someone transfer from ZCMD to STRCMP?!

PT
23/07/2013, 01:32 AM
No offense, but why would someone transfer from ZCMD to STRCMP?!

I don't understand too but i only do what he wanted..