SA-MP Forums Archive
Help with params. - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Help with params. (/showthread.php?tid=68187)



Help with params. - Outbreak - 07.03.2009

I had this working earlier today, i tried doing it another way, that didnt work out, so i went back to the old way which was working.

Now though, the first time i use the command its fine, but the second time i use it im told im typing ir wrongly.

pawn Код:
dcmd_savegz(playerid,params[])
{
  if(!IsPlayerAdmin(playerid)) return 0;
  tmp = strtok(params, idx);
    if(gzCreate[playerid] != 1) return SendClientMessage(playerid, COLOR_RED, "You aren't currently making a gangzone, use /gzcreate to start making one!");
    if(!strlen(tmp))
    {
      SendClientMessage(playerid, COLOR_WHITE, "USAGE: /savegz [name]");
      return 1;
    }
Thats the part im having problems with, the message i keep getting is "USAGE: savegz [name]"


Re: Help with params. - Nero_3D - 07.03.2009

try to understand how strtok works than you will understand why that happend
ah and I recommend to use sscanf by ****** (code can be founded at the wiki page)


Re: Help with params. - Outbreak - 08.03.2009

hmm I used this same method for other commands and it always works fine, this one only works the first time, the rest of the times it gives me the usage message


Re: Help with params. - Outbreak - 08.03.2009

gzCreate[playerid] comes from the first command. /gzcreate

If gzCreate[playerid] isnt 1 then none of the other commands are available, until /gzcreate is used.




Re: Help with params. - Outbreak - 08.03.2009

yeah, as you said, tmp and idx were declared globally, my bad

Its fixed now. i've jsut tested it.

Thanks.

And im searching now about "sscanf"