Create a string for every player... Help please
#1

Hello, I'm making a transfer dialog... Which will show every player online in a list of a dialog...

How to do this?

Example:

Peter_Johnson
Sarah_Connor
Nikolai_Gordievsky


Help please?
Reply
#2

Why don't you just use ...
pawn Код:
public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
    return 1;
}
This will do the same as a Dialog Box - I think, but it's just in the Score.
Reply
#3

Because I'm using another dialog to create this dialog...
Reply
#4

Why not a loop then check if the player is connected then get the the name of every player and display it? :P
Edit: Idk if you have to split it somehow to get every name at a new line? :P
Reply
#5

Quote:
Originally Posted by Fj0rtizFredde
Посмотреть сообщение
Why not a loop then check if the player is connected then get the the name of every player and display it? :P
which means? -.-

tried this:

pawn Код:
new string[256],string2[256];
                for(new i=0; i<MAX_PLAYERS; i++)
                {
                       format(string,sizeof(string),"%s",pName(i));
            }
            format(string2,sizeof(string2),"%s\n",string);
                ShowPlayerDialog(playerid,BANKDIALOG+4,DIALOG_STYLE_LIST,"San Fierro Bank System",string2,"Select","Cancel");
but it didn't work that well....
Reply
#6

Bump.. help please
Reply
#7

I'm just doing something;

pawn Код:
new pName[MAX_PLAYER_NAME],string[256];
for(new i; i < MAX_PLAYERS; i++)
{
  GetPlayerName(i,pName,sizeof pName);
  format(string,sizeof(string),"%s\n%s",string,pName);
}
Didn't test it.
Reply
#8

pawn Код:
new
        xString[256]
;
for(new i; i != GetMaxPlayers(); i++)
{
        if(!IsPlayerConnected(i) || IsPlayerNPC(i)) continue;
        new
                pName[20]
        ;
        GetPlayerName(i, pName, 20);
        format(xString, sizeof(xString), "%s%s\n", xString, pName));
}
ShowPlayerDialog(playerid, dialogid, DIALOG_STYLE_LIST, "Online Players:", xString, "Ok", "Exit");
Should work.
Reply
#9

Something like this?

Код:
                        SendClientMessage(playerid, COLOR_WHITE, "Player Online:");
			for(new i = 0; i < MAX_PLAYERS; i++)
			{
				if(IsPlayerConnected(i))
				{
                                    new string[128];
                                    new pName[MAX_PLAYER_NAME];
				    GetPlayerName(i, pName, sizeof(pName));
			            format(string, 128, "%s", pName);
				    SendClientMessage(playerid, COLOR_WHITE, string);
                                 }
                         }
Reply
#10

Quote:
Originally Posted by RyDeR`
Посмотреть сообщение
pawn Код:
his code
Should work.
I thought dialogs could hold more than 256 characters. I think it's either 1024 or 2048. I'm not entirely sure about that.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)