AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Solved Get remain time problem (https://forums.alliedmods.net/showthread.php?t=333989)

Bugsy 08-22-2021 13:23

Re: Get remain time problem
 
This seems to work consistently.

PHP Code:

public Test() 
{
    const 
iActionTime 22;
    
    new 
iHours iMinutes iSeconds szTime] , iUnixTSNow iUnixTSAction;
    
    
iUnixTSNow parse_timeszTime "%H:%M:%S" );
    
    
formatexszTime charsmaxszTime ) , "%d:%d:%d" iActionTime );
    
iUnixTSAction parse_timeszTime "%H:%M:%S" );
    
    
iUnixTSAction -= iUnixTSNow;
    
iHours = ( iUnixTSAction 3600 ) % 24;
    
iMinutes = ( iUnixTSAction 60 ) % 60;
    
iSeconds = ( iUnixTSAction 60 );
    
    
server_print"%d hour%s, %d minute%s, %d second%s" iHours iHours == "" "s" iMinutes iMinutes == "" "s"iSeconds iSeconds == "" "s" );




All times are GMT -4. The time now is 16:35.

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