AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Count time (https://forums.alliedmods.net/showthread.php?t=325283)

tepegoz 06-15-2020 12:06

Count time
 
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)



+ARUKARI- 06-15-2020 21:39

Re: Count time
 
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.



Bugsy 06-16-2020 16:54

Re: Count time
 
I don't think modulus is needed to get minutes, since the times Float is getting rounded.

Natsheh 06-16-2020 17:47

Re: Count time
 
Quote:

Originally Posted by fysiks (Post 2650143)
Try format_time() from amxmodx.inc.



All times are GMT -4. The time now is 17:08.

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