repeat - 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: repeat (
/showthread.php?tid=401501)
repeat -
chickinfingers - 23.12.2012
i need help so if you type a command for ex like /vehname with no vehicle name it sends you a message "Put in the vehicle name you want. can someone show me how do that it would be wonderful thanks
Re: repeat -
Faisal_khan - 23.12.2012
Here we have ZCMD:
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
}
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:
pawn Код:
if(strcmp("/vehname", cmd, true) == 0)
{
tmp = strtok(cmdtext,idx);
if(!strlen(tmp))
{
return SendClientMessage(playerid,COLOR_LIGHTRED,"USAGE: /kick [id] [reason]");
}
}
Here we will have to use strtok to check what is after the cmd.
For better performance, use sscanf(plugin) with YCMD.
Re: repeat -
chickinfingers - 25.12.2012
thanks rep+