Vehicle Health
#2

pawn Код:
new Float:oldv[MAX_PLAYERS];
new Float:newv[MAX_PLAYERS];
forward health();
forward vhealth();


public health()
{
  for(new i=0;i<MAX_PLAYERS;i++)
  {
    if(PlayerDerby[i] == 1)
    {
      if(IsPlayerInAnyVehicle(i))
      {
        new Float:carhp, Float:FinalHP;
        new VID = GetPlayerVehicleID(i);
        GetVehicleHealth(VID, carhp);
        FinalHP = carhp/10;
        oldv[i] = floatround(FinalHP, floatround_round);
        SetTimer("vhealth",20000,0);
      }
    }
  }

}

public vhealth()
{
  for(new i=0;i<MAX_PLAYERS;i++)
  {
    if(PlayerDerby[i] == 1)
    {
      if(IsPlayerInAnyVehicle(i))
      {
        new Float:carhp, Float:FinalHP;
        new VID = GetPlayerVehicleID(i);
        GetVehicleHealth(VID, carhp);
        FinalHP = carhp/10;
        newv[i] = floatround(FinalHP, floatround_round);
        SetTimer("health",1000,0);
        if(oldv[i] == newv[i]) RemovePlayerFromVehicle(i);
      }
    }
  }
}
That should work. By default Vehicle's hp are out of 1000. Anything you do may decrease it very little. This simply rounds it so the vehicle hp is out of 100. It should work fine.
Reply


Messages In This Thread
Vehicle Health - by cloud9 - 14.06.2009, 05:31
Re: Vehicle Health - by lavamike - 14.06.2009, 05:51
Re: Vehicle Health - by cloud9 - 14.06.2009, 07:15
Re: Vehicle Health - by dice7 - 14.06.2009, 07:19
Re: Vehicle Health - by cloud9 - 14.06.2009, 07:28
Re: Vehicle Health - by dice7 - 14.06.2009, 09:04
Re: Vehicle Health - by Grim_ - 14.06.2009, 09:07
Re: Vehicle Health - by cloud9 - 14.06.2009, 09:22
Re: Vehicle Health - by Grim_ - 14.06.2009, 09:25
Re: Vehicle Health - by cloud9 - 14.06.2009, 09:54

Forum Jump:


Users browsing this thread: 1 Guest(s)