Help with params.
#1

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]"
Reply
#2

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)
Reply
#3

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
Reply
#4

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.

Reply
#5

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"
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)