 |
|
Veteran Member
Join Date: Aug 2014
Location: Your mom house -Portugal
|

01-02-2016
, 05:26
Re: Exec Command at isactly 12:00h
|
#7
|
Quote:
Originally Posted by fysiks
I would do something like this:
PHP Code:
public CmdRestart()
{
// Get the current time
static iHour, iMinute, iSecond, iSecondsLeft
time(iHour, iMinute, iSecond)
if( iHour == 11 || iHour == 23 ) // Just in case this function gets executed some other time
{
// Calculate the seconds until the next hour
iSecondsLeft = 3600 - (iMinute * 60 + iSecond)
if( iSecondsLeft % 60 == 0 && iSecondsLeft > 0) // Every minute on the minute except when we restart
{
client_print(0, print_chat, "!gO servidor ira reiniciar automaticamente em !n%d!g minutos.", iSecondsLeft / 60)
}
else if( iSecondsLeft == 30 || iSecondsLeft == 15 || iSecondsLeft <= 10 ) // Select times
{
client_print(0, print_chat, "!gO servidor ira reiniciar automaticamente em !n%d!g segundos.", iSecondsLeft)
}
else if( iSecondsLeft == 0 ) // Restart on the hour
{
server_cmd("restart")
}
}
}
|
Thank you!
|
|
|
|