Weird /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: Weird /admins command. (
/showthread.php?tid=598691)
Weird /admins command. -
danielpalade - 15.01.2016
Whenever I type /admins, it only shows me one admin from all of them on.
How do I fix this?
Код:
CMD:admins(playerid, params[])
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(pInfo[i][pAdminLevel] > 0)
{
new string[256], aName[MAX_PLAYER_NAME];
GetPlayerName(i, aName, sizeof(aName));
SendClientMessage(playerid, COLOR_ADMIN, "Admins Online:");
SendClientMessage(playerid, COLOR_ADMIN, "------------------------");
format(string, sizeof(string), "%s - Admin level %d", aName, pInfo[i][pAdminLevel]);
SendClientMessage(playerid, -1, string);
SendClientMessage(playerid, COLOR_ADMIN, "---------------------------------------------------------------");
SendClientMessage(playerid, -1, "If you have any problems, don't hesitate to use /report.");
SendClientMessage(playerid, -1, "Or you can use /n for questions about the server.");
SendClientMessage(playerid, COLOR_ADMIN, "---------------------------------------------------------------");
}
}
return 1;
}
Re: Weird /admins command. -
saffierr - 15.01.2016
Try this:
PHP код:
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(pInfo[i][pAdminLevel] > 0)
{
new string[256], aName[MAX_PLAYER_NAME];
GetPlayerName(i, aName, sizeof(aName));
SendClientMessage(playerid, COLOR_ADMIN, "Admins Online:");
SendClientMessage(playerid, COLOR_ADMIN, "------------------------");
if(pInfo[i][pAdminLevel] == 1)
format(string, sizeof(string), "%s - Admin level %d", aName, pInfo[i][pAdminLevel]);
SendClientMessage(playerid, -1, string);
SendClientMessage(playerid, COLOR_ADMIN, "---------------------------------------------------------------");
SendClientMessage(playerid, -1, "If you have any problems, don't hesitate to use /report.");
SendClientMessage(playerid, -1, "Or you can use /n for questions about the server.");
SendClientMessage(playerid, COLOR_ADMIN, "---------------------------------------------------------------");
}
else if(pInfo[i][pAdminLevel] == 2)
{
}
}
and so on
Re: Weird /admins command. -
Alex_T - 15.01.2016
I belive that is not what you want to do. That will send that message every single player.
Try this:
Код:
CMD:admins(playerid, params[])
{
new string[256], aName[MAX_PLAYER_NAME];
SendClientMessage(playerid, COLOR_ADMIN, "Admins Online:");
SendClientMessage(playerid, COLOR_ADMIN, "------------------------");
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(pInfo[i][pAdminLevel] != 0)
{
GetPlayerName(i, aName, sizeof(aName));
format(string, sizeof(string), "%s - Admin level %d", aName, pInfo[i][pAdminLevel]);
SendClientMessage(playerid, -1, string);
}
}
SendClientMessage(playerid, COLOR_ADMIN, "---------------------------------------------------------------");
SendClientMessage(playerid, -1, "If you have any problems, don't hesitate to use /report.");
SendClientMessage(playerid, -1, "Or you can use /n for questions about the server.");
SendClientMessage(playerid, COLOR_ADMIN, "---------------------------------------------------------------");
return 1;
}