Help: Making a /resparay - 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: Help: Making a /resparay (
/showthread.php?tid=405382)
Help: Making a /resparay -
jakejohnsonusa - 06.01.2013
I need help making a /respray command for mehaincs.
Here is what the CMD will be: /spray [playerid/PartOfName][Cost] [Color1] [Color2]
But how do I define each of the parts... like:
pawn Код:
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /spray [playerid/PartOfName] [Cost] [Color1] [Color2]");
return 1;
}
new playa;
new money;
playa = ReturnUser(tmp);
tmp = strtok(cmdtext, idx);
money = strval(tmp);
color1 = ????
color2= ????
As you can see... I can define two things (the money and the player ID), but how would I continue to define Color1 and Color2?
Please & Thanks!
AW: Help: Making a /resparay -
IPrototypeI - 06.01.2013
Quote:
Originally Posted by jakejohnsonusa
I need help making a /respray command for mehaincs.
Here is what the CMD will be: /spray [playerid/PartOfName][Cost] [Color1] [Color2]
But how do I define each of the parts... like:
pawn Код:
tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /spray [playerid/PartOfName] [Cost] [Color1] [Color2]"); return 1; } new playa; new money; playa = ReturnUser(tmp); tmp = strtok(cmdtext, idx); money = strval(tmp); color1 = ???? color2= ????
As you can see... I can define two things (the money and the player ID), but how would I continue to define Color1 and Color2?
Please & Thanks!
|
pretty simple
PHP код:
new money = strval(tmp);
tmp = strtok(cmdtext, idx);
new color1 = strval(tmp);
tmp = strtok(cmdtext, idx);
new color2= strval(tmp);
^^
but why don 't you use sscanf it's faster , shorter and easyier
and a commandprocessor but it is also possible to use it with strcmp commands