11.03.2012, 18:35
5am and i cant think straight.
ok, so i simply want to check what player on the server has the most HP
ok, so i simply want to check what player on the server has the most HP
new Float:MostHealth=0.000000,MostHealthPlayer,Float:hp;
for(new i,ii = GetMaxPlayers(); i < ii; i++)
{
if(IsPlayerConnected(i))
{
GetPlayerHealth(i,hp,sizeof(hp));
if(hp > MostHealth)
{
MostHealth = hp;
MostHealthPlayer = i;
}
}
}
new str[128],name[30];
GetPlayerName(MostHealthPlayer,name,sizeof(name));
format(str,sizeof(str),"%s has the most health (%f)",name,MostHealth);
SendClientMessageToAll(COLOR,str);