Resetting a string.. or something.
#1

So, today I've encountered a problem with my /members command
pawn Код:
CMD:members(playerid, params[])
{
    new userlist[250];
    new name[MAX_PLAYER_NAME];
    new counton[128];
    new count = 0;
    if(PlayerVar[playerid][GroupRank] > 5)
    {
        for(new i; i < MAX_PLAYERS; i++) {
            if(PlayerVar[i][Group] == PlayerVar[playerid][Group]){
                GetPlayerName(i, name, sizeof(name));
                format(userlist, sizeof(userlist), "%s{068481}%s{FFFFFF} - Rank %d\n", userlist, name, PlayerVar[i][GroupRank]);
                count++;
                format(counton, sizeof(counton), "Membrii totali conectati in factiunea %s: %d", GroupInfo[PlayerVar[playerid][Group]][gName], count);
            }
        }
    }
    SCM(playerid, COLOR_NOB, counton);
    ShowPlayerDialog(playerid, 97, DIALOG_STYLE_LIST, "UXG RPG: Members", userlist, "OK", "Cancel");
    return 1;
}
Everything works fine, it is doing exactly what it is supposed to do (show online members of a faction)
But here's the problem, while the player is online it is being displayed in a dialog, along with other members
whenever he logs out, he's not being removed from that string and I can still see him when I use /members.

What might cause this bug?
Reply
#2

Change line: if(PlayerVar[i][Group] == PlayerVar[playerid][Group]){

To - if(PlayerVar[i][Group] == PlayerVar[playerid][Group] && IsPlayerConnected(i)){
Reply
#3

Quote:
Originally Posted by KyleSmith
Посмотреть сообщение
Change line: if(PlayerVar[i][Group] == PlayerVar[playerid][Group]){

To - if(PlayerVar[i][Group] == PlayerVar[playerid][Group] && IsPlayerConnected(i)){
Thank you, it's working now.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)