/admins dialog - 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: /admins dialog (
/showthread.php?tid=508500)
/admins dialog -
MORJAN1122 - 22.04.2014
How to do this cmd in dialog the cmd is /admins
PLs help fast
CMd code:
Code:
CMD:admins(playerid, params[])
{
new count = 0, string[256], AdmRank[500];
SendClientMessage(playerid, COLOR_PINK,"Current Online Admins:");
for(new i = 0; i < MAX_PLAYERS; i ++)
{
if(IsPlayerConnected(i))
{
if(PlayerInfo[i][Level] >= 1)
{
AdmRank = " ";
new nameee[128];
GetPlayerName(i, nameee, 16);
if(!strcmp(nameee, "[COD]ZORN", true) || !strcmp(nameee, "Colonel", true))
{
AdmRank = "[Server Mapper]";
}
if(!strcmp(nameee, "[COD]SelnaGo", true) || !strcmp(nameee, "Jimmy", true))
{
AdmRank = "[Server Owner]";
}
if(!strcmp(nameee,"[COD]SNAKE",true) | !strcmp(nameee, "SourceVG", true))
{
AdmRank ="[Scripter][Server Owner]";
}
format(string, sizeof(string),"ADMIN: [%d]%s Level: %d %s", i, PlayerName2(i), PlayerInfo[i][Level], AdmRank);
SendClientMessage(playerid, COLOR_PINK, string);
count++;
}
}
}
if(count == 0)
{
SendClientMessage(playerid, COLOR_PINK,"No Admins Online");
}
return 1;
}
Re: /admins dialog -
Konstantinos - 22.04.2014
Use foreach because it's faster and it loops through the connected players only.
pawn Code:
CMD:admins(playerid, params[])
{
new count, string[256], AdmRank[32] = "N/A", nameee[21];
foreach(new i : Player)
{
if (PlayerInfo[i][Level] < 1) continue;
count++;
GetPlayerName(i, nameee, sizeof (nameee));
if (!strcmp(nameee, "[COD]ZORN", true) || !strcmp(nameee, "Colonel", true)) AdmRank = "[Server Mapper]";
else if (!strcmp(nameee, "[COD]SelnaGo", true) || !strcmp(nameee, "Jimmy", true)) AdmRank = "[Server Owner]";
else if (!strcmp(nameee, "[COD]SNAKE",true) | !strcmp(nameee, "SourceVG", true)) AdmRank ="[Scripter][Server Owner]";
format(string, sizeof (string), "%sADMIN: [%d]%s Level: %d %s\n", string, i, PlayerName2(i), PlayerInfo[i][Level], AdmRank);
// Does "PlayerName2" function return different name? If not, change to "nameee" since you got the name already.
}
if (!count) SendClientMessage(playerid, COLOR_PINK,"No Admins Online");
else ShowPlayerDialog(playerid, 678, DIALOG_STYLE_MSGBOX, "Current Online Admins:", string, "Close", "");
return 1;
}