Thread: How To Script..
View Single Post
Old 22/03/2018, 07:46 PM   #5
Logic_
High-roller
 
Logic_'s Avatar
 
Join Date: Jun 2015
Location: Oblivion (#RIPX)
Posts: 1,461
Reputation: 263
Default Re: How To Script..

I do this under OnGameModeInit:
PHP Code:
    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 Code:
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.
__________________
RIP XXXTentacion [1998-2018]

My Releases: Click me!

Past experiences:
Ex- Developer of COD: Black Ops 3 [2017 - 2018], Palomino Creek RP [2018], NEG [2017], Zombieland [2015]
Logic_ is offline   Reply With Quote