2019-07-23, 11:10 PM
This is how i would solve the problem.
I didn't try compiling it but it should work, let me know.
I didn't try compiling it but it should work, let me know.
Code:
#define CHECKER_EXEC_INTERVAL_S? ? ?2
#define CHECKER_TIMER_INTERVAL_MS 1000
new nextCheckerTime;
public OnGameModeInit()
{
? ?SetTimer("Checker", CHECKER_TIMER_INTERVAL_MS, true);
}
forward Checker();
public Checker()
{
? ?prinft("[DEBUG] Checker(): gettime() = %i, nextCheckerTime = %i", gettime(), nextCheckerTime);
? ?if( gettime() >= nextCheckerTime )
? ?{
? ? ? ?print("[DEBUG] Checker(): gettime() >= nextCheckerTime");
? ? ? ?// do shit here..
? ? ? ?nextCheckerTime = gettime() CHECKER_EXEC_INTERVAL_S ; // Apply the next time value to this variable. When gettime() exceeds or equals this value the code within these brackets will be called again.
? ?}
}