CMD: to strcmp - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: CMD: to strcmp (
/showthread.php?tid=611609)
CMD: to strcmp -
MayaEU - 08.07.2016
How to make this command into strcmp?
pawn Код:
CMD:setlandowner(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] >= 5)
{
new land, playername[24], string[128];
if(sscanf(params, "ds[24]", land, playername)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /setlandowner [landid] [name]");
if(LandInfo[land][landCreated] == 1)
{
format(LandInfo[land][landOwner], 24, "%s", playername);
format(string, sizeof(string), "You have set land %d's owner to '%s'", land, LandInfo[land][landOwner]);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "%s's Land (%d)", LandInfo[land][landOwner], land);
UpdateDynamic3DTextLabelText(LandInfo[land][landText], COLOR_REALRED, string);
LandInfo[land][landOwned] = 1;
}
else
{
SendClientMessage(playerid, COLOR_GREY, "That land does not exist.");
}
}
return 1;
}
Re: CMD: to strcmp -
Mencent - 08.07.2016
Hello!
Try this:
PHP код:
if(!strcmp(cmdtext,"/setlandowner",true))
{
if(PlayerInfo[playerid][pAdmin] >= 5)
{
new land, playername[24], string[128];
if(sscanf(cmdtext, "ds[24]", land, playername)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /setlandowner [landid] [name]");
if(LandInfo[land][landCreated] == 1)
{
format(LandInfo[land][landOwner], 24, "%s", playername);
format(string, sizeof(string), "You have set land %d's owner to '%s'", land, LandInfo[land][landOwner]);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "%s's Land (%d)", LandInfo[land][landOwner], land);
UpdateDynamic3DTextLabelText(LandInfo[land][landText], COLOR_REALRED, string);
LandInfo[land][landOwned] = 1;
}
else
{
SendClientMessage(playerid, COLOR_GREY, "That land does not exist.");
}
}
return 1;
}
Re: CMD: to strcmp -
Napst34 - 08.07.2016
PHP код:
if(strcmp(cmd,"/setlandowner",true)==0)
{
if(PlayerInfo[playerid][pAdmin] >= 5)
{
SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
return 1;
}
tmp = strtok(cmdtext, land, playername);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /setlandowner [landid] [name]");
return 1;
}
new string[128];
if(LandInfo[land][landCreated] == 1)
{
format(LandInfo[land][landOwner], 24, "%s", playername);
format(string, sizeof(string), "You have set land %d's owner to '%s'", land, LandInfo[land][landOwner]);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "%s's Land (%d)", LandInfo[land][landOwner], land);
UpdateDynamic3DTextLabelText(LandInfo[land][landText], COLOR_REALRED, string);
LandInfo[land][landOwned] = 1;
}
else SendClientMessage(playerid, COLOR_GREY, "That land does not exist.");
}
Try this ?
Re: CMD: to strcmp -
PrO.GameR - 08.07.2016
Real question is why the hell would you do that? it's like leaving your house just to go live in a cave, wear some pelts and fight wild animals with rocks and sticks
Learn to upgrade your strcmp stuff instead of downgrading ZCMD to strcmp.