How to show a list of all online players? - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: How to show a list of all online players? (
/showthread.php?tid=132825)
How to show a list of all online players? -
Torran - 09.03.2010
How would i show a list of all online players - Showing there name and ID,
Using DIALOG_STYLE_LIST
Re: How to show a list of all online players? -
Epic Shower - 09.03.2010
Why would you need one?
There's already one if you press the TAB Button.
Re: How to show a list of all online players? -
Torran - 09.03.2010
Because its not for that type of thing...
Anyone know how i can?
Re: How to show a list of all online players? -
woot - 09.03.2010
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( .. );
Re: How to show a list of all online players? -
Torran - 09.03.2010
I could do that without using strcat
Re: How to show a list of all online players? -
Torran - 10.03.2010
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?
Re: How to show a list of all online players? -
Kyosaur - 10.03.2010
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;
}