SA-MP Forums Archive
Problem with timer - 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: Problem with timer (/showthread.php?tid=465809)



Problem with timer - cuemur - 24.09.2013

PHP код:
LockNearbyVehicles(playeridFloat:radi)
{
    new 
Float:xFloat:yFloat:z;
    
GetPlayerPos(playeridxyz);
    for(new 
i=1i<MAX_VEHICLESi++)
    {
        if(
GetVehicleModel(i))
        {
            
TimeRunning[i] = 40;
            new 
Float:posxFloat:posyFloat:posz;
            new 
Float:tempposxFloat:tempposyFloat:tempposz;
            
GetVehiclePos(iposxposyposz);
            
tempposx = (posx x);
            
tempposy = (posy y);
            
tempposz = (posz z);
            if (((
tempposx radi) && (tempposx > -radi)) && ((tempposy radi) && (tempposy > -radi)) && ((tempposz radi) && (tempposz > -radi)))
            {
                if(
!= GetPlayerVehicleID(playerid))   {
                
GetVehicleParamsEx(ienginelightsalarmdoorsbonnetbootobjective);
                
SetVehicleParamsEx(iVEHICLE_PARAMS_OFFVEHICLE_PARAMS_ONalarmdoorsbonnetbootobjective);    }
            }
        }
    }

PHP код:
forward SecUpdate2();
public 
SecUpdate2()
{
    
MafiaCheck();
    for(new 
=0<= MAX_VEHICLESi++)
    {
        if(
TimeRunning[i] > 0)  {
            
TimeRunning[i]--;   }
            
    }

This lock's all nearby vehicles for 40 seconds but 40 seconds never end's
HELP :/


Re: Problem with timer - Konstantinos - 24.09.2013

You need to kill the timer if the time passed.