Alive Textdraw Help
#5

Why the value is set to -1 ? It should be simply 0, and yes your code is correct @RJTabish, (except your indentation..) but don't forget to add every exception, such as OnPlayerDeath, then, OnPlayerDisconnect, you will have to check if he is in the game or not, add a boolean variable for that:

pawn Код:
new    
    CountPUBGPlayers,
    bool:gInGame[MAX_PLAYERS];

CMD:enter(playerid)
{
    if(gInGame[playerid]) return 1;
    gInGame[playerid] = true;
    CountPUBGPlayers++;
    UpdateAliveTD();
    return 1;
}


CMD:exit(playerid)
{
    if(!gInGame[playerid]) return 1;
    gInGame[playerid] = true;
    CountPUBGPlayers--;
    UpdateAliveTD();
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    cmd_exit(playerid);
    return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
    cmd_exit(playerid);
    return 1;
}

UpdateAliveTD()
{
    new string[10];
    format(string, sizeof string, "%d alive", CountPUBGPlayers);
    TextDrawSetString(Textdrawpubg100, string);
    return 1;
}
Reply


Messages In This Thread
Alive Textdraw Help - by RJTabish - 04.03.2019, 08:15
Re: Alive Textdraw Help - by masuzaron - 04.03.2019, 09:37
Re: Alive Textdraw Help - by SymonClash - 04.03.2019, 11:06
Re: Alive Textdraw Help - by RJTabish - 04.03.2019, 15:15
Re: Alive Textdraw Help - by TheToretto - 04.03.2019, 15:56
Re: Alive Textdraw Help - by RJTabish - 04.03.2019, 16:13
Re: Alive Textdraw Help - by Pottus - 04.03.2019, 21:25

Forum Jump:


Users browsing this thread: 2 Guest(s)