You should have a server timer for all of these things and loop through the players by now in seconds. Then you just need a bunch of boolean values for the player so the timer can run a check. Using multiple timers in a server can be bad. And I don't personally trust auto execution of timers server side.
You should use a class instead of those arrays. Some might say this isn't the right way. But better than many! timers
Code Select
// Seconds storage
Player_Seconds <- array( GetMaxPlayers(), 0 );
// Minutes storage
Player_Minutes <- array( GetMaxPlayers(), 0 );
max_hints <- 4;
hint <- [
"Hint 0",
"Hint 1",
"Hint 2",
"Hint 3"
];
NewTimer("Server_Loop", 1000, 0);
function Server_Loop() {
for (local i=0;i<GetMaxPlayers();i++) {
local player = FindPlayer(i);
if (player) {
// Increase the time in seconds
Player_Seconds[player.ID]++;
/*
Do anything here in seconds
*/
//Announce("Time: " + Player_Minutes[player.ID] + ":" + Player_Seconds[player.ID], player, 0 );
// Check time
if (Player_Seconds[player.ID] == 60) {
Player_Minutes[player.ID]++;
// Clear the seconds
Player_Seconds[player.ID] = 0;
//hints
/*local iRandom = rand() % max_hints;
Announce( hint[iRandom], player, 0 );*/
//hints
/*
You can do anything here. Add a check for every five minutes to anything really
*/
}
// Check time
}
}
}
You should use a class instead of those arrays. Some might say this isn't the right way. But better than many! timers