How do I turn a float into an integer?
#3

pawn Код:
//Make some vars
new Float:fMyFloat = 3.1;
new nMyInt;

//Cast float to int:
nMyInt = _:fMyFloat;

//nMyInt is now 3.

or

pawn Код:
//Make some vars
new Float:fMyFloat = 1.3;

//Round the float:
new nSomeInt = floatround( fMyFloat );

//nSomeInt is now 1.
https://sampwiki.blast.hk/wiki/Floats#Float_-.3E_Integer
Reply


Messages In This Thread
How do I turn a float into an integer? - by TheBetaFox - 29.01.2012, 08:58
Re: How do I turn a float into an integer? - by Vince - 29.01.2012, 09:00
Re: How do I turn a float into an integer? - by blewert - 29.01.2012, 09:00

Forum Jump:


Users browsing this thread: 1 Guest(s)