02.12.2011, 23:41
pawn Код:
forward Detector();
public Detector() //Playerid parameter is not needed here!
{
new Float:MostHealth, Float:vHealth, vDriver = -1;
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;
}
}
if(vDriver == -1) return 0; //No players online...
new name[MAX_PLAYER_NAME];
GetPlayerName(vDriver, name, MAX_PLAYER_NAME);
//Whatever you want to do with the name
return 1;
}