Raised This Month: $ Target: $400
 0% 

Hours in percentages


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Santaaa
BANNED
Join Date: May 2012
Old 07-13-2012 , 08:01   Hours in percentages
Reply With Quote #1

Hey,

How will I calculate the hours into percentages. I tryed:
PHP Code:
new hour get_user_time() / 3600
new percent hour 100 25 
Maybe its * 60 because a hour has 60 minutes? but I dont know.
But if i will do that i will come out on 60% max when the user has reached the max time. I want that it goes max to 100%

Last edited by Santaaa; 07-13-2012 at 08:16.
Santaaa is offline
<VeCo>
Veteran Member
Join Date: Jul 2009
Location: Bulgaria
Old 07-13-2012 , 08:37   Re: Hours in percentages
Reply With Quote #2

PHP Code:
percent 100 * (value max_value
So it should be like this (if you want 3600 secs to be 100%):

PHP Code:
new percent 100 * (get_user_time(id) / 3600
__________________

Last edited by <VeCo>; 07-13-2012 at 08:38.
<VeCo> is offline
Santaaa
BANNED
Join Date: May 2012
Old 07-13-2012 , 08:58   Re: Hours in percentages
Reply With Quote #3

Thats for 1 hour, now i want it for 25 hours.

Would i do it like this?
PHP Code:
new hour get_user_time() / 3600
new percent hour 100 25 
Santaaa is offline
<VeCo>
Veteran Member
Join Date: Jul 2009
Location: Bulgaria
Old 07-13-2012 , 09:31   Re: Hours in percentages
Reply With Quote #4

25 hours are 3600 * 25 = 90000

So use:
PHP Code:
new percent floatround(100 * (get_user_time(id) / 90000.0)) 
Or if you want it with the "hour" variable:
PHP Code:
new Float:hour get_user_time(id) / 90000.0
new percent floatround(100 hour
__________________

Last edited by <VeCo>; 07-13-2012 at 09:35.
<VeCo> is offline
Reply


Thread Tools
Display Modes

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 15:16.


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