AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Cvar is doing strange, getting 104872688 as value, set with 0.75 (float) (https://forums.alliedmods.net/showthread.php?t=70914)

TwN 05-04-2008 04:04

Cvar is doing strange, getting 104872688 as value, set with 0.75 (float)
 
This is part of my first plugin OverKill.

Problem: cvar is fucking up, getting either always 0, or gigatons of a value.
Using get_pcvar_num/float/string/..(amx_ok_perc), and then turning it into the type I want, always returns 0. Hardcoding the value, (wich is still in the uploaded version), I get a gigaton value like 104872688.

I know I am putting some floats in some int's, I changed it so the compiler was quite happy about it. Tried with using correct types aswell, hence warnings...

Any comments?

Greenberet 05-04-2008 04:14

Re: Cvar is doing strange, getting 104872688 as value, set with 0.75 (float)
 
1) use get_pcvar_float for float cvars
2) its "Float:" and not "float:"

Howdy! 05-04-2008 06:58

Re: Cvar is doing strange, getting 104872688 as value, set with 0.75 (float)
 
You can change these:
PHP Code:

new amx_ok_perc
new amx_ok_life_cap
new amx_ok_max
new amx_ok_reward_cap
new amx_ok_perc_capped 

to :arrow:

PHP Code:

new amx_ok_percamx_ok_life_capamx_ok_maxamx_ok_reward_capamx_ok_perc_capped 

Code:

//one line comment
/* Multiple line comment */

These has nothing to do with your problem, but good information tho. :wink:


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

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