05.12.2011, 14:55
hi,
how can i check what player is driving the vehicle with the most health atm?
(vehicle health NOT player health!)
Would be happy about help, cause this code is not working well:
thx
how can i check what player is driving the vehicle with the most health atm?

(vehicle health NOT player health!)
Would be happy about help, cause this code is not working well:
pawn Код:
//im using this in a timer:
forward Detector();
public Detector()
{
new Float:MostHealth, Float:vHealth, vDriver;
foreach(Player, i)
{
if(GetPlayerVehicleSeat(i) != 0) continue; //Ignores passengers and players that aren't in a vehicle
GetVehicleHealth(GetPlayerVehicleID(i), vHealth);
if(floatcmp(MostHealth, vHealth) == -1) //Checks if the health is higher than the one saved previously
{
MostHealth = vHealth;
vDriver = i;
}
}
new name[MAX_PLAYER_NAME];
GetPlayerName(vDriver, name, MAX_PLAYER_NAME);
//here i want to get the name of the player that is driving the vehicle with the most health...
//...
return 1;
}
