samp-precise-timers
samp-precise-timers copied to clipboard
Additional format specifier
How about this as a format specifier that passes the ID of the timer (t/T)?
Example before:
new gTimerID;
gTimerID = SetPreciseTimer("StartTimer", 1000, false, "i", playerid);
public StartTimer(playerid)
{
printf("playerid: %i, timerid: %i", playerid, gTimerID);
DeletePreciseTimer(gTimerID)
return 1;
}
Example after:
SetPreciseTimer("StartTimer", 1000, false, "it", playerid);
public StartTimer(playerid, timerid)
{
printf("playerid: %i, timerid: %i", playerid, timerid);
DeletePreciseTimer(timerid);
return 1;
}
The timerid will be passed not by the developer, and the plugin.
This could be handled with a cache like mysql plugin does, and no need to pass it as yet another parameter. Plus, using format specifier for stuff which is meant to be implicit by the plugin could make things a bit harder to understand...
I'd say an explicit parameter is way better than anything implicit. Then only the timers that actually want it get it, and you know you'll get it because you asked for it.