How to show a list of all online players?
#1

How would i show a list of all online players - Showing there name and ID,
Using DIALOG_STYLE_LIST
Reply
#2

Why would you need one?
There's already one if you press the TAB Button.
Reply
#3

Because its not for that type of thing...
Anyone know how i can?
Reply
#4

Using strcat, very simple.

ex.
pawn Код:
new
        tmp[ 50 ],
        iString[ 512 ];

    for(new c; c < MAX_PLAYERS; c++)
    {
        if(!IsPlayerConnected(c)) continue;
        format(tmp,sizeof(tmp),"%s (ID: %d)\n",PlayerName(c), c);
        strcat(iString,tmp);
    }
    ShowPlayerDialog( .. );
Reply
#5

I could do that without using strcat
Reply
#6

Anyway,
I have managed to get a list of players,
But when a player clicks one:

Example ID 0 So that would be

case 0:

i guess,
How would i get it to do stuff for that player?
Like how would i get the id of the player he picked or would it just be id 0?
Reply
#7

Quote:
Originally Posted by Joe Torran C
I could do that without using strcat
look into this:

https://sampwiki.blast.hk/wiki/OnPlayerClickPlayer

Quote:
Originally Posted by Joe Torran C
Anyway,
I have managed to get a list of players,
But when a player clicks one:

Example ID 0 So that would be

case 0:

i guess,
How would i get it to do stuff for that player?
Like how would i get the id of the player he picked or would it just be id 0?
If you dont use that callback above, you would use listitem to get their id (assuming that you got them/added them in order).

Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
  switch(dialogid)
  {
     case (YOUR_DIALOG_ID):
    {
       SendClientmessage(listitem, 0xFFFFFFFF, "bye dbag!");
       ban(listitem);
       return 1;
    }
  }
  return 0;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)