[HELP] Listing members
#1

So I don't know how to fix this, the problem is that function is not showing online and offline mebmers it only shows either online or offline, not both of them, this is the function.

pawn Код:
public OfflineMembers(playerid)
{
    new numrows = cache_get_row_count(konekt);
    new username[MAX_PLAYER_NAME], rank, str[25], sup[200];
    if(numrows)
    {
         for(new i; i <numrows; i++)
         {
            cache_get_field_content(i, "Ime", username, 1, sizeof(username));
            rank = cache_get_field_content_int(i,"Rank");

            if(rank == 0) { str = "RANK - 0"; }
            else if(rank == 1) { str = "RANK - 1"; }
            else if(rank == 2) { str = "RANK - 2"; }
            else if(rank == 3) { str = "RANK - 3"; }
            else if(rank == 4) { str = "RANK - 4"; }
            else if(rank == 5) { str = "RANK - 5"; }
            else if(rank == 6) { str = "RANK - 6"; }

            if(ReturnUser(username) != INVALID_PLAYER_ID)
            {
                format(sup, sizeof(sup), "{00C0FF}[ON]__________________[%s]______________[%s]", str, username);
            }
            else if(ReturnUser(username) == INVALID_PLAYER_ID)
            {
                format(sup, sizeof(sup), "{F81414}[OFF]_________________[%s]______________[%s]", str, username);
            }
        }
    }
    SPD(playerid, DIALOG_ALLMEMBERS, DIALOG_STYLE_MSGBOX, "Svi Clanovi", sup, "Uredu", "");
}
return user

pawn Код:
ReturnUser(text[], playerid = INVALID_PLAYER_ID)
{
    new pos = 0;
    while (text[pos] < 0x21)
    {
        if (text[pos] == 0) return INVALID_PLAYER_ID;
        pos++;
    }

    new userid = INVALID_PLAYER_ID;
    if (IsNumeric(text[pos]))
    {
        userid = strval(text[pos]);
        if (userid >=0 && userid < MAX_PLAYERS)
        {
            if(!IsPlayerConnected(userid))
            userid = INVALID_PLAYER_ID;
            else return userid;
        }
    }

    new len = strlen(text[pos]);
    new count = 0;
    new pname[MAX_PLAYER_NAME];

    for (new i = 0; i < MAX_PLAYERS; i++)
    {
        if (IsPlayerConnected(i))
        {
            GetPlayerName(i, pname, sizeof (pname));
            if (strcmp(pname, text[pos], true, len) == 0)
            {
                if (len == strlen(pname)) return i;
                else
                {
                    count++;
                    userid = i;
                }
            }
        }
    }

    if (count != 1)
    {
        if (playerid != INVALID_PLAYER_ID)
        {
            if (count) SendClientMessage(playerid, WHITE, "Enter the full name of the user.");
            else SendClientMessage(playerid, GREY, "No results found for the specified phrase.");
        }
        userid = INVALID_PLAYER_ID;
    }
    return userid;
}
I don't know what is the freaking proble, maybe the returnuser function, idk, please tell me how to fix this.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)