20.01.2011, 11:14
and any question! how to recover from all the players who has the highest health
Thanks !
Thanks !
stock returnHighestHealthID()
{
new Float:_health[2], pMost = INVALID_PLAYER_ID;
for(new i; i < MAX_PLAYERS; i++)
{
if(!IsPlayerConnected(i) || IsPlayerNPC(i)) continue;
GetPlayerHealth(i, _health[0]);
if(_health[0] > _health[1]) pMost = i, _health[1] = _health[0];
}
return pMost;
}
stock GETHHPPlayerID()
{
new Float:phealth, Float:chealth, pid = INVALID_PLAYER_ID;
for(new i=0; i<GetMaxPlayers(); i++)
{
if(!IsPlayerConnected(i)) continue;
GetPlayerHealth(playerid, chealth);
if(chealth > phealth) phealth = chealth, pid = i;
}
return pid;
}