getplayerhealth
#1

5am and i cant think straight.

ok, so i simply want to check what player on the server has the most HP
Reply
#2

pawn Код:
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);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)