Admin Level System.
#10

Quote:
Originally Posted by Bug.
Посмотреть сообщение
You know how to add /admins cmd
This command will only detect users who are logged into remote console. You can change it to detect users and the admin level variable.

pawn Код:
CMD:admins(playerid, params[])
{
    SendClientMessage(playerid, -1, "______________________________________________________"); // Simply for aesthetics.
    new acount = 0, string[100], pName[MAX_PLAYER_NAME]; // New variables are created.
    foreach(Player, i) // Looping through users.
    {
        if(!IsPlayerNPC(i) && IsPlayerAdmin(i)) // Foreach doesn't loop through users if they aren't connected. Added a check to ensure they aren't NPC's along with checking if they are logged into RCON.
        {
            acount += 1; // Increase the count of the variable everytime an administrator is found online.
            GetPlayerName(i, pName, sizeof(pName)); // Get the administrator's name, storing it into the variable. (pName).
            format(string, sizeof(string), "Administrator - %s.", pName); // Format the string with the administrator's name which is in the variable. (pName).
            SendClientMessage(playerid, -1, string); // Send the user the message we formatted above.
        }
    }
    if(acount == 0) SendClientMessage(playerid, -1, "No server administrators are currently online."); // If the variable is found at zero at the end of the loop, no administrators are logged into RCON or online.
    SendClientMessage(playerid, -1, "______________________________________________________"); // Simply for aesthetics.
    return 1;
}
Refer to:

Loops
Format
IsPlayerNPC
IsPlayerAdmin
SendClientMessage

The command also uses zeex's ZCMD command processing include and ******'s foreach include.

ZCMD
Foreach
Reply


Messages In This Thread
Admin Level System. - by Bug. - 26.09.2012, 20:41
Re: Admin Level System. - by BlueGames - 26.09.2012, 20:50
Re: Admin Level System. - by Bug. - 26.09.2012, 21:00
Re: Admin Level System. - by GangsterLifeRP - 26.09.2012, 21:02
Re: Admin Level System. - by Bug. - 26.09.2012, 21:06
Re: Admin Level System. - by GangsterLifeRP - 26.09.2012, 21:08
Re: Admin Level System. - by Bug. - 26.09.2012, 21:12
Re: Admin Level System. - by BlueGames - 26.09.2012, 21:15
Re: Admin Level System. - by GangsterLifeRP - 26.09.2012, 21:16
Re: Admin Level System. - by West X - 26.09.2012, 22:18

Forum Jump:


Users browsing this thread: 2 Guest(s)