04.01.2011, 04:33
So you want the time to change?
Whatever try this:
When the "timechange" is gonna be called, do GameHour + 1. (Use "GameHour += 1" or "GameHour++")
When it's above 24, set it to 0. And no needed to use all the 'if' statements (and the else if's)
Whatever try this:
When the "timechange" is gonna be called, do GameHour + 1. (Use "GameHour += 1" or "GameHour++")
When it's above 24, set it to 0. And no needed to use all the 'if' statements (and the else if's)
pawn Код:
public timechange()
{
new str[128]; //To format the message
GameHour++; //Gamehour + 1
if(GameHour > 24) GameHour = 0; //Is the hour 25 (or above)? Set it to 0
SetWorldTime(GameHour); //Change the server's time
format(str, 128, "Gametime: %02d.00", GameHour); //Format the message: GAMEHOUR.00 (so it will be '07.00'. when gamehour = 7. It's %02d (02) so it use 2 integers. 7 = 07, not 7
SendClientMessageToAll(0xFFFFFFAA, str); //Send white message to everyone
return 1;
}

