30.12.2010, 13:23
I've tried to making a command, which would move player according with the params you'd choose, and the amount. like:
Can anyone tell me what's wrong?
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
Код:
/front x 10 // Would move player X pos + 10
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;
}
Click here