AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Problem with admin manager (https://forums.alliedmods.net/showthread.php?t=189069)

Ang52 07-03-2012 06:52

Problem with admin manager
 
i've this plugin that exolent made.


but there is some problem, when im add admin it add myself and exit in the menu of choosing auth id.

this is the code:

PHP Code:

#include <amxmodx>
#include <amxmisc>

// Access level required for managing admins
#define ADMIN_MANAGE ADMIN_RCON

new gCaseSensitive;
#define IsCaseSensitive(%1)   (gCaseSensitive &   (1 << (%1 & 31)))
#define SetCaseSensitive(%1)   gCaseSensitive |=  (1 << (%1 & 31))
#define ClearCaseSensitive(%1) gCaseSensitive &= ~(1 << (%1 & 31))

// Admin data structure
enum _:AdminData {
    
Admin_Name[32],
    
Admin_Auth[64],
    
Admin_Password[32],
    
Admin_Access,
    
Admin_Flags,
    
Admin_Level,
    
Admin_LastVisit
};

// Array of all admins
new Array:gAdminData;

// Size of admin data
new gNumAdmins;

// Level names for admins
new const gLevels[][] = {
    
"Owner",
    
"Manager",
    
"Super Admin",
    
"Admin",
    
"Vip"
};

// Authorization types for the menu
enum _:Auth {
    
Auth_Name,
    
Auth_SteamID,
    
Auth_IP
};

// Names for authorization types in the menu
new const gAuthNames[Auth][] = {
    
"Name + Pass",
    
"SteamID",
    
"IP Address"
};

// Flags for authorization types
new const gAuthFlags[Auth] = {
    
0,
    
FLAG_AUTHID,
    
FLAG_IP
};

// Command types for input through typing
enum _:Command {
    
Command_Add_Access,
    
Command_Add_Password,
    
Command_Edit_Name,
    
Command_Edit_Auth,
    
Command_Edit_Access,
    
Command_Edit_Password
};

// The commands used for the command type
new const gCommands[Command][] = {
    
"amx_addadmin_access",
    
"amx_addadmin_password",
    
"amx_editadmin_name",
    
"amx_editadmin_auth",
    
"amx_editadmin_access",
    
"amx_editadmin_password"
};

// Player index who is currently managing admins
new gAdminManager;

// Menu variables for manager in the menu
new gMenuLevel// Used for adding new admins
new gMenuPlayers[32]; // Used for showing players in the menu
new gMenuPlayerIDs[32]; // Used for checking that selected player matches from the menu
new gMenuPlayerCount// Used for size of user ids
new gMenuPlayer// Used for selected player
new gMenuAcceptCommand// Used for knowing what command inputs are allowed
new gMenuAccess// Used for adding/editing admins
new gMenuFlags// Used for adding/editing admins
new gMenuPassword[32]; // Used for adding/editing admins
new gMenuAuth// Used for viewing admins
new gMenuData[AdminData]; // Used for editing admins

// Cvars for mode, password field, and default access for non-admins
new gCvarMode;
new 
gCvarPasswordField;
new 
gCvarDefaultAccess;

// File where admins are located
new gAdminsFile[64];

// Command for kicking players
new gKickCommand[32];

public 
plugin_init() {
    
register_plugin("Admin Manager""0.0.1""Exolent");
    
    
// Register multilingual files
    
register_dictionary("admin.txt");
    
register_dictionary("common.txt");
    
    
// Chat command for /manage to open the menu
    
register_clcmd("say /manage""CmdManage"ADMIN_MANAGE);
    
register_clcmd("say_team /manage""CmdManage"ADMIN_MANAGE);
    
    
// Loop through all type-input commands
    
for(new 0Commandi++) {
        
// Register command to generic messagemode handler
        
register_clcmd(gCommands[i], "CmdMessageMode");
    }
    
    
// register kick command
    
new copy(gKickCommandcharsmax(gKickCommand), "amxauthcustom");
    while(
charsmax(gKickCommand)) {
        switch(
random(4)) {
            case 
0gKickCommand[l++] = random_num('0''9');
            case 
1gKickCommand[l++] = random_num('a''z');
            case 
2gKickCommand[l++] = random_num('A''Z');
            case 
3gKickCommand[l++] = '_';
        }
    }
    
register_clcmd(gKickCommand"CmdKick");
    
    
// Register cvars
    
gCvarMode register_cvar("amx_mode""1");
    
gCvarPasswordField register_cvar("amx_password_field""_pw");
    
gCvarDefaultAccess register_cvar("amx_default_access""");
    
    
// ===========================================================
    // Random cvars from admin.amxx
    // ===========================================================
    
register_cvar("amx_vote_ratio""0.02");
    
register_cvar("amx_vote_time""10");
    
register_cvar("amx_vote_answers""1");
    
register_cvar("amx_vote_delay""60");
    new 
cvarVoting register_cvar("amx_last_voting""0");
    
register_cvar("amx_show_activity""2");
    
register_cvar("amx_votekick_ratio""0.40");
    
register_cvar("amx_voteban_ratio""0.40");
    
register_cvar("amx_votemap_ratio""0.40");
    
set_pcvar_float(cvarVoting0.0);
    
register_cvar("amx_sql_table""admins");
    
register_cvar("amx_sql_host""127.0.0.1");
    
register_cvar("amx_sql_user""root");
    
register_cvar("amx_sql_pass""");
    
register_cvar("amx_sql_db""amx");
    
register_cvar("amx_sql_type""mysql");
    
// ===========================================================
    
    // Create the admin array
    
gAdminData ArrayCreate(AdminData);
    
    
// Locate the admins file
    
new configs[32];
    
get_configsdir(configscharsmax(configs));
    
formatex(gAdminsFilecharsmax(gAdminsFile), "%s/users_custom.ini"configs);
    
    
// Load admins from file
    
LoadAdmins();
    
    
// Remove user flag from server
    
remove_user_flags(0ADMIN_USER);
    
    
// Execute normal configs from admin.sma
    
server_cmd("exec %s/amxx.cfg"configs);
    
server_cmd("exec %s/sql.cfg"configs);
}

public 
plugin_end() {
    
// Clear the admin array from memory
    
ArrayDestroy(gAdminData);
}

public 
client_connect(id) {
    
// Clear the case-sensitive flag
    
ClearCaseSensitive(id);
}

public 
client_authorized(id) {
    
// Check if admin is turned on
    
if(get_pcvar_num(gCvarMode)) {
        
// Check admin for this user
        
CheckAdmin(id);
    }
}

public 
client_putinserver(id) {
    
// For listen servers, check host access
    
if(id == && get_pcvar_num(gCvarMode) && !is_dedicated_server()) {
        
// Check admin for host
        
CheckAdmin(id);
    }
}

public 
client_infochanged(id) {
    
// Check if player is connected and admin is turned on
    
if(is_user_connected(id) && get_pcvar_num(gCvarMode)) {
        
// Grab new and old name
        
new oldName[32], newName[32];
        
get_user_name(idoldNamecharsmax(oldName));
        
get_user_info(id"name"newNamecharsmax(newName));
        
        
// Check if names changed based on case sensitive flag
        
if(strcmp(oldNamenewName, !IsCaseSensitive(id)) == 0) {
            
// Name changed, check admin
            
CheckAdmin(idnewName);
        }
    }
}

public 
client_disconnect(id) {
    
// Check if this was the admin manager
    
if(id == gAdminManager) {
        
// Reset so another admin can manage admins if they want
        
gAdminManager 0;
    }
    
    
// Check if this was a selected player in the menu
    
if(id == gMenuPlayer) {
        
// Reset so admin will have to choose player again
        
gMenuPlayer 0;
    }
}

public 
CmdManage(idlevel) {
    
// Make sure player has required level
    
if(!access(idlevel)) {
        
// Show no access message
        
client_print(idprint_chat"* You have no access to that command.");
    }
    
// Check if an admin is already in the menu and is not this admin
    
else if(gAdminManager && gAdminManager != id) {
        
// Show the already in use message
        
client_print(idprint_chat"* Admin menu already in use.");
    }
    
// Player has admin access and menu is currently not in use
    
else {
        
// Assign this player as the manager
        
gAdminManager id;
        
        
// Show the main management menu
        
ShowMainMenu(id);
    }
    
    
// Hide from chat
    
return PLUGIN_HANDLED;
}

ShowMainMenu(id) {
    
// Create the menu handle
    
new menu menu_create("Admins Manager^nMain Menu""MenuMain");
    
    
// Add the default menu items
    
menu_additem(menu"Add Admin""");
    
menu_additem(menu"Remove Admin""");
    
menu_additem(menu"Edit Admin""");
    
menu_additem(menu"Admin Last Visit^n""");
    
menu_additem(menu"Reload Admins""");
    
    
// Show the menu
    
menu_display(idmenu);
}

public 
MenuMain(idmenuitem) {
    
// Destroy the menu after it was pressed
    
menu_destroy(menu);
    
    
// Figure out what was pressed
    
switch(item) {
        
// Add Admin
        
case 0: {
            
// Show the add main menu
            
ShowAddMainMenu(id);
        }
        
// Remove Admin
        
case 1: {
            
// Show the remove main menu
            
ShowRemoveMainMenu(id);
        }
        
// Edit Admin
        
case 2: {
            
// Show the edit main menu
            
ShowEditMainMenu(id);
        }
        
// Admin Last Visit
        
case 3: {
            
// Show the last visit main menu
            
ShowLastMainMenu(id);
        }
        
// Reload Admins
        
case 4: {
            
// Load the admins again
            
LoadAdmins();
            
            
// Check all access for players
            
CheckAllAccess();
            
            
// Check if player still has admin
            
if(access(idADMIN_MANAGE)) {
                
// Show the main menu again
                
ShowMainMenu(id);
            } else {
                
// Remove them from being manager
                
gAdminManager 0;
            }
            
            
// Notify admin of action
            
client_print(idprint_chat"* Reloaded admins.");
        }
        
// Exit
        
case MENU_EXIT: {
            
// Remove them from being the manager
            
gAdminManager 0;
        }
    }
}

ShowAddMainMenu(id) {
    
// Create the menu handle
    
new menu menu_create("Admins Manager^nAdd Admin Menu^n^nSelect level for this admin:""MenuAddMain");
    
    
// Loop through all levels
    
for(new 0sizeof(gLevels); i++) {
        
// Add level to the menu
        
menu_additem(menugLevels[i], "");
    }
    
    
// Show the menu
    
menu_display(idmenu);
}

public 
MenuAddMain(idmenuitem) {
    
// Destroy the menu after it was pressed
    
menu_destroy(menu);
    
    
// Check if the menu was closed
    
if(item == MENU_EXIT) {
        
// Show the main menu
        
ShowMainMenu(id);
    }
    
// A level was chosen
    
else {
        
// Store the level that was chosen
        
gMenuLevel item;
        
        
// Store the access that comes with this level
        
gMenuAccess GetDefaultFlags();
        
        
// Show the add players menu
        
ShowAddPlayersMenu(id);
    }
}

ShowAddPlayersMenu(id) {
    
// Format the title based on the level that was selected
    
new title[128];
    
formatex(titlecharsmax(title), "Admins Manager^nAdd Admin Menu^n^nSelect to be %s:"gLevels[gMenuLevel]);
    
    
// Create the menu handle
    
new menu menu_create(title"MenuAddPlayers");
    
    
// Grab all players that aren't bots or HLTV
    
new players[32], pnum;
    
get_players(playerspnum"ch");
    
    
// Reset menu user count
    
gMenuPlayerCount 0;
    
    
// Variables used in player loop
    
new playername[32];
    
    
// Loop through all players
    
for(new 0pnumi++) {
        
// Cache the player index
        
player players[i];
        
        
// Ignore the current manager, or if player is already admin
        
if(player == id || is_user_admin(player)) {
            
// Go to next player
            
continue;
        }
        
        
// Store this player in the selection
        
gMenuPlayers[gMenuPlayerCount] = player;
        
        
// Store the user id for this player
        
gMenuPlayerIDs[gMenuPlayerCount++] = get_user_userid(player);
        
        
// Grab this player's name
        
get_user_name(playernamecharsmax(name));
        
        
// Add player to the menu
        
menu_additem(menuname"");
    }
    
    
// Check if any players were added to the menu
    
if(gMenuPlayerCount) {
        
// Show the menu
        
menu_display(idmenu);
    }
    
// No players were added
    
else {
        
// Destroy the menu since it's not shown
        
menu_destroy(menu);
        
        
// Notify the player
        
client_print(idprint_chat"* There are no non-admins to choose from for adding admins.");
        
        
// Show the main menu
        
ShowMainMenu(id);
    }
}

public 
MenuAddPlayers(idmenuitem) {
    
// Destroy the menu after it was pressed
    
menu_destroy(menu);
    
    
// Check if the menu was closed
    
if(item == MENU_EXIT) {
        
// Show the add main menu
        
ShowAddMainMenu(id);
    }
    
// A player was chosen
    
else {
        
// Grab which player was chosen
        
gMenuPlayer gMenuPlayers[item];
        
        
// Check if this player is connected and matches the user id
        
if(is_user_connected(gMenuPlayer) && get_user_userid(gMenuPlayer) == gMenuPlayerIDs[item]) {
            
// Show the add authorization type menu
            
ShowAddAuthMenu(id);
        }
        
// Invalid player selected
        
else {
            
// Notify the player
            
client_print(idprint_chat"* This player left while you were choosing a player.");
            
            
// Show the players menu again
            
ShowAddPlayersMenu(id);
        }
    }
}

ShowAddAuthMenu(id) {
    
// Check if the player no longer exists
    
if(!gMenuPlayer) {
        
// Notify the player
        
client_print(idprint_chat"* This player left while you were choosing options to add them.");
        
        
// Show the player choose menu again
        
ShowAddPlayersMenu(id);
    }
    
// Player still exists in the server
    
else {
        
// Grab the player's name
        
new name[32];
        
get_user_name(gMenuPlayernamecharsmax(name));
        
        
// Format the title based on the level and player that were selected
        
new title[128];
        
formatex(titlecharsmax(title), "Admins Manager^nAdd Admin Menu^n^nSelect auth type for %s to be %s:"namegLevels[gMenuLevel]);
        
        
// Create the menu handle
        
new menu menu_create(title"MenuAddAuth");
        
        
// Loop through all authorization types
        
for(new 0Authi++) {
            
// Add authorization type to the menu
            
menu_additem(menugAuthNames[i], "");
        }
        
        
// Show the menu
        
menu_display(idmenu);
    }
}

public 
MenuAddAuth(idmenuitem) {
    
// Destroy the menu after it was pressed
    
menu_destroy(menu);
    
    
// Check if the menu was closed
    
if(item == MENU_EXIT) {
        
// Show the add players menu
        
ShowAddPlayersMenu(id);
    }
    
// Check if the player left
    
else if(!gMenuPlayer) {
        
// Notify the player
        
client_print(idprint_chat"* This player left while you were choosing options to add them.");
        
        
// Show the player choose menu again
        
ShowAddPlayersMenu(id);
    }
    
// An auth was chosen
    
else {
        
// Grab the flags for this auth
        
gMenuFlags gAuthFlags[item];
        
        
// Show the info menu
        
ShowAddInfoMenu(id);
    }
}

ShowAddInfoMenu(id) {
    
// Check if the player no longer exists
    
if(!gMenuPlayer) {
        
// Notify the player
        
client_print(idprint_chat"* This player left while you were choosing options to add them.");
        
        
// Show the player choose menu again
        
ShowAddPlayersMenu(id);
    }
    
// Player still exists in the server
    
else {
        
// Grab the player's name
        
new name[32];
        
get_user_name(gMenuPlayernamecharsmax(name));
        
        
// Format the title based on the level and player that were selected
        
new title[128];
        
formatex(titlecharsmax(title), "Admins Manager^nAdd Admin Menu^n^nInfo for %s to be %s:"namegLevels[gMenuLevel]);
        
        
// Create the menu handle
        
new menu menu_create(title"MenuAddAccess");
        
        
// Grab the current flags as a string
        
get_flags(gMenuFlagsnamecharsmax(name));
        
        
// Format the menu item based on current flags
        
formatex(titlecharsmax(title), "\uAccess:^n\w%s^n^n\yFlags:"name);
        
        
// Add item to menu
        
menu_additem(menutitle"");
        
        
// Check if this is for names
        
if((~gMenuFlags FLAG_AUTHID) && (~gMenuFlags FLAG_IP)) {
            
// Add case-sensitive option to menu
            
menu_additem(menu, (gMenuFlags FLAG_CASE_SENSITIVE) ? "Auth Case-Sensitive: Yes" "Auth Case-Sensitive: \dNo""");
        }
        
        
// Check if a password is not required
        
if(gMenuFlags FLAG_NOPASS) {
            
// Add item to menu
            
menu_additem(menu"Password Required: \dNo""");
        }
        
// Password is required
        
else {
            
// Add item to menu
            
menu_additem(menu"Password Required: Yes""");
            
            
// Format the menu item based on current password
            
formatex(titlecharsmax(title), "Password: %s"gMenuPassword);
            
            
// Add item to menu
            
menu_additem(menutitle"");
            
            
// Add kick option to menu
            
menu_additem(menu, (gMenuFlags FLAG_KICK) ? "Kick for Invalid Password: Yes" "Kick for Invalid Password: \dNo""");
        }
        
        
// Add an empty line
        
menu_addblank(menu);
        
        
// Add the "Add Admin" option
        
menu_additem(menu"\rAdd Admin^n^n""");
        
        
// Add an exit option
        
menu_additem(menu"Exit""");
        
        
// Remove pagination from the menu
        
menu_setprop(menuMPROP_PERPAGE0);
        
        
// Show the menu
        
menu_display(idmenu0);
    }
}

public 
MenuAddInfo(idmenuitem) {
    
// Destroy the menu after it was pressed
    
menu_destroy(menu);
    
    
// Check if the menu was closed
    
if(item == MENU_EXIT) {
        
// Show the add auth menu
        
ShowAddAuthMenu(id);
    }
    
// Check if the player left
    
else if(!gMenuPlayer) {
        
// Notify the player
        
client_print(idprint_chat"* This player left while you were choosing options to add them.");
        
        
// Show the player choose menu again
        
ShowAddPlayersMenu(id);
    }
    
// An option was chosen
    
else {
        
// Check if the name options were not added
        
if(gMenuFlags FLAG_AUTHID || gMenuFlags FLAG_IP) {
            
// Increase the item by 1 as if there were blank options
            
item += _:(item 0);
        }
        
        
// Check if the password options were not added
        
if(gMenuFlags FLAG_NOPASS) {
            
// Increase the item by 2 as if there were blank options
            
item += (_:(item 2) * 2);
        }
        
        
// Check what was selected
        
switch(item) {
            
// Access Flags
            
case 0: {
                
// Notify player they need to type the flags
                
client_print(idprint_chat"* Type in the new access flags for this player.");
                
                
// Start the message mode for this player
                
MessageMode(idCommand_Add_Access);
            }
            
// Case-Sensitive
            
case 1: {
                
// Toggle case-sensitive flag
                
gMenuFlags ^= FLAG_CASE_SENSITIVE;
                
                
// Show add info menu
                
ShowAddInfoMenu(id);
            }
            
// Password Required
            
case 2: {
                
// Toggle password flag
                
gMenuFlags ^= FLAG_NOPASS;
                
                
// Show add info menu
                
ShowAddInfoMenu(id);
            }
            
// Set Password
            
case 3: {
                
// Notify player they need to type the password
                
client_print(idprint_chat"* Type in the new password for this player.");
                
                
// Start the message mode for this player
                
MessageMode(idCommand_Add_Password);
            }
            
// Kick Invalid Password
            
case 4: {
                
// Toggle kick flag
                
gMenuFlags ^= FLAG_KICK;
                
                
// Show add info menu
                
ShowAddInfoMenu(id);
            }
            
// Empty line
            
case 5: {
            }
            
// Add Admin
            
case 6: {
                
// Prepare the admin data
                
new data[AdminData];
                
                
// Store the player's name into the data
                
get_user_name(gMenuPlayerdata[Admin_Name], charsmax(data[Admin_Name]));
                
                
// Check if this is for SteamID
                
if(gMenuFlags FLAG_AUTHID) {
                    
// Get player's SteamID
                    
get_user_authid(gMenuPlayerdata[Admin_Auth], charsmax(data[Admin_Auth]));
                }
                
// Check if this is for IP
                
else if(gMenuFlags FLAG_IP) {
                    
// Get player's IP
                    
get_user_ip(gMenuPlayerdata[Admin_Auth], charsmax(data[Admin_Auth]), 1);
                }
                
// Must be for name
                
else {
                    
// Copy name from admin name
                    
copy(data[Admin_Auth], charsmax(data[Admin_Auth]), data[Admin_Name]);
                }
                
                
// Store password
                
copy(data[Admin_Password], charsmax(data[Admin_Password]), gMenuPassword);
                
                
// Store access, flags, level, and last visit
                
data[Admin_Access] = gMenuAccess;
                
data[Admin_Flags] = gMenuFlags;
                
data[Admin_Level] = gMenuLevel;
                
data[Admin_LastVisit] = get_systime();
                
                
// Add admin data
                
ArrayPushArray(gAdminDatadata);
                
                
// Increase admin size
                
gNumAdmins++;
                
                
// Save admins
                
SaveAdmins();
                
                
// Check access for all users
                
CheckAllAccess();
                
                
// Return to main menu
                
ShowMainMenu(id);
                
                
// Notify admin of action
                
client_print(idprint_chat"* Added %s as an admin."data[Admin_Name]);
            }
            
// Exit
            
case 7: {
                
// Show the add auth menu
                
ShowAddAuthMenu(id);
            }
        }
    }
}

ShowRemoveMainMenu(id) {
    
// Create the menu handle
    
new menu menu_create("Admins Manager^nRemove Menu""MenuRemoveMain");
    
    
// Prepare variables for loop
    
new data[AdminData];
    new 
item[64];
    
    
// Loop through all admins
    
for(new 0gNumAdminsi++) {
        
// Format admin as the item
        
formatex(itemcharsmax(item), "%s (%s)"data[Admin_Name], gLevels[data[Admin_Level]]);
        
        
// Add admin to the menu
        
menu_additem(menuitem"");
    }
    
    
// Show the menu
    
menu_display(idmenu);
}

public 
MenuRemoveMain(idmenuitem) {
    
// Destroy the menu after it was pressed
    
menu_destroy(menu);
    
    
// Check if the menu was closed
    
if(item == MENU_EXIT) {
        
// Show the main menu
        
ShowMainMenu(id);
    }
    
// An admin was chosen
    
else {
        
// Grab which admin was chosen
        
gMenuAuth item;
        
        
// Show remove chosen menu
        
ShowRemoveChosenMenu(id);
    }
}

ShowRemoveChosenMenu(id) {
    
// Create the menu handle
    
new menu menu_create("Admins Manager^nRemove Menu^nView Details""MenuRemoveChosen");
    
    
// Grab the selected admin
    
new data[AdminData];
    
ArrayGetArray(gAdminDatagMenuAuthdata);
    
    
// Prepare item variable
    
new item[128];
    
    
// Show the selected admin's name
    
formatex(itemcharsmax(item), "Name: %s"data[Admin_Name]);
    
menu_additem(menuitem"");
    
    
// Show the selected admin's level
    
formatex(itemcharsmax(item), "Level: %s"gLevels[data[Admin_Level]]);
    
menu_additem(menuitem"");
    
    
// Show the selected admin's last visit
    
new copy(itemcharsmax(item), "Last visit: ");
    
format_time(item[l], charsmax(item) - l"%x %X^n^nAre you sure you want to delete?"data[Admin_LastVisit]);
    
menu_additem(menuitem"");
    
    
// Add Yes answer
    
menu_additem(menu"Yes""");
    
    
// Set exit option to be "No"
    
menu_setprop(menuMPROP_EXITNAME"No");
    
    
// Show the menu
    
menu_display(idmenu);
}

public 
MenuRemoveChosen(idmenuitem) {
    
// Destroy the menu after it was pressed
    
menu_destroy(menu);
    
    
// Check if the menu was closed
    
if(item == MENU_EXIT) {
        
// Show the remove main menu
        
ShowRemoveMainMenu(id);
    }
    
// Pressed a key
    
else {
        
// Check if pressed delete
        
if(item == 3) {
            
// Grab the selected admin
            
new data[AdminData];
            
ArrayGetArray(gAdminDatagMenuAuthdata);
            
            
// Delete this admin from the list
            
ArrayDeleteItem(gAdminDatagMenuAuth);
            
            
// Save to file
            
SaveAdmins();
            
            
// Check any admins that were affected
            
CheckAllAccess();
            
            
// Check if admin still has access and didn't delete themself
            
if(access(idADMIN_MANAGE)) {
                
// Show the remove selection again
                
ShowRemoveMainMenu(id);
            } else {
                
// Remove them from being manager
                
gAdminManager 0;
            }
            
            
// Notify admin of action
            
client_print(idprint_chat"* Deleted %s from admin list."data[Admin_Name]);
        }
        
// Did not press delete
        
else {
            
// Show the menu again
            
ShowRemoveChosenMenu(id);
        }
    }
}

ShowEditMainMenu(id) {
    
// Create the menu handle
    
new menu menu_create("Admins Manager^nEdit Menu""MenuEditMain");
    
    
// Prepare variables for loop
    
new data[AdminData];
    new 
item[64];
    
    
// Loop through all admins
    
for(new 0gNumAdminsi++) {
        
// Format admin as the item
        
formatex(itemcharsmax(item), "%s (%s)"data[Admin_Name], gLevels[data[Admin_Level]]);
        
        
// Add admin to the menu
        
menu_additem(menuitem"");
    }
    
    
// Show the menu
    
menu_display(idmenu);
}

public 
MenuEditMain(idmenuitem) {
    
// Destroy the menu after it was pressed
    
menu_destroy(menu);
    
    
// Check if the menu was closed
    
if(item == MENU_EXIT) {
        
// Show the main menu
        
ShowMainMenu(id);
    }
    
// An admin was chosen
    
else {
        
// Grab which admin was chosen
        
gMenuAuth item;
        
        
// Grab the data for this admin
        
ArrayGetArray(gAdminDatagMenuAuthgMenuData);
        
        
// Show edit chosen menu
        
ShowEditChosenMenu(id);
    }
}

ShowEditChosenMenu(id) {
    
// Create the menu handle
    
new menu menu_create("Admins Manager^nEdit Menu^nView Details""MenuEditChosen");
    
    
// Prepare item variable
    
new item[128];
    
    
// Show the selected admin's name
    
formatex(itemcharsmax(item), "Name: %s"gMenuData[Admin_Name]);
    
menu_additem(menuitem"");
    
    
// Show the selected admin's auth
    
formatex(itemcharsmax(item), "Auth: %s"gMenuData[Admin_Auth]);
    
menu_additem(menuitem"");
    
    
// Show the selected admin's level
    
formatex(itemcharsmax(item), "Level: %s"gLevels[gMenuData[Admin_Level]]);
    
menu_additem(menuitem"");
    
    
// Show the selected admin's access
    
new copy(itemcharsmax(item), "Access: ");
    
get_flags(gMenuData[Admin_Access], item[l], charsmax(item) - l);
    
menu_additem(menuitem"");
    
    
// Show the selected admin's flags
    
copy(itemcharsmax(item), "Flags: ");
    
get_flags(gMenuData[Admin_Flags], item[l], charsmax(item) - l);
    
menu_additem(menuitem"");
    
    
// Show the selected admin's password
    
formatex(itemcharsmax(item), "%sPassword: %s^n", (gMenuData[Admin_Flags] & FLAG_NOPASS) ? "\d" ""gMenuData[Admin_Password]);
    
menu_additem(menuitem"");
    
    
// Save changes option
    
menu_additem(menu"\ySave Changes""");
    
    
// Set the exit option to be cancel
    
menu_setprop(menuMPROP_EXITNAME"Cancel");
    
    
// Show the menu
    
menu_display(idmenu);
}

public 
MenuEditChosen(idmenuitem) {
    
// Destroy the menu after it was pressed
    
menu_destroy(menu);
    
    
// Check if the menu was closed
    
if(item == MENU_EXIT) {
        
// Show the edit main menu
        
ShowEditMainMenu(id);
    }
    
// Pressed a key
    
else {
        
// Check which key was pressed
        
switch(item) {
            
// Name
            
case 0: {
                
// Notify player they need to type the name
                
client_print(idprint_chat"* Type in the new name for this admin.");
                
                
// Start the message mode for this player
                
MessageMode(idCommand_Edit_Name);
            }
            
// Auth
            
case 1: {
                
// Notify player they need to type the auth
                
client_print(idprint_chat"* Type in the new auth for this admin.");
                
                
// Start the message mode for this player
                
MessageMode(idCommand_Edit_Auth);
            }
            
// Level
            
case 2: {
                
// Show the edit level menu
                
ShowEditLevelMenu(id);
            }
            
// Access
            
case 3: {
                
// Notify player they need to type the access
                
client_print(idprint_chat"* Type in the new access for this admin.");
                
                
// Start the message mode for this player
                
MessageMode(idCommand_Edit_Access);
            }
            
// Flags
            
case 4: {
                
// Show the edit flags menu
                
ShowEditFlagsMenu(id);
            }
            
// Password
            
case 5: {
                
// Notify player they need to type the password
                
client_print(idprint_chat"* Type in the new password for this admin.");
                
                
// Start the message mode for this player
                
MessageMode(idCommand_Edit_Password);
            }
            
// Save Changes
            
case 6: {
                
// Update the admin data in the array
                
ArraySetArray(gAdminDatagMenuAuthgMenuData);
                
                
// Save admins to file
                
SaveAdmins();
                
                
// Check access for all players
                
CheckAllAccess();
                
                
// Check if player still has access
                
if(access(idADMIN_MANAGE)) {
                    
// Show the edit menu again
                    
ShowEditChosenMenu(id);
                } else {
                    
// Remove them from being the manager
                    
gAdminManager 0;
                }
                
                
// Notify admin of action
                
client_print(idprint_chat"* Changes to %s in admin list."gMenuData[Admin_Name]);
            }
        }
    }
}

ShowEditLevelMenu(id) {
    
// Create the menu handle
    
new menu menu_create("Admins Manager^nEdit Menu^nSelect New Level""MenuEditLevel");
    
    
// Prepare variables for loop
    
new item[128];
    
    
// Loop through all levels
    
for(new 0sizeof(gLevels); i++) {
        
// Check if this is the current level
        
if(== gMenuData[Admin_Level]) {
            
// Add (current) after the level name
            
formatex(itemcharsmax(item), "%s (Current)"gLevels[i]);
            
            
// Add item to the menu
            
menu_additem(menuitem"");
        }
        
// This is not the current level
        
else {
            
// Add level name to the menu
            
menu_additem(menugLevels[i], "");
        }
    }
    
    
// Show the menu
    
menu_display(idmenu);
}

public 
MenuEditLevel(idmenuitem) {
    
// Destroy the menu after it was pressed
    
menu_destroy(menu);
    
    
// Check if the menu was closed
    
if(item == MENU_EXIT) {
        
// Show the edit chosen menu
        
ShowEditChosenMenu(id);
    }
    
// A level was chosen
    
else {
        
// Update the level that was chosen
        
gMenuData[Admin_Level] = item;
        
        
// Show the edit chosen menu
        
ShowEditChosenMenu(id);
    }
}

ShowEditFlagsMenu(id) {
    
// Create the menu handle
    
new menu menu_create("Admins Manager^nEdit Menu^nView Flags""MenuEditFlags");
    
    
// Prepare variables
    
new item[128], bool:isName;
    
    
// Check if this is a SteamID
    
if(gMenuData[Admin_Flags] & FLAG_AUTHID) {
        
// Say that the type is a SteamID
        
copy(itemcharsmax(item), "\yType: \wSteamID");
    }
    
// Check if this ia an IP
    
else if(gMenuData[Admin_Flags] & FLAG_IP) {
        
// Say that the type is an IP
        
copy(itemcharsmax(item), "\yType: \wIP");
    }
    
// Check if this is a tag
    
else if(gMenuData[Admin_Flags] & FLAG_TAG) {
        
// Say that the type is a tag
        
copy(itemcharsmax(item), "\yType: \wTag");
        
        
// Cache type as a name
        
isName true;
    }
    
// Must be a name
    
else {
        
// Say that the type is a name
        
copy(itemcharsmax(item), "\yType: \wName");
        
        
// Cache type as a name
        
isName true;
    }
    
    
// Add type item
    
menu_additem(menuitem"");
    
    
// Check if password is required
    
if(~gMenuData[Admin_Flags] & FLAG_NOPASS) {
        
// Add password requirement
        
menu_additem(menu"\yPassword Required: \wYes""");
        
        
// Add kick for invalid password
        
menu_additem(menu, (gMenuData[Admin_Flags] & FLAG_KICK) ? "\yKick on Invalid Password: \wYes" "\yKick on Invalid Password: \dNo""");
    }
    
// No password is required
    
else {
        
// Add password requirement
        
menu_additem(menu"\yPassword Required: \dNo""");
    }
    
    
// Check if this is a name auth
    
if(isName) {
        
// Add case sensitivity
        
menu_additem(menu, (gMenuData[Admin_Flags] & FLAG_CASE_SENSITIVE) ? "\yCase-Sensitive Auth: \wYes" "\yCase-Sensitive Auth: \dNo""");
    }
    
    
// Show the menu
    
menu_display(idmenu);
}

public 
MenuEditFlags(idmenuitem) {
    
// Destroy the menu after it was pressed
    
menu_destroy(menu);
    
    
// Check if the menu was closed
    
if(item == MENU_EXIT) {
        
// Show the edit chosen menu
        
ShowEditChosenMenu(id);
    }
    
// A key was pressed
    
else {
        
// Check if a password is not required
        
if(gMenuData[Admin_Flags] & FLAG_NOPASS) {
            
// Update item index if got that far
            
item += _:(item 1);
        }
        
        
// Check which was changed
        
switch(item) {
            
// Type
            
case 0: {
                
// Check if this is a SteamID
                
if(gMenuData[Admin_Flags] & FLAG_AUTHID) {
                    
// Remove SteamID flag
                    
gMenuData[Admin_Flags] &= ~FLAG_AUTHID;
                    
                    
// Add IP flag
                    
gMenuData[Admin_Flags] |= FLAG_IP;
                }
                
// Check if this is a IP
                
else if(gMenuData[Admin_Flags] & FLAG_IP) {
                    
// Remove IP flag
                    
gMenuData[Admin_Flags] &= ~FLAG_IP;
                    
                    
// Add Tag flag
                    
gMenuData[Admin_Flags] |= FLAG_TAG;
                }
                
// Check if this is a Tag
                
else if(gMenuData[Admin_Flags] & FLAG_TAG) {
                    
// Remove Tag flag
                    
gMenuData[Admin_Flags] &= ~FLAG_TAG;
                }
                
// Must be a name
                
else {
                    
// Add SteamID flag
                    
gMenuData[Admin_Flags] |= FLAG_AUTHID;
                }
            }
            
// Password Required
            
case 1: {
                
// Toggle password requirement
                
gMenuData[Admin_Flags] ^= FLAG_NOPASS;
            }
            
// Kick on Invalid Password
            
case 2: {
                
// Toggle kick
                
gMenuData[Admin_Flags] ^= FLAG_KICK;
            }
            
// Case-Sensitive Auth
            
case 3: {
                
// Toggle case-sensitive
                
gMenuData[Admin_Flags] ^= FLAG_CASE_SENSITIVE;
            }
        }
        
        
// Show the edit flags menu
        
ShowEditFlagsMenu(id);
    }
}

ShowLastMainMenu(id) {
    
// Create the menu handle
    
new menu menu_create("Admins Manager^nLast Visit Main Menu""MenuLastMain");
    
    
// Prepare variables for loop
    
new data[AdminData];
    new 
item[64];
    
    
// Loop through all admins
    
for(new 0gNumAdminsi++) {
        
// Format admin as the item
        
formatex(itemcharsmax(item), "%s (%s)"data[Admin_Name], gLevels[data[Admin_Level]]);
        
        
// Add admin to the menu
        
menu_additem(menuitem"");
    }
    
    
// Show the menu
    
menu_display(idmenu);
}

public 
MenuLastMain(idmenuitem) {
    
// Destroy the menu after it was pressed
    
menu_destroy(menu);
    
    
// Check if the menu was closed
    
if(item == MENU_EXIT) {
        
// Show the main menu
        
ShowMainMenu(id);
    }
    
// An admin was chosen
    
else {
        
// Grab which admin was chosen
        
gMenuAuth item;
        
        
// Show last chosen menu
        
ShowLastChosenMenu(id);
    }
}

ShowLastChosenMenu(id) {
    
// Create the menu handle
    
new menu menu_create("Admins Manager^nLast Visit Main Menu^nView Details""MenuLastChosen");
    
    
// Grab the selected admin
    
new data[AdminData];
    
ArrayGetArray(gAdminDatagMenuAuthdata);
    
    
// Prepare item variable
    
new item[64];
    
    
// Show the selected admin's name
    
formatex(itemcharsmax(item), "Name: %s"data[Admin_Name]);
    
menu_additem(menuitem"");
    
    
// Show the selected admin's level
    
formatex(itemcharsmax(item), "Level: %s"gLevels[data[Admin_Level]]);
    
menu_additem(menuitem"");
    
    
// Show the selected admin's last visit
    
new copy(itemcharsmax(item), "Last visit: ");
    
format_time(item[l], charsmax(item) - l"%x %X"data[Admin_LastVisit]);
    
menu_additem(menuitem"");
    
    
// Show the menu
    
menu_display(idmenu);
}

public 
MenuLastChosen(idmenuitem) {
    
// Destroy the menu after it was pressed
    
menu_destroy(menu);
    
    
// Check if the menu was closed
    
if(item == MENU_EXIT) {
        
// Show the last main menu
        
ShowLastMainMenu(id);
    }
    
// Pressed a key
    
else {
        
// Show the menu again
        
ShowLastChosenMenu(id);
    }
}

MessageMode(idcommand) {
    
// Show that we want to accept the command's arguments
    
gMenuAcceptCommand command;
    
    
// Start the messagemode to hook what player types
    
client_cmd(id"messagemode %s"gCommands[command]);
}

public 
CmdMessageMode(id) {
    
// Check if this is the manager
    
if(id == gAdminManager) {
        
// Grab which command was used
        
new commandName[32];
        
read_argv(0commandNamecharsmax(commandName));
        
        
// Find the command index
        
for(new 0Commandi++) {
            
// Check if the command matches
            
if(equali(gCommands[i], commandName)) {
                
// Check if this command is allowed
                
if(gMenuAcceptCommand == i) {
                    
// Read the arguments
                    
new args[256];
                    
read_args(argscharsmax(args));
                    
remove_quotes(args);
                    
                    
// Handle the arguments based on what command was used
                    
switch(i) {
                        
// Add Access menu
                        
case Command_Add_Access: {
                            
// Convert what was said to all lowercase
                            
strtolower(args);
                            
                            
// Convert what was said into bits
                            
gMenuAccess read_flags(args);
                            
                            
// Check if no flags were given
                            
if(!gMenuAccess) {
                                
// Grab default flags
                                
gMenuAccess GetDefaultFlags();
                            }
                            
                            
// Show the info menu
                            
ShowAddInfoMenu(id);
                        }
                        
// Add Password menu
                        
case Command_Add_Password: {
                            
// Check if a password was given
                            
if(args[0]) {
                                
// Store new password
                                
copy(gMenuPasswordcharsmax(gMenuPassword), args);
                            }
                            
                            
// Show the info menu
                            
ShowAddInfoMenu(id);
                        }
                        
// Edit Name menu
                        
case Command_Edit_Name: {
                            
// Check if a name was given
                            
if(args[0]) {
                                
// Store new name
                                
copy(gMenuData[Admin_Name], charsmax(gMenuData[Admin_Name]), args);
                            }
                            
                            
// Show the edit menu
                            
ShowEditChosenMenu(id);
                        }
                        
// Edit Auth menu
                        
case Command_Edit_Auth: {
                            
// Check if a auth was given
                            
if(args[0]) {
                                
// Store new auth
                                
copy(gMenuData[Admin_Auth], charsmax(gMenuData[Admin_Auth]), args);
                            }
                            
                            
// Show the edit menu
                            
ShowEditChosenMenu(id);
                        }
                        
// Edit Access menu
                        
case Command_Edit_Access: {
                            
// Convert what was said to all lowercase
                            
strtolower(args);
                            
                            
// Convert what was said into bits
                            
gMenuAccess read_flags(args);
                            
                            
// Check if no flags were given
                            
if(!gMenuAccess) {
                                
// Grab default flags
                                
gMenuAccess GetDefaultFlags();
                            }
                            
                            
// Show the edit menu
                            
ShowEditChosenMenu(id);
                        }
                        
// Edit Password menu
                        
case Command_Edit_Password: {
                            
// Check if a password was given
                            
if(args[0]) {
                                
// Store new password
                                
copy(gMenuData[Admin_Password], charsmax(gMenuData[Admin_Password]), args);
                            }
                            
                            
// Show the edit menu
                            
ShowEditChosenMenu(id);
                        }
                    }
                }
                
                
// Don't look for the command anymore
                
break;
            }
        }
    }
    
    
// Block command from showing
    
return PLUGIN_HANDLED;
}

public 
CmdKick(id) {
    
// Kick player from server
    
server_cmd("kick #%d ^"%L^""get_user_userid(id), id"NO_ENTRY");
    
    
// Hide command from console
    
return PLUGIN_HANDLED;
}

LoadAdmins() {
    
// Try opening the file for reading
    
new fopen(gAdminsFile"rt");
    
    
// Check if the file opened
    
if(f) {
        
// Prepare variables for reading
        
new line[512];
        new 
data[AdminData];
        new 
accessString[27];
        new 
flagString[27];
        new 
levelString[32];
        new 
timestampString[12];
        new 
i;
        
        
// Loop through all lines of the file
        
while(!feof(f)) {
            
// Read current line
            
fgets(flinecharsmax(line));
            
            
// Trim any whitespace off the start and end
            
trim(line);
            
            
// Check if this is an empty line or a comment
            
if(!line[0] || line[0] == ';' || line[0] == '/' && line[1] == '/') {
                
// Go to next line
                
continue;
            }
            
            
// Parse line for all data
            
parse(line,
                
data[Admin_Name], charsmax(data[Admin_Name]),
                
data[Admin_Auth], charsmax(data[Admin_Auth]),
                
data[Admin_Password], charsmax(data[Admin_Password]),
                
accessStringcharsmax(accessString),
                
flagStringcharsmax(flagString),
                
levelStringcharsmax(levelString),
                
timestampStringcharsmax(timestampString)
                );
            
            
// Convert access and flag strings to bits
            
data[Admin_Access] = read_flags(accessString);
            
data[Admin_Flags] = read_flags(flagString);
            
            
// Set that we didn't get the level yet
            
data[Admin_Level] = -1;
            
            
// Find the level index for this level name
            
for(0sizeof(gLevels); i++) {
                
// Check if the levels match
                
if(equali(gLevels[i], levelString)) {
                    
// Store that it was found
                    
data[Admin_Level] = i;
                    break;
                }
            }
            
            
// Check if level was not found
            
if(data[Admin_Level] == -1) {
                
// Don't load this admin
                
continue;
            }
            
            
// Convert timestamp to an integer
            
data[Admin_LastVisit] = str_to_num(timestampString);
            
            
// Add admin to list
            
ArrayPushArray(gAdminDatadata);
            
            
// Increase number of admins
            
gNumAdmins++;
        }
        
        
// Close the file
        
fclose(f);
    }
}

SaveAdmins() {
    
// Try opening the file for writing
    
new fopen(gAdminsFile"wt");
    
    
// Check if the file opened
    
if(f) {
        
// Prepare variables for loop
        
new data[AdminData], accessString[27], flagString[27];
        
        
// Loop through all admins
        
for(new 0gNumAdminsi++) {
            
// Grab current admin data
            
ArrayGetArray(gAdminDataidata);
            
            
// Convert access bits to string
            
get_flags(data[Admin_Access], accessStringcharsmax(accessString));
            
            
// Convert flags bits to string
            
get_flags(data[Admin_Flags],flagStringcharsmax(flagString));
            
            
// Save data to file
            
fprintf(f"^"%s^" ^"%s^" ^"%s^" ^"%s^" ^"%s^" ^"%s^" ^"%d^"^n",
                
data[Admin_Name], data[Admin_Auth], data[Admin_Password], accessStringflagStringgLevels[data[Admin_Level]], data[Admin_LastVisit]
                );
        }
        
        
// Close the file
        
fclose(f);
    }
}

CheckAllAccess() {
    
// Get all players that aren't bots or HLTV
    
new players[32], pnum;
    
get_players(playerspnum"ch");
    
    
// Loop through all players
    
for(new 0pnumi++) {
        
// Check admin for this player
        
CheckAdmin(players[i]);
    }
}

CheckAdmin(idname[32] = "") {
    
// Remove any existing flags
    
remove_user_flags(id);
    
    
// Check if no name was passed
    
if(!name[0]) {
        
// Grab current name
        
get_user_name(idnamecharsmax(name));
    }
    
    
// Set name to not be case sensitive
    
ClearCaseSensitive(id);
    
    
// Grab SteamID and IP as well
    
new steamID[35], ip[32];
    
get_user_authid(idsteamIDcharsmax(steamID));
    
get_user_ip(idipcharsmax(ip), 1);
    
    
// Create variables we need for admin checking
    
new admin[AdminData];
    new 
found = -1;
    
    
// Loop through custom admin list
    
for(new 0gNumAdminsi++) {
        
// Grab admin data
        
ArrayGetArray(gAdminDataiadmin);
        
        
// Check if player matches this admin
        
if(AdminMatch(idnamesteamIDipadmin)) {
            
found i;
            break;
        }
    }
    
    
// Check if player was found for any admin at all
    
if(found >= 0) {
        
// Check if this requires a password
        
if(~admin[Admin_Flags] & FLAG_NOPASS) {
            
// Grab password field and player's password
            
new field[32], password[32];
            
get_pcvar_string(gCvarPasswordFieldfieldcharsmax(field));
            
get_user_info(idfieldpasswordcharsmax(password));
            
            
// Check if passwords don't match
            
if(!equal(admin[Admin_Password], password)) {
                
// Echo message to player
                
client_cmd(id"echo ^"* %L^""id"INV_PAS");
                
                
// Check if this should kick players
                
if(admin[Admin_Flags] & FLAG_KICK) {
                    
// Log player was kicked
                    
log_amx("Login: ^"%s<%d><%s><>^" kicked due to invalid password (account ^"%s^") (address ^"%s^")"nameget_user_userid(id), steamIDadmin[Admin_Auth], ip);
                    
                    
// Kick player
                    
client_cmd(id"%s"gKickCommand);
                }
                
                
// Don't give access
                
return;
            }
            
            
// Echo message to player
            
client_cmd(id"echo ^"* %L^""id"PAS_ACC");
        }
        
        
// Give player admin access
        
set_user_flags(idadmin[Admin_Access]);
        
        
// Store that the player was here at this time as an admin
        
admin[Admin_LastVisit] = get_systime();
        
        
// Store it in the admins list
        
ArraySetArray(gAdminDatafoundadmin);
        
        
// Save admins to file
        
SaveAdmins();
        
        
// Grab access as string
        
new accessString[27];
        
get_flags(admin[Admin_Access], accessStringcharsmax(accessString));
        
        
// Log player accessed acount
        
log_amx("Login: ^"%s<%d><%s><>^" became an admin (account ^"%s^") (access ^"%s^") (address ^"%s^")"nameget_user_userid(id), steamIDadmin[Admin_Auth], accessStringip);
        
        
// Echo message to player
        
client_cmd(id"echo ^"* %L^""id"PRIV_SET");
    }
    
// Check if non-admins should be kicked
    
else if(get_pcvar_num(gCvarMode) == 2) {
        
// Kick player
        
client_cmd(id"%s"gKickCommand);
    }
    
// Give default flags
    
else {
        
// Give player default flags
        
set_user_flags(idGetDefaultFlags());
        
        
// Echo message to player
        
client_cmd(id"echo ^"* %L^""id"PRIV_SET");
    }
}

bool:AdminMatch(id, const name[], const steamID[], const ip[], const admin[AdminData]) {
    
// Create variables we need
    
new temp;
    new 
bool:found false;
    
    
// Check if this is a SteamID
    
if(admin[Admin_Flags] & FLAG_AUTHID) {
        
// Check if SteamIDs match
        
if(equal(steamIDadmin[Admin_Auth])) {
            
// We found the admin
            
found true;
        }
    }
    
// Check if this is an IP
    
else if(admin[Admin_Flags] & FLAG_IP) {
        
// Grab length of ip in list
        
temp strlen(admin[Admin_Auth]);
        
        
// Check if ends in a '.' for range checks
        
if(admin[Admin_Auth][temp 1] != '.') {
            
// Set length to 0 to match whole string
            
temp 0;
        }
        
        
// Check if ip's match
        
if(equal(ipadmin[Admin_Auth], temp)) {
            
// We found the admin
            
found true;
        }
    }
    
// Check if this is a tag
    
else if(admin[Admin_Flags] & FLAG_TAG) {
        
// Cache if this is case sensitive admin name
        
temp admin[Admin_Flags] & FLAG_CASE_SENSITIVE;
        
        
// Check if tag is in name based on case sensitivity flag from admin list
        
if(strfind(nameadmin[Admin_Auth], !temp) >= 0) {
            
// Set case sensitive flag if admin list has it
            
if(temp) {
                
SetCaseSensitive(id);
            }
            
            
// We found the admin
            
found true;
        }
    }
    
// Then this should be an admin name
    
else {
        
// Cache if this is case sensitive admin name
        
temp admin[Admin_Flags] & FLAG_CASE_SENSITIVE;
        
        
// Check if names match based on case sensitivity flag from admin list
        
if(strcmp(nameadmin[Admin_Auth], !temp) == 0) {
            
// Set case sensitive flag if admin list has it
            
if(temp) {
                
SetCaseSensitive(id);
            }
            
            
// We found the admin
            
found true;
        }
    }
    
    
// Return if we found admin
    
return found;
}

GetDefaultFlags() {
    
// Grab default flags from the cvar
    
new flagString[27];
    
get_pcvar_string(gCvarDefaultAccessflagStringcharsmax(flagString));
    
    
// Convert string to bits
    
new flags read_flags(flagString);
    
    
// Check if no flags exist
    
if(!flags) {
        
// Give the user flag
        
flags ADMIN_USER;
    }
    
    
// Give back flags
    
return flags;



wickedd 07-03-2012 09:22

Re: Problem with admin manager
 
Did you edit the code? If not, post your problem in the plugin thread.

Exolent[jNr] 07-03-2012 09:31

Re: Problem with admin manager
 
Post in the thread you got it from.


All times are GMT -4. The time now is 15:21.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.