Raised This Month: $ Target: $400
 0% 

WHY doesn't this simple float work


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Backstabnoob
BANNED
Join Date: Feb 2009
Location: Iwotadai Dorm
Old 08-13-2011 , 10:59   WHY doesn't this simple float work
Reply With Quote #1

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

Last edited by Backstabnoob; 08-13-2011 at 11:01.
Backstabnoob is offline
Hunter-Digital
Veteran Member
Join Date: Aug 2006
Location: In the Game [ro]
Old 08-13-2011 , 12:17   Re: WHY doesn't this simple float work
Reply With Quote #2

Move the float function to the substraction:
Code:
new Float:percent = (float(x - y) / x) * 100.0
Or just use float values instead.
__________________
Hunter-Digital is offline
Backstabnoob
BANNED
Join Date: Feb 2009
Location: Iwotadai Dorm
Old 08-13-2011 , 12:31   Re: WHY doesn't this simple float work
Reply With Quote #3

FINALLY, thanks
Backstabnoob 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 03:31.


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