Raised This Month: $ Target: $400
 0% 

Need convert this value in time


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Xenone
Junior Member
Join Date: Oct 2014
Old 10-10-2014 , 13:07   Need convert this value in time
Reply With Quote #1

How to convert this variable in the client_print format ?

PHP Code:
g_time[id] = 5400 // 1 hour 30 minutes

// convert the 5400 time
client_print(idprint_chat"You can use your bonus in hours:minutes:seconds"g_time[id])

// like this
client_print(idprint_chat"You can use your bonus in 01:30:00"g_time[id]) 
Sorry bad english
Xenone is offline
.Dare Devil.
Veteran Member
Join Date: Sep 2010
Old 10-10-2014 , 13:51   Re: Need convert this value in time
Reply With Quote #2

How about this?
PHP Code:
g_time[id] = 5400
new hms
g_time[id] / 3600
= (g_time[id] - (*3600)) / 60
=  (g_time[id] - (*60))
new 
s_h[4], s_m[4], s_s[4];
if( 
10 formats_hcharsmax(s_h), "%d")
else 
formats_hcharsmax(s_h), "0%d")

if( 
10 formats_scharsmax(s_s), "%d")
else 
formats_scharsmax(s_s), "0%d")

if( 
10 formats_mcharsmax(s_m), "%d")
else 
formats_mcharsmax(s_m), "0%d")

client_print(idprint_chat"You can use your bonus in %d:%d:%d"hms
.Dare Devil. is offline
NikKOo31
Senior Member
Join Date: May 2013
Location: Home
Old 10-11-2014 , 14:17   Re: Need convert this value in time
Reply With Quote #3

From time.inc

Code:
get_time_length

Syntax

stock get_time_length(id, unitCnt, type, output[], outputLen)
http://amxmodx.org/api/time/get_time_length
__________________
Hey ^_^
NikKOo31 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 17:56.


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