Help : int <-> float conversion ?!
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;Since buytime is in minutes, i did that to get in seconds : Code:
new buytime_total;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. |
Re: Help : int <-> float conversion ?!
floatround() ?
float() ? |
Re: Help : int <-> float conversion ?!
This is how you would do it with floats.
Also, you should use pcvars. Code:
Code:
|
Re: Help : int <-> float conversion ?!
Quote:
|
Re: Help : int <-> float conversion ?!
Thanks for your answers !
I got another question : For server performance, is it better to have 1 big plugin/file or many small ? Thanks |
Re: Help : int <-> float conversion ?!
Quote:
|
Re: Help : int <-> float conversion ?!
Quote:
If there are multiple plugins using frequently-called forwards (such as PreThink, ServerFrame, etc.), then it is better to combine them. Otherwise, it doesn't make much of a difference. |
Re: Help : int <-> float conversion ?!
Quote:
Quote:
Quote:
|
Re: Help : int <-> float conversion ?!
For example, if you have 5 plugins calling PreThink, PostThink, and ServerFrame, then your server's performance would improve if you combined them.
This is because it has to call the function into each plugin. If you don't have multiple plugins that use high-cpu forwards, then it won't matter as much to combine them. Please note that the performance increase won't be very significant. |
Re: Help : int <-> float conversion ?!
I know that, I agree that, and I said that(at least meant that). But what a hey, there is pretty much people who don't understand anything I'm saying most of the time. Btw, if the part what was wrong, was that I didn't mention how much it will take effect or in what cases, then let's just leave it over, I was just saying which is better. (For server performance)
|
| All times are GMT -4. The time now is 01:40. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.