SA-MP Forums Archive
timer bug? or error? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: timer bug? or error? (/showthread.php?tid=534681)



timer bug? or error? - xXGangstaXx - 30.08.2014

Hey, I assigned a timer "vtimer" to remove 1 value from the variable "vTime" every 10 seconds.

The problem is that, for a brief moment it works ok. Then it has some sort of "spike" and it removes 2 values instead of one.

Is this a SetTimerEx bug or sth? Is there a fix you know?

Thanks


Re: timer bug? or error? - GGRoleplay - 30.08.2014

Can you show the code?


Re: timer bug? or error? - xXGangstaXx - 30.08.2014

pawn Код:
// ongamemodeinit
foreach(new vid : Vehicle)
    {
        SetTimerEx("FuelDown",10000,true,"i",vid);
    }

//Below code, the function (forwarded)
public FuelDown(vid)
{
    foreach (new playerid : Player)
    {
        if(IsPlayerInAnyVehicle(playerid))
        {
            vid = GetPlayerVehicleID(playerid);
            VInfo[vid][vFuel] --;
            printf("Fuel = %d",VInfo[vid][vFuel]);
        }
    }
    return 1;
}