Raised This Month: $ Target: $400
 0% 

Count time


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
tepegoz
Senior Member
Join Date: Apr 2019
Old 06-15-2020 , 12:06   Count time
Reply With Quote #1

PHP Code:
get_time_format(Float:timesresult[], len)
{

new 
hour floatround(times) / 60 /60;
new 
min  =(floatround(times) / 60) % 60;
new 
sec  floatround(times) % 60;
formatex(result[0], len"%i:%i:%i"hourminsec); 
}
and I use this
PHP Code:
new timeformat[8];
get_time_format((get_gametime() - g_starttime), timeformatcharsmax(timeformat));
len += format(awards[len], 512-len"          Time : %s"timeformat
I can see time on timeformat as 0:2:41 but I want detect only minutes(2). How to detect minutes? I want to make if(cvar_time> min) ......

Can you help me this public?
PHP Code:
public asa(id){

    new 
min  =(floatround(times) / 60) % 60;
    
client_print(0,print_chat,"Minute: %i",min)

tepegoz is offline
+ARUKARI-
AlliedModders Donor
Join Date: Jul 2004
Location: Japan
Old 06-15-2020 , 21:39   Re: Count time
Reply With Quote #2

Like this?
PHP Code:
get_time_minutes(Float:times)
{
    return (
floatround(times) / 60) % 60;
}

//--------
if (cvar_time get_time_minutes(get_gametime() - g_starttime))
{
    
// wawawa.

__________________
GitHub
SteamWishlist

六四天安門事件
+ARUKARI- is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 06-16-2020 , 16:54   Re: Count time
Reply With Quote #3

I don't think modulus is needed to get minutes, since the times Float is getting rounded.
__________________
Bugsy is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 06-16-2020 , 17:47   Re: Count time
Reply With Quote #4

Quote:
Originally Posted by fysiks View Post
Try format_time() from amxmodx.inc.
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
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:08.


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