Help on a command: /front <x,y or z> <amount>
#1

I've tried to making a command, which would move player according with the params you'd choose, and the amount. like:
Код:
/front x 10 // Would move player X pos + 10
Can anyone tell me what's wrong?
pawn Код:
dcmd_front(playerid,params[])
{
     new pos,amount;
     new tmp[256],Index;
     tmp = strtok(params, Index);
     pos = strval(params);
     amount = strval(tmp);
     if(!strlen(params) || !strval(tmp)) return SendClientMessage(playerid, color, "USAGE: /front <x,y,z> <amount");
     new Float:Posx,Float:Posy,Float:Posz;
     GetPlayerPos(playerid, Posx, Posy, Posz);
     if(!strcmp(params,"x",true) && strval(tmp))
     {
         SetPlayerPos(playerid, Posx+amount,Posy,Posz);
     }
     else if(!strcmp(params,"y",true) && strval(tmp))
     {
         SetPlayerPos(playerid, Posx,Posy+amount,Posz);
     }
     else if(!strcmp(params,"z",true) && strval(tmp))
     {
         SetPlayerPos(playerid, Posx,Posy,Posz+amount);
     }
     else
     {
         SendClientMessage(playerid, color, "You can only choose: x, y or z");
     }
     return 1;
}
Off-topic: Could anyone help me on my topic ( I didn't bump. It were over 12h since I made the topic). Here the link:
Click here
Reply


Messages In This Thread
Help on a command: /front <x,y or z> <amount> - by blackwave - 30.12.2010, 13:23
Re: Help on a command: /front <x,y or z> <amount> - by _rAped - 30.12.2010, 13:27
Re: Help on a command: /front <x,y or z> <amount> - by blackwave - 30.12.2010, 13:30
Re: Help on a command: /front <x,y or z> <amount> - by MadeMan - 30.12.2010, 13:32
Re: Help on a command: /front <x,y or z> <amount> - by blackwave - 30.12.2010, 13:34
Re: Help on a command: /front <x,y or z> <amount> - by _rAped - 30.12.2010, 13:34

Forum Jump:


Users browsing this thread: 1 Guest(s)