SA-MP Forums Archive
help with names of more than 1 player - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: help with names of more than 1 player (/showthread.php?tid=538219)



help with names of more than 1 player - PMH - 20.09.2014

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)


Re: help with names of more than 1 player - PMH - 20.09.2014

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)??


Re: help with names of more than 1 player - VishvaJeet - 20.09.2014

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

Look This TOpic


Re: help with names of more than 1 player - rickisme - 20.09.2014

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", "");



Re: help with names of more than 1 player - Beckett - 20.09.2014

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!



Re: help with names of more than 1 player - PMH - 20.09.2014

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