My /admins command - 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: My /admins command (
/showthread.php?tid=307659)
My /admins command -
PlayHard - 31.12.2011
My problem is that when I type /admins it shows all the players who are connected to the server. If a player is an admin for sure it shows his rank before his/her name, but if the player is a normal player it just show his name. I want it to show ONLY the admins names.
pawn Code:
YCMD:admins(playerid, params[])
{
if(gPlayerLoggedIn[playerid] == 0) return 1;
SCM(playerid, COLOR_WHITE, "Administrators online:");
foreach(Player, i)
{
new level[128], string[128];
if(PlayerInfo[playerid][Admin] == 0 && PlayerInfo[i][Admin] > 1 /*&& AdminDuty[i] == 1*/)
{
switch(PlayerInfo[i][Admin])
{
case 2: level = ""adminlevel2"";
case 3: level = ""adminlevel3"";
case 4: level = ""adminlevel4"";
case 5: level = ""adminlevel5"";
}
format(string, sizeof(string), "%s %s", level, PlayerName(i));
SCM(playerid, COLOR_GREY, string);
}
if(PlayerInfo[playerid][Admin] > 0)
{
switch(PlayerInfo[i][Admin])
{
case 1: level = ""adminlevel1" (1)";
case 2: level = ""adminlevel2" (2)";
case 3: level = ""adminlevel3" (3)";
case 4: level = ""adminlevel4" (4)";
case 5: level = ""adminlevel5" (5)";
}
format(string, sizeof(string), "%s %s", level, PlayerName(i));
SCM(playerid, COLOR_GREY, string);
}
}
return 1;
}
I tried this
pawn Code:
else if(PlayerInfo[playerid][Admin] == 0)
{
format(string,sizeof(string), "");
}
Lol, but it didn't work.
Re: My /admins command -
James Coral - 31.12.2011
Errors??
Re: My /admins command -
PlayHard - 31.12.2011
There are no errors.
Re: My /admins command -
Norck - 31.12.2011
Try this:
pawn Code:
YCMD:admins(playerid, params[])
{
if(gPlayerLoggedIn[playerid] == 0) return 1;
SCM(playerid, COLOR_WHITE, "Administrators online:");
foreach(Player, i)
{
new level[128], string[128];
if(PlayerInfo[i][Admin] > 0)
{
switch(PlayerInfo[i][Admin])
{
case 1: level = ""adminlevel1" (1)";
case 2: level = ""adminlevel2" (2)";
case 3: level = ""adminlevel3" (3)";
case 4: level = ""adminlevel4" (4)";
case 5: level = ""adminlevel5" (5)";
}
format(string, sizeof(string), "%s %s", level, PlayerName(i));
SCM(playerid, COLOR_GREY, string);
}
}
return 1;
}
Re: My /admins command -
PlayHard - 31.12.2011
Thank you, I think it works.
Re: My /admins command -
Norck - 31.12.2011
Quote:
Originally Posted by PlayHard
Thank you, I think it works.
|
You are welcome