AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   WHY doesn't this simple float work (https://forums.alliedmods.net/showthread.php?t=164593)

Backstabnoob 08-13-2011 10:59

WHY doesn't this simple float work
 
x = start time (60 sec for example)
y = count down from x

after 10 seconds: x = 60; y = 50 (THIS WORKS, I was printing it on the server and both the numbers are ok just this fucking float doesn't do what it should)

new Float:percent = float((x - y) / x) * 100.0

Just WHY is this 0.0% no matter when, it's 0.0 after 10 seconds, 0.0 after 30 seconds, 0.0 after 23957325 seconds it simply DOESN'T CHANGE

Hunter-Digital 08-13-2011 12:17

Re: WHY doesn't this simple float work
 
Move the float function to the substraction:
Code:

new Float:percent = (float(x - y) / x) * 100.0
Or just use float values instead.

Backstabnoob 08-13-2011 12:31

Re: WHY doesn't this simple float work
 
FINALLY, thanks


All times are GMT -4. The time now is 03:31.

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