SA-MP Forums Archive
[DELETE] Fixed... - 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: [DELETE] Fixed... (/showthread.php?tid=92281)



[DELETE] Fixed... - viKKmaN - 19.08.2009

Fixed...


Re: [HELP] Multiple Variable Command Problem /derby [1-5] [on/off] - Hei2 - 19.08.2009

Use dcmd and sscanf for commands like that. It's pretty simple to use https://sampwiki.blast.hk/wiki/Dcmd


Re: [HELP] Multiple Variable Command Problem /derby [1-5] [on/off] - viKKmaN - 19.08.2009

i thought someone might say that, and personally i hate dcmd, that's why i don't use it. So, can anyone fix what i did wrong?


Re: [HELP] Multiple Variable Command Problem /derby [1-5] [on/off] - viKKmaN - 19.08.2009

anyone?


Re: [HELP] Multiple Variable Command Problem /derby [1-5] [on/off] - Joe Staff - 19.08.2009

If you're using strtok you won't end up with a space in your parameter's string. For exampl,e if I type '/derby 1 on' you 'strtok'ed string will be 1.

I believe a better method to get what you want in this particular case would be to use no splitting function at all.

pawn Код:
if(!strcmp(cmdtext[1],"derby",true,5))
{
  if(IsPlayerAdmin(playerid))
  {
    if(!strlen(cmdtext[7]))return SendClientMessage(playerid,0xFF0000FF,"Admin Error Message");
    if(!strcmp(cmdtext[7],"1 on",true))
    {
      //work
    }
  }else{ //Player is not admin
    if(!strlen(cmdtext[7]))return SendClientMessage(playerid,0xFF0000FF,"Player Error Message");
    if(!strcmp(cmdtext[7],"join",true))
    {
      //work
    }
  }
}