SA-MP Forums Archive
Help on a command: /front <x,y or z> <amount> - 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: Help on a command: /front <x,y or z> <amount> (/showthread.php?tid=204756)



Help on a command: /front <x,y or z> <amount> - blackwave - 30.12.2010

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


Re: Help on a command: /front <x,y or z> <amount> - _rAped - 30.12.2010

First you tell me what's the problem, then I can try help you find out what's wrong.


Re: Help on a command: /front <x,y or z> <amount> - blackwave - 30.12.2010

Oh, sorry. It keeps giving me:
Код:
USAGE: /front <x,y,z> <amount



Re: Help on a command: /front <x,y or z> <amount> - MadeMan - 30.12.2010

pawn Код:
dcmd_front(playerid,params[])
{
    new pos[4], amount;
    new tmp[128], Index;
    tmp = strtok(params, Index);
    format(pos, sizeof(pos), "%s", tmp);
    tmp = strtok(params, Index);
    amount = strval(tmp);
    if(!strlen(params) || !strlen(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(pos,"x",true))
    {
        SetPlayerPos(playerid, Posx+amount,Posy,Posz);
    }
    else if(!strcmp(pos,"y",true))
    {
        SetPlayerPos(playerid, Posx,Posy+amount,Posz);
    }
    else if(!strcmp(pos,"z",true))
    {
        SetPlayerPos(playerid, Posx,Posy,Posz+amount);
    }
    else
    {
        SendClientMessage(playerid, color, "You can only choose: x, y or z");
    }
    return 1;
}



Re: Help on a command: /front <x,y or z> <amount> - blackwave - 30.12.2010

Thanks mademan.


Re: Help on a command: /front <x,y or z> <amount> - _rAped - 30.12.2010

Oh nvm then