Players Alive counter doesn't go down OnPlayerDisconnect
#1

Hello, with my project partner we have been working on an alive counter, i've been working on it since 02:19 and it's already 05:23
We are doing the Race DM mode of our Multi Mode
and we have been the players alive counter go down and up when a player dies, spawns, is spectating, gets in a vehicle etc...
There was many bugs, and made it to fix all of them (yay)
The problem comes when the player disconnects, i want to make the counter go down when a player on the Race DM mode disconnects, the problem is that it doesn't, it stays at the same place!

There is no errors nor warnings when i compile and everything seems to be fine, so i came here asking for help ^^

Here is my code:
PHP код:
public OnPlayerDisconnect(playeridreason)
{
    
// Login Register system, and leaving messages here!
    // From here is the alive counter!
    
new alive[3];
    for(new 
0MAX_PLAYERSi++)
    {
        if (
pInfo[playerid][DM] && pInfo[i][DM] == 1)
        {
            
SetPlayerHealth(playerid0);
            
AlivePlayers-=1;
            if (
AlivePlayers 10)
            {
                
format(alivesizeof(alive), "0%i"AlivePlayers);
            }
            else if (
AlivePlayers 9)
            {
                
format(alivesizeof(alive), "%i"AlivePlayers);
            }
            
TextDrawSetString(numberalalive);
            
TextDrawShowForPlayer(ialbox1);
            
TextDrawShowForPlayer(ialbox2);
            
TextDrawShowForPlayer(iAlive);
            
TextDrawShowForPlayer(inumberal);
        }
    }
    return 
1;

Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 3 Guest(s)