Raised This Month: $32 Target: $400
 8% 

convert float to integer


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
paegus
Senior Member
Join Date: Nov 2004
Location: Extreme low earth orbit
Old 02-13-2009 , 05:48   convert float to integer
Reply With Quote #1

while this is usually done with say int:flValue, it doesn't seem to work in pawn.

instead i have to...
Code:
FloatToString(Pow(2.0, float(flFloat)), szString, sizeof(szString)); iInteger = StringToInt(szString);
...which is a tad clunky i feel.

is there another way?
__________________
Live and learn or die and teach by example.
Plugins Mine | Hidden:SourceMod
paegus is offline
p3tsin
Senior Member
Join Date: Sep 2005
Location: Finland
Old 02-13-2009 , 06:36   Re: convert float to integer
Reply With Quote #2

RoundToZero
RoundToCeil
RoundToFloor
RoundToNearest
__________________
plop
p3tsin is offline
BAILOPAN
Join Date: Jan 2004
Old 02-13-2009 , 09:48   Re: convert float to integer
Reply With Quote #3

Note that RoundFloat() is RoundToNearest()
__________________
egg
BAILOPAN is offline
paegus
Senior Member
Join Date: Nov 2004
Location: Extreme low earth orbit
Old 02-13-2009 , 10:14   Re: convert float to integer
Reply With Quote #4

gaa...

thanks both.
__________________
Live and learn or die and teach by example.
Plugins Mine | Hidden:SourceMod
paegus is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 22:02.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode