View Single Post
Vaggelis
Senior Member
Join Date: May 2017
Old 09-18-2018 , 13:21   Re: How to get the lowest health of the player?
#9

Quote:
Originally Posted by Ilusion9 View Post
so you check if client > 0 && client <= MaxClients in a for that starts with 1 and ends at MaxClients?
also isclientconnected it's useless when you check if the client is in game.

PHP Code:
public int HasLowestHealth()
{
    
size 0;
    
int client = -1min = -1;
    
    for (
int i 1<= MaxClientsi++)
    {
        if (
IsClientInGame(i))
        {
            if (
IsPlayerAlive(i))
            {
                
int health GetClientHealth(i);
                
                if (
min == -1)
                {
                    
min health;
                    
client i;
                }
                else
                {
                    if (
health min)
                    {
                        
min health;
                        
client i;
                    }
                }
            }
        }
    }

    return 
client;

Whats the point posting that code? Edison1318 got what he wanted
Vaggelis is offline