Scripting help plz
#1

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;
}
Reply
#2

sorry for double posting,

oldv is vehicle health before 20 seconds

and newv is vehicle health after 20 seconds
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)