recover between all the players which has the highest health
#1

and any question! how to recover from all the players who has the highest health

Thanks !
Reply
#2

So you want recover it by connecting? (When he disconnected it should save the hp he had and by connecting it should load?
Reply
#3

I guess you wanna get the player id which has the most health .. I guess something like this should work;

pawn Код:
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;
}
Reply
#4

pawn Код:
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;
}
Reply
#5

Thanks !
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)