Difference between oldand new carhealth
#10

pawn Код:
new oldhealth[MAX_PLAYERS];

forward CarHealthTimer();
forward OnPlayerVehicleHealthChange(playerid, vehicleid, Float:oldhealth, Float:newhealth);

public OnGameModeInit()
{
  SetTimer("CarHealthTimer", 1000, true);
  return 1;
}

public CarHealthTimer()
{
  for (new i=0; i < MAX_PLAYERS; i++)
  {
    if (IsPlayerConnected(i) && IsPlayerInAnyVehicle(i))
    {
       new Float:current;
       new vehicleid = GetPlayerVehicleID(i);
       GetVehicleHealth(vehicleid, current);
       if(current != oldhealth[i])
       {
             OnPlayerVehicleHealthChange(i, vehicleid, oldhealth[i], current);
       }
       oldhealth[i] = current;
     }
  }
  return 1;
}

public OnPlayerVehicleHealthChange(playerid, vehicleid, Float:oldhealth, Float:newhealth)
{
  // Do something
  return 1;
}
Reply


Messages In This Thread
Difference between oldand new carhealth - by Remi-X - 18.06.2009, 21:10
Re: Difference between oldand new carhealth - by mamorunl - 18.06.2009, 21:16
Re: Difference between oldand new carhealth - by Remi-X - 18.06.2009, 21:19
Re: Difference between oldand new carhealth - by mamorunl - 18.06.2009, 21:23
Re: Difference between oldand new carhealth - by Remi-X - 18.06.2009, 21:28
Re: Difference between oldand new carhealth - by mamorunl - 18.06.2009, 21:59
Re: Difference between oldand new carhealth - by Remi-X - 19.06.2009, 07:36
Re: Difference between oldand new carhealth - by Abernethy - 19.06.2009, 07:39
Re: Difference between oldand new carhealth - by Remi-X - 19.06.2009, 07:44
Re: Difference between oldand new carhealth - by Andom - 19.06.2009, 07:46

Forum Jump:


Users browsing this thread: 1 Guest(s)