/admins command zcmd - 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 command zcmd (
/showthread.php?tid=606294)
/admins command zcmd -
Fantje - 02.05.2016
Hey there,
I don't like the /admins command that I am using on LuxAdmin.
I want that if you type /admins that there will be a dialog with the online admins in it.
Can someone please help me?
admin CMD:
PHP Code:
CMD:admins(playerid,params[])
{
#pragma unused params
new count = 0;
new string[128];
new ChangeColor;
SendClientMessage(playerid, green, " ");
SendClientMessage(playerid, green, "___________ |- Online Admins -| ___________");
SendClientMessage(playerid, green, " ");
for(new i = 0; i < MAX_PLAYERS; i++)
{
if (IsPlayerConnected(i))
{
if(AccInfo[i][Level] >= 1 && AccInfo[i][Hide] == 0)
{
if(AccInfo[i][Level] > 5)
{
AdmRank = "Professional Admin";
ChangeColor = Color_Professional_Admin;
}
if(IsPlayerAdmin(i))
{
AdmRank = "RCON Administrator";
ChangeColor = Color_RCON_Administrator;
}
else
{
switch(AccInfo[i][Level])
{
case 1: {
AdmRank = "Basic Moderator";
ChangeColor = Color_Basic_Moderator;
}
case 2: {
AdmRank = "Moderator";
ChangeColor = Color_Moderator;
}
case 3: {
AdmRank = "Master Moderator";
ChangeColor = Color_Master_Moderator;
}
case 4: {
AdmRank = "Administrator";
ChangeColor = Color_Administrator;
}
case 5: {
AdmRank = "Master Administrator";
ChangeColor = Color_Master_Administrator;
}
}
}
switch(AccInfo[i][OnDuty])
{
case 0: AdmDuty = "Playing!";
case 1: AdmDuty = "On Duty!";
}
format(string, 128, "Level: %d - %s (Id:%i) | %s | %s",AccInfo[i][Level], PlayerName2(i),i,AdmRank,AdmDuty);
SendClientMessage(playerid, ChangeColor, string);
count++;
}
}
}
if (count == 0)
SendClientMessage(playerid,red,"No admin online in the list");
SendClientMessage(playerid, green, " _______________________________________");
return 1;
}
Re: /admins command zcmd -
Konstantinos - 02.05.2016
Foreach is recommended:
PHP Code:
CMD:admins(playerid, params[])
{
new
count,
string[500],
ChangeColor[] = {Color_Basic_Moderator, Color_Moderator, Color_Master_Moderator, Color_Administrator, Color_Master_Administrator},
_AdmRank[][] = {"Basic Moderator", "Moderator", "Master Moderator", "Administrator", "Master Administrator"};
foreach(new i : Player)
{
if (!AccInfo[i][Level] || AccInfo[i][Hide]) continue;
format(string, sizeof string, "%s{%06x}Level: %d - %s (Id:%i) | %s | %s\n", string, IsPlayerAdmin(i) ? Color_RCON_Administrator >>> 8 : AccInfo[i][Level] <= 5 ? ChangeColor[AccInfo[i][Level] - 1] >>> 8 : Color_Professional_Admin >>> 8,
AccInfo[i][Level], PlayerName2(i), i, IsPlayerAdmin(i) ? ("RCON Administrator") : AccInfo[i][Level] <= 5 ? _AdmRank[AccInfo[i][Level] - 1] : ("Professional Admin"), !AccInfo[i][OnDuty] ? ("Playing!") : ("On Duty!"));
count++;
}
if (!count) SendClientMessage(playerid, red, "No admin online in the list");
else ShowPlayerDialog(playerid, 342, DIALOG_STYLE_MSGBOX, "___________ |- Online Admins -| ___________", string, "Close", "");
return 1;
}