This is a sneak-peek at one of the improved modules we've done, for timers in open.mp:

native SetTimer(const func[], msInterval, bool:repeat) = SetTimerEx;
native SetTimerEx(const func[], msInterval, bool:repeat, const params[], GLOBAL_TAG_TYPES:...);
native KillTimer(timer) = Timer_Kill;
// CreateTimer
native Timer:Timer_Create(const func[], usDelay, usInterval, repeatCount, const params[] = "", GLOBAL_TAG_TYPES:...);
// KillTimer
native bool:Timer_Kill(Timer:timer);
// Return time till next call.
native Timer_GetTimeRemaining(Timer:timer);
// Get number of calls left to make (0 for unlimited).
native Timer_GetCallsRemaining(Timer:timer);
// Get `repeatCount` parameter.
native Timer_GetTotalCalls(Timer:timer);
// Get `usInterval` parameter.
native Timer_GetInterval(Timer:timer);
// Reset time remaining till next call to `usInterval`.
native bool:Timer_Restart(Timer:timer);

The first two are just for backwards-compatibility, the rest are the improved API:

native Timer:Timer_Create(const func[], usDelay, usInterval, repeatCount, const params[] = "", GLOBAL_TAG_TYPES:...);
  • func - Fairly obvious; what to call.
  • usDelay - Again obvious, the delay before the call (in microseconds).
  • usInterval - What to reset usDelay to after the first call. So if you wanted a timer on the hour every hour, but it was 8:47am right now, the call would be Timer_Create("OnTheHour", 780 SECONDS, 3600 SECONDS, 0);
  • repeatCount - Unlike the old functions, which are just "once" or "forever", this instead takes the number of times to call the function. "once" would be 1, 500 would stop after 500 calls, and (backwards from the old API) 0 means "forever".
  • GLOBAL_TAG_TYPES - Like {Float, ...}, but with more tags.