SA-MP Forums Archive
Scripting help plz - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Scripting help plz (/showthread.php?tid=81611)



Scripting help plz - cloud9 - 12.06.2009

Here is my need when a player's vehicle health didnt decrease for 20 seconds he should be removed from his vehicle. but this code didnt work. I used timers for the 20 seconds cycle


pawn Код:
public health()
{
   
        for(new i=0;i<MAX_PLAYERS;i++)
    {
      if(PlayerDerby[i] == 1){
        if(IsPlayerInAnyVehicle(i))
    {
      GetVehicleHealth(GetPlayerVehicleID(i),oldv[i]);
            SetTimer("vhealth",20000,0);
            return 1;
        }
        return 1;
        }
        }
        return 1;
}
public vhealth()
{
        for(new i=0;i<MAX_PLAYERS;i++)
    {
      if(PlayerDerby[i] == 1){
        if(IsPlayerInAnyVehicle(i))
      {
      GetVehicleHealth(GetPlayerVehicleID(i),newv[i]);
            SetTimer("health",1000,0);
            if (oldv[i] == newv[i]) RemovePlayerFromVehicle(i);

            return 1;
        }
        return 1;
        }
        }
        return 1;
}



Re: Scripting help plz - cloud9 - 12.06.2009

sorry for double posting,

oldv is vehicle health before 20 seconds

and newv is vehicle health after 20 seconds