samp-precise-timers icon indicating copy to clipboard operation
samp-precise-timers copied to clipboard

Additional format specifier

Open xarland opened this issue 5 years ago • 2 comments

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.

xarland avatar May 23 '19 22:05 xarland

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...

markski1 avatar Aug 21 '19 17:08 markski1

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.

Y-Less avatar Sep 23 '19 13:09 Y-Less