Is Player Alive ?
#1

Is there any function which tells that is there any player alive in the server. I mean in "no respawn dm" all players are dead and wins only one player who is still alive.
Reply
#2

You can kick them out of your DM when they are in a minigame or something, just check if PlayerHealth is arround 0 or 0.
Reply
#3

I don't want to kick him. I just want a function that finds the player and name that player in the chat.
Reply
#4

Код:
new Float:health;
GetPlayerHealth( playerid,health );
if ( health >= 0.0 ) 
{
    SetClientMessage( playerid, -1, "Player is alive!!!" );
}
Reply
#5

pakistan barbarian you have grass instead of brain. use a loop and a variable to check if player is in dm. To count how many players are in dm use another variable which you increase it ++ on each loop. And it starts from 0, if this variable goes to 1 means only one player alive in dm.
Reply
#6

try this:

pawn Код:
SetTimerEx("OnServerUpdate", 1, true);

public OnServerUpdate()
{
    new count=0;
    for(new i; i < MAX_PLAYERS; i++)
    {
        new Float:hp;
        GetPlayerHealth(i, hp);
        if(hp > 1.0)
        {   count++;    }
    }
    if(count > 1)
    {
        // DO your coding here
    }
    //if you need this code i mentioned above, so for your info. this will detect if there is only one player alive
    if(count == 1)
    {
        // DO your coding here
    }
    return 1;
}
Reply
#7

Quote:
Originally Posted by Excel™
Посмотреть сообщение
try this:
pawn Код:
SetTimerEx("OnServerUpdate", 1, true);
You cannot be serious.
Reply
#8

Quote:
Originally Posted by TheOnlyRealFuzzy
Посмотреть сообщение
You cannot be serious.
Whats the problem in this ?
Reply
#9

Quote:
Originally Posted by Excel™
Посмотреть сообщение
Whats the problem in this ?
dude why someone will need a 1 milli second timer for this purpose ..
Reply
#10

Quote:
Originally Posted by Excel™
Посмотреть сообщение
Whats the problem in this ?
That will be called 1000 times in a second? 10000 times in 10 seconds. 60000 times in a minute, you see any problem with performance maybe here?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)