SA-MP Forums Archive
Float to Integer - 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: Float to Integer (/showthread.php?tid=268085)



Float to Integer - MJ! - 11.07.2011

How can I convert a Float into an integer ?


Re: Float to Integer - linuxthefish - 11.07.2011

pawn Код:
new YourInteger = floatround(/*YourFloat*/, floatround_round);
EXAMPLE:

pawn Код:
CMD:float(playerid, params[])
{
    new Float:x, Float:y, Float:z;
    GetPlayerPos(playerid, x, y, z);
    new ix = floatround(x, floatround_round);
    new string[128];
    format(string,128, "%d", ix);
    print(string);
    return 1;
}
Search next time.