SA-MP Forums Archive
Floats in a parameter-cmd - 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: Floats in a parameter-cmd (/showthread.php?tid=212741)



Floats in a parameter-cmd - XCarBOn - 17.01.2011

I tested it but it don't work. How to create a parameter-cmd in which I can use parameters?

Like:
pawn Код:
/gotopos 100.01 200.93 300.12 // And so on..
I can't use integer because integer don't work with commas (1.1, 2.5, etc)



Thnaks,



XCarBOn


Re: Floats in a parameter-cmd - Alex_Valde - 17.01.2011

Made it quickly and havent tested it but it should work:

pawn Код:
COMMAND:gotopos(playerid, params[])
{
    new Float:PosX,Float:PosY,Float:PosZ;
    if(!sscanf(params, "fff",PosX,PosY,PosZ))
    {
        SetPlayerPos(playerid, PosX,PosY,PosZ);
        SendClientMessage(playerid, 0xFFFFFFFF, "You have been teleported to your desired pos.");
    }
    else return SendClientMessage(playerid, 0xFFFFFFFF,"Usage: /gotopos [X][Y][Z]");
    return 1;
}



Re: Floats in a parameter-cmd - XCarBOn - 18.01.2011

I'll try it, thanks!


Re: Floats in a parameter-cmd - HyperZ - 18.01.2011

Quote:
Originally Posted by Alex_Valde
Посмотреть сообщение
Made it quickly and havent tested it but it should work:

pawn Код:
COMMAND:gotopos(playerid, params[])
{
    new Float:PosX,Float:PosY,Float:PosZ;
    if(!sscanf(params, "fff",PosX,PosY,PosZ))
    {
        SetPlayerPos(playerid, PosX,PosY,PosZ);
        SendClientMessage(playerid, 0xFFFFFFFF, "You have been teleported to your desired pos.");
    }
    else return SendClientMessage(playerid, 0xFFFFFFFF,"Usage: /gotopos [X][Y][Z]");
    return 1;
}
also post this lol
sscanf


Re: Floats in a parameter-cmd - XCarBOn - 18.01.2011

No problem xD I know how to use sscanf