Raised This Month: $10 Target: $400
 2% 

Solved Get remain time problem


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
loiraolhosazul
Member
Join Date: May 2020
Old 08-21-2021 , 20:28   Get remain time problem
Reply With Quote #1

I'm trying to get the rest of the hour, but I'm in trouble.

HTML Code:
Now: 20 horas 26 minutos 50 segundos
Remain: 0 hora -60 minuto 0 segundo
Code:
public xdxd()
{
	new h, m, s, i, mm, d, now, start, discount, remain_time, gethours[3], xfmt[128]

	time(gethours[0], gethours[1], gethours[2])

	start = 22
	discount = floatround(float(start - gethours[0]), floatround_ceil)

	now = get_systime()
	remain_time = get_systime(3600 * discount) - now


	UnixToTime(now, i, mm, d, h, m, s, UT_TIMEZONE_SERVER)
	formatex(xfmt, charsmax(xfmt), "Now: %d hora%s %d minuto%s %d segundo%s", h, h > 1 ? "s" : "", m, m > 1 ? "s" : "", s, s > 1 ? "s" : "")
	
	server_print(xfmt)


	UnixToTime(remain_time, i, mm, d, h, m, s, UT_TIMEZONE_SERVER)
	formatex(xfmt, charsmax(xfmt), "Remain: %d hora%s %d minuto%s %d segundo%s", h, h > 1 ? "s" : "", m, m > 1 ? "s" : "", s, s > 1 ? "s" : "")
	
	server_print(xfmt)
}

Last edited by loiraolhosazul; 08-21-2021 at 21:38.
loiraolhosazul is offline
 


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 01:41.


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