Raised This Month: $ Target: $400
 0% 

Help : int <-> float conversion ?!


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
sappounet
Junior Member
Join Date: Jan 2009
Old 01-23-2009 , 20:35   Help : int <-> float conversion ?!
Reply With Quote #1

Hello,

I'm facing a stupid problem ...

I'm creating a program that allows players to get all weapon ammo free.

To do that, i check when they can by (between the respawn and the end of buytime) : freezetime + buytime

So i did that :

Code:
new mp_buytime;
new mp_freezetime;

mp_buytime=get_cvar_num("mp_buytime");  // 0.25
mp_freezetime=get_cvar_num("mp_freezetime");   // 10
I want to know the total duration in second.

Since buytime is in minutes, i did that to get in seconds :

Code:
new buytime_total;
buytime_total=(mp_buytime*60)+mp_freezetime;
When i try to use the buytime_total var, it's not set to the right value (it's not (0.25*60)+10)

Both vars are float ... and i'm bored by float !

So the question is :

Is there an easy way to convert between float and int ?

I'm only using <amxmodx> and <cstrike> includes, and i would like as much as possible to not use other files.

Thank you for your help.
sappounet is offline
 



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 01:40.


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