SA-MP Forums Archive
Curius : How to use {Float,_}:.... - 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: Curius : How to use {Float,_}:.... (/showthread.php?tid=152112)



Curius : How to use {Float,_}:.... - Micko9 - 02.06.2010

can someone gimme a example of this?
like id like to recreate format like this :

CallFormat(str[],len,...)
{
format(...);
return 1;
}

THIS IS ONLY A EXAMPLE I JUST NEED ADVICE ^^


Re: Curius : How to use {Float,_}:.... - MastahServers - 02.06.2010

For example, a health float :

pawn Код:
if(strcmp(cmdtext, "/heal", true, 5) == 0) // 5 is the length of /heal
{
new Float:health;
new string[128];
GetPlayerHealth(playerid, health);
if(health >= 90) return SendClientMessage(playerid,RED,"You have enough health"); // it check if health is above 90, if it is, you won't get healed
//if(GetPlayerMoney(playerid) < 1000)   return SendClientMessage(playerid, PINK, "Error: you have not enough money to afford the medical bills"); // uncomment if you want your players to pay
else
{
          SetPlayerHealth(playerid,100);
          // SendClientMessage(playerid, PINK,"You have been healed, and paid $1000 for the medical bills"); // only uncomment when you had uncommented 'if (GetPlayerMoney)
          //GivePlayerMoney(playerid, -100); // only uncomment when you had uncommented 'if (GetPlayerMoney)
            // SendClientMessage(playerid, PINK,"You have been healed"); // only uncomment when you had commented 'if' (GetPlayerMoney(playerid)

        }
        return 1;
    }
To use it for other things, use the define after the 'Float:' - put in SendClientMessage '%f' (float), and use '%3.0f' to use 0 behind the commas, else it will
says a long row of numbers


Re: Curius : How to use {Float,_}:.... - dice7 - 02.06.2010

The functions are called numarg, getarg and setarg.
Here's a tut
http://forum.sa-mp.com/index.php?topic=101773.0