if(!strcmp(cmdtext, "/testing", true)) { new name[MAX_PLAYER_NAME]; for(new i = 0; i <MAX_PLAYERS; i++){ if(IsPlayerNPC(i)){ new lol[256] = "* "; GetPlayerName(i,name,MAX_PLAYER_NAME); format(lol,256,"{FFFFFF}%s {64B500}%s,",lol,name); ShowPlayerDialog(playerid,100,DIALOG_STYLE_MSGBOX,"{64B500}Online:",lol,"OK","Exit"); } } return 1; }
SendClientMessage(playerid,COLOR_BLUE,lol);
new lol[256] = "* ";
if(!strcmp(cmdtext, "/testing", true))
{
new name[MAX_PLAYER_NAME], lol[256] = "* ";
for(new i = 0; i <MAX_PLAYERS; i++)
{
if(IsPlayerNPC(i)) continue;
GetPlayerName(i,name,MAX_PLAYER_NAME);
format(lol, 256, "{FFFFFF}%s {64B500}%s,", lol, name);
}
ShowPlayerDialog(playerid,100,DIALOG_STYLE_MSGBOX,"{64B500}Online:",lol,"OK","Exit");
return 1;
}
if(!strcmp(cmdtext, "/testing", true))
{
new name[MAX_PLAYER_NAME], lol[256], string[80];
for(new i = 0; i <MAX_PLAYERS; i++)
{
if(!IsPlayerNPC(i)) continue;
GetPlayerName(i, name, MAX_PLAYER_NAME);
format(string, sizeof string,"{FFFFFF}%d {64B500}%s,", i, name);
strcat(lol,string);
}
ShowPlayerDialog(playerid,100,DIALOG_STYLE_MSGBOX,"{64B500}Online:",lol,"OK","Exit");
return 1;
}
PHP код:
|
if(!strcmp(cmdtext, "/testing", true))
{
new name[MAX_PLAYER_NAME], lol[256], string[80];
for(new i = 0; i <MAX_PLAYERS; i++)
{
if(!IsPlayerNPC(i)) continue;
GetPlayerName(i, name, MAX_PLAYER_NAME);
format(string, sizeof string, "{FFFFFF}%d {64B500}%s,", i, name);
strcat(lol,string);
}
ShowPlayerDialog(playerid,100,DIALOG_STYLE_MSGBOX,"{64B500}Online:",lol,"OK","Exit");
return 1;
}
if(strcmp(cmd, "/testing", true) == 0) //by Ricop522
{
new playersonline[500], playersonline2[504];
new plName[MAX_PLAYER_NAME], Ricop522 = 0;
for( ; Ricop522 < MAX_PLAYERS; ++Ricop522)
{
if(IsPlayerConnected(i)) {
GetPlayerName(i, plName, sizeof(plName));
format(playersonline, sizeof(playersonline), "{FFFFFF}%i {64B500}%s\n", Ricop522, plName);
strcat(playersonline2,playersonline);
}
}
ShowPlayerDialog(playerid,100,DIALOG_STYLE_LIST,"Players On",playersonline2,"Exit","");
return 0x01;
}
Test this..
PHP код:
|
if(strcmp(cmd, "/testing", true) == 0) //by Garfield
{
new playersonline[500], playersonline2[MAX_PLAYERS*2];
new plName[MAX_PLAYER_NAME];
for(new i ; i < MAX_PLAYERS; ++i)
{
if(IsPlayerConnected(i ))
{
GetPlayerName(i, plName, sizeof(plName));
format(playersonline, sizeof(playersonline), "{FFFFFF}%i {64B500}%s\n", i, plName);
strcat(playersonline2,playersonline);
}
}
ShowPlayerDialog(playerid,100,DIALOG_STYLE_LIST,"Players On",playersonline2,"Exit","");
return 1;
}
I say:
"I think this works." I retired this from my gamemode, the /list of the cars . You just copy my code and remove a little things. Att, Ricop522. |
pawn Код:
|
if(!strcmp(cmdtext, "/testing", true))
{
new bool:check = false, lol[1024] = "* ";
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) && IsPlayerNPC(i)) //You can add here another checks later.
{
new name[MAX_PLAYER_NAME];
GetPlayerName(i, name, sizeof(name));
if(!check)
{
format(lol, sizeof(lol), "{FFFFFF}%s {64B500}%s", lol, name);
state = true;
}
else format(lol, sizeof(lol),"%s, %s", lol, name);
}
}
if(check) ShowPlayerDialog(playerid, 100, DIALOG_STYLE_MSGBOX, "{64B500}Online:", lol, "OK", "Exit");
else ShowPlayerDialog(playerid, 100, DIALOG_STYLE_MSGBOX, "{64B500}Online:", "{FF0000}Nobody", "OK", "Exit");
return 1;
}
I gonna clear up these things:
pawn Код:
|