/admins command doesnt work - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: /admins command doesnt work (
/showthread.php?tid=95800)
/admins command doesnt work -
bubka3 - 05.09.2009
Someone tell me whats wrong, Complies no errors but doesnt show admins.
Quote:
if (strcmp(cmd, "/admins", true) == 0)
{
if(IsPlayerConnected(playerid))
{
SendClientMessage(playerid, COLOR_YELLOW, "[ ! ] List of online adminstrators");
for(new playerid = 0; playerid < MAX_PLAYERS; playerid++)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pAdmin] >= 1 && PlayerInfo[playerid][pAdmin] < 4)
{
new admtext[64];
if(PlayerInfo[playerid][pAdmin] == 4) { admtext = "level 4"; }
else if(PlayerInfo[playerid][pAdmin] == 3) { admtext = "level 3"; }
else if(PlayerInfo[playerid][pAdmin] == 2) { admtext = "level 2"; }
else if(PlayerInfo[playerid][pAdmin] == 1) { admtext = "level 1"; }
else { admtext = "level 1"; }
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, 256, "%s %s", sendername,admtext);
SendClientMessage(playerid, COLOR_ADMIN, string);
}
}
}
}
return 1;
}
|
Re: /admins command doesnt work - Zeex - 05.09.2009
It actually shows to each player his admin level.
Try this:
pawn Код:
if (strcmp(cmd, "/admins", true) == 0)
{
SendClientMessage(playerid, COLOR_YELLOW, "[ ! ] List of online adminstrators");
for (new i; i < MAX_PLAYERS; i ++)
{
if(PlayerInfo[i][pAdmin] >= 1 && PlayerInfo[i][pAdmin] < 4)
{
new
adminname[MAX_PLAYER_NAME];
GetPlayerName(i, adminname, MAX_PLAYER_NAME);
format(string, sizeof(string), "%s - level: %d", adminname, PlayerInfo[i][pAdmin]);
SendClientMessage(playerid, COLOR_ADMIN, string);
}
}
return 1;
}
Also I guess you don't need to check whether players connected since all pInfo vars are cleared when they connect/disconnect.
Re: /admins command doesnt work -
bubka3 - 05.09.2009
Still doesnt work
Re: /admins command doesnt work - Zeex - 05.09.2009
Oh, I forgot to get admin name... check the post above
Quote:
Originally Posted by bubka3
Still doesnt work
|
Hm...
Re: /admins command doesnt work -
bubka3 - 05.09.2009
Still I cant see myself as admin , and I think i needs 2 be defined or something
Re: /admins command doesnt work - Zeex - 05.09.2009
Is "List of online adminstrators" message shown?
And maybe it's stupid question but I just need be sure - have you logged in as ingame admin?
If so, what is your admin level? Is it higher than 3?
Re: /admins command doesnt work -
bubka3 - 05.09.2009
List of online is shown and my admin lvl is 4
Re: /admins command doesnt work -
bubka3 - 05.09.2009
Fixed
Re: /admins command doesnt work - Zeex - 05.09.2009
Then you need change
pawn Код:
&& PlayerInfo[i][pAdmin] < 4)
to
pawn Код:
&& PlayerInfo[i][pAdmin] <= 4)
or remove that part and just do
pawn Код:
if(PlayerInfo[i][pAdmin] >= 1)
----------------
Quote:
Originally Posted by bubka3
Fixed
|
OK
Re: /admins command doesnt work -
dugi - 05.09.2009
Nothing to do with 0.3