23.12.2012, 04:26
Here we have ZCMD:
we have used sscanf to check what is after the cmd you typed. If you have nothing, it will return you an error.
Now using strcmp:
Here we will have to use strtok to check what is after the cmd.
For better performance, use sscanf(plugin) with YCMD.
pawn Код:
COMMAND:/vehname(playerid,params[])
{
new Target; //defines the playerid we wanna freeze
if(sscanf(params, "u", Target)) SendClientMessage(playerid, COLOR_LIGHTBLUE, "USAGE: /vehname [vehname]"); //tell sscanf again if the parameters/syntax is wrong to return a special message
}
Now using strcmp:
pawn Код:
if(strcmp("/vehname", cmd, true) == 0)
{
tmp = strtok(cmdtext,idx);
if(!strlen(tmp))
{
return SendClientMessage(playerid,COLOR_LIGHTRED,"USAGE: /kick [id] [reason]");
}
}
For better performance, use sscanf(plugin) with YCMD.