help with names of more than 1 player
#1

I want to show all RCON admins online in DIALOG_STYLE_MSGBOX
How to do that?
pawn Код:
format(string, 128, "RCON ADMINS: %s", GetName(i))
This doesn't displays all names, and I want it to display ever name on a separate line.. Anyone can help me how to do that?

+

can we create a directory using Y_ini or any include (not filemanager plugin)
Reply
#2

Quote:
Originally Posted by ******
Посмотреть сообщение
Adding to a string: strcat.
Adding a new line: "\n".
lol u didn't understood the question or i didn't explained it well..
im asking how to list all names of online rcon admins each on a separate line in a dialog..
Like this:
Код:
RCON Admins
Beta(1)
PMH(2)
******(3)
like this in dialogs.. ^^
i know how to add a separate line, i'm asking how to do that with many names like IsPlayerConnected(i)??
Reply
#3

https://sampforum.blast.hk/showthread.php?tid=319196

Look This TOpic
Reply
#4

Wow, ****** already told you how to make it

pawn Код:
new string[128] = "";

for(new i; i < MAX_PLAYERS; i++)
{
    if(IsPlayerConnected(i))
    {
        if(IsPlayerAdmin(i))
        {
            new name[MAX_PLAYER_NAME+1], str[50];
            GetPlayerName(i, name, sizeof(name));
            format(str, sizeof str, "%s (%d)\n", name, i);
            strcat(string, str);
        }
    }
}

ShowPlayerDialog(playerid, dialogid, DIALOG_STYLE_LIST, "Admin Online", string, "OK", "");
Reply
#5

Loop through all players.

IsPlayerConnected(playerVar);

IsPlayerAdmin(playerVar)

Display Name Here!
(Do not show dialog here! show it out of the loop!)
Close Bracket

Close Bracket
ShowPlayerDialog(Yourdialog);
pawn Код:
new string[128] = ""; // Do not decrease this because it's the whole string including the names! Not 1 name!

for(new i; i < MAX_PLAYERS; i++)
{
    if(IsPlayerConnected(i))
    {
        if(IsPlayerAdmin(i))
        {
            new name[MAX_PLAYER_NAME+1], str[50];
            GetPlayerName(i, name, sizeof(name));
            format(str, sizeof str, "%s (%d)\n", name, i);
            strcat(string, str);
        }
    }
}

ShowPlayerDialog(playerid, dialogid, DIALOG_STYLE_LIST, "Admin Online", string, "OK", "");
//This is NOT by made by me. Made by ABOVE poster!
Reply
#6

Thanks to all!
rickisme +rep, that code was too useful.. finally i know how loop works..
DaniceMcHarley, thanks for that explanation too!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)