how to show all players in one and multi lines ? - 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: how to show all players in one and multi lines ? (
/showthread.php?tid=467350)
how to show all players in one and multi lines ? -
omidi - 02.10.2013
i want show like when u press /players its shows like
player1,playerb,player3
player4,playerc,player5
Код:
dcmd_players(playerid,params[])
{
#pragma unused params
new string[128];
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) && !IsPlayerNPC(i))
{
format(string, sizeof(string), "%s(%d)",PlayerName(i),i);
SendClientMessage(playerid, 0xFFF84FFFF, string);
}
}
return 1;
}
but this code its shows like this
player1
playerb
player3
player4
playerc
player5
Re: how to show all players in one and multi lines ? -
Sliceofdeath - 02.10.2013
Putted this line on up of script ?
pawn Код:
#define dcmd(%1,%2,%3) if (!strcmp((%3)[1], #%1, true, (%2)) && ((((%3)[(%2) + 1] == '\0') && (dcmd_%1(playerid, ""))) || (((%3)[(%2) + 1] == ' ') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
Well I suggest you don't add this , It is useless cause there is already TAB to see all players online.
Re: how to show all players in one and multi lines ? -
Konstantinos - 02.10.2013
pawn Код:
dcmd_players(playerid,params[])
{
#pragma unused params
new string[75], count = 0;
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) && !IsPlayerNPC(i))
{
if(count != 2) format(string, sizeof(string), "%s%s,", string, PlayerName(i),i);
else format(string, sizeof(string), "%s%s", string, PlayerName(i),i);
count++;
}
if(count == 3)
{
SendClientMessage(playerid, 0xFFF84FFFF, string);
count = 0;
}
}
return 1;
}