How To Script..
#5

I do this under OnGameModeInit:
PHP код:
    new minutes;
    
gettime(gHourminutes);
    
minutes 60 minutes;
    
SetTimer("ClockTimer", (minutes 60000) + 5000false);
    
SetWorldTime(gHour); 
So every time server restarts, it does some calculation and set's a timer when the next hour "will happen". And then I do:

PHP код:
forward ClockTimer();
public 
ClockTimer()
{
    new 
string[25];
    
gettime(gHour);
    
    
format(stringsizeof string"The time is now %d:00."gHour);
    
SendClientMessageToAll(COLOR_GREYstring);
    
    
SetTimer("ClockTimer"3600000true); // That interval = 1 hour but in milliseconds.
    
return 1;

The difference might be of 1 minute but that won't hurt.

EDIT: I've defined my variable 'gHour' on the top of the script.
Reply


Messages In This Thread
How To Script.. - by Vizi10 - 22.03.2018, 18:22
Re: How To Script.. - by PowerMwK - 22.03.2018, 18:56
Re: How To Script.. - by Logic_ - 22.03.2018, 19:00
Re: How To Script.. - by Maxandmov - 22.03.2018, 19:19
Re: How To Script.. - by Logic_ - 22.03.2018, 19:46
Re: How To Script.. - by Vizi10 - 22.03.2018, 20:07

Forum Jump:


Users browsing this thread: 2 Guest(s)