Help Converting Dialog To CMD
#5

Quote:
Originally Posted by Rachael
Посмотреть сообщение
strcmp is better when you have a command which has only one ( string ) parameter

and strtok is better when you have a command with an indeterminate number of parameters

pawn Код:
CMD:gethere(playerid,params[])
{
     new tmp[25],idx,targetid
     new Float:x,Float:y,Float:z;
     GetPlayerPos(playerid,x,y,z);
     tmp = strtok(params, idx);
     while(strlen(tmp) > 0)
     {
           targetid = ReturnUser(tmp);
           if(IsPlayerConnected(targetid))
           {
                SetPlayerPos(targetid,x,y+1,z);
           }
           tmp = strtok(params,idx);
     }
      return 1;
}
ps: this is just a rough example
Zcmd + sscanf(2) is best no matter how many params you have.

And never, ever, ever, ever, ever! use strtok together with zcmd.
That's like putting a Lada engine in a Ferrari, just ridiculous.
Reply


Messages In This Thread
Help Converting Dialog To CMD - by Guest3598475934857938411 - 28.09.2010, 20:52
Re: Help Converting Dialog To CMD - by samgreen - 29.09.2010, 04:34
Re: Help Converting Dialog To CMD - by LarzI - 29.09.2010, 06:43
Re: Help Converting Dialog To CMD - by Rachael - 29.09.2010, 06:51
Re: Help Converting Dialog To CMD - by LarzI - 29.09.2010, 06:53
Re: Help Converting Dialog To CMD - by Rachael - 29.09.2010, 06:59
Re: Help Converting Dialog To CMD - by LarzI - 29.09.2010, 07:02
Re: Help Converting Dialog To CMD - by samgreen - 29.09.2010, 07:05
Re: Help Converting Dialog To CMD - by Rachael - 29.09.2010, 14:43
Re: Help Converting Dialog To CMD - by Guest3598475934857938411 - 29.09.2010, 15:11

Forum Jump:


Users browsing this thread: 1 Guest(s)