Raised This Month: $52 Target: $400
 13% 

N++ going crazy


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 10-12-2019 , 11:09   N++ going crazy
Reply With Quote #1

No matter what I try I can't indent this code in N++, if I try AMXX Studio, it just unindents everything.
Code:
#include < amxmodx >
#include < amxmisc >
#include < cromchat >
#include < unixtime >
#include < hamsandwich >
#include < fakemeta >
#include < engine >
#include < fun >
#include < cstrike >
#include < eas_core >
#include < eas_ranks >

#pragma dynamic 32768

#define PLUGIN_AUTHOR "DoNii"
#define PLUGIN_NAME "Elite Admin System Commands"

#if defined client_disconnected
#define client_disconnect client_disconnected
#endif

enum
{
	CHAT = 0,
	CONSOLE,
	LOG
}

enum
{
	TEAM_UNASSIGNED = 0,
	TEAM_T,
	TEAM_CT,
	TEAM_SPEC
}

enum _:PlayerBan
{
	Player_Name[ MAX_NAME_LENGTH ],
	Player_SteamId[ MAX_AUTHID_LENGTH ],
	Player_IP[ MAX_IP_LENGTH ],
	Player_BanExpire[ MAX_DATE_LENGTH ],
	Player_BanReason[ MAX_REASON_LENGTH ],
	Player_BannedBy[ MAX_NAME_LENGTH ]
}

enum _:PlayerGag
{
	Player_Name[ MAX_NAME_LENGTH ],
	Player_SteamId[ MAX_AUTHID_LENGTH ],
	Player_IP[ MAX_IP_LENGTH ],
	Player_GagExpire[ MAX_DATE_LENGTH ],
	Player_GagReason[ MAX_REASON_LENGTH ],
	Player_GagFlags[ 5 ],
	Player_GaggedBy[ MAX_NAME_LENGTH ]
}

enum _:PlayerData
{
	Player_ID[ MAX_AUTHID_LENGTH ],
	Player_Password[ MAX_PASSWORD_LENGTH ],
	Player_AccessFlags[ MAX_FLAGS_LENGTH ],
	Player_Prefix[ 32 ],
	Player_Model_T[ 32 ],
	Player_Model_CT[ 32 ],
	Player_Expire_Date[ MAX_DATE_LENGTH ],
	Player_Immunity,
	bool:Player_Suspended
}

enum ( += 54321 )
{
	TASK_KICK_MENU,
	TASK_BAN_MENU,
	TASK_GAG_CHECK,
	TASK_AUTHORIZED
}

enum _:FileConfig
{
	BANS_FILE[ 64 ],
	GAGS_FILE[ 64 ],
	LOGS_FILE[ 64 ],
	USERS_FILE[ 64 ],
	SYSTEM_PREFIX[ 32 ],
	BANNED_CONNECT_LOG,
	RANKS_ENABLED,
	KICK_FLAG,
	BAN_FLAG,
	ADD_BAN_FLAG,
	UNBAN_FLAG,
	SLAY_FLAG,
	SLAP_FLAG,
	CVAR_FLAG,
	PLUGINS_FLAG,
	MAP_FLAG,
	NICK_FLAG,
	RCON_FLAG,
	SHOW_RCON_FLAG,
	MODULES_FLAG,
	FREEZE_FLAG,
	SCREENSHOT_FLAG,
	WARN_FLAG,
	NOCLIP_FLAG,
	GODMODE_FLAG,
	COMMANDS_MENU_FLAG,
	GAG_FLAG,
	UNGAG_FLAG,
	SAY_FLAG,
	TEAM_FLAG,
	IMMUNITY_FLAG,
	PSAY_FLAG,
	LAST_FLAG,
	WHO_FLAG,
	ADD_GAG_FLAG,
	CHAT_FLAG,
	DISCONNECT_INFO_SECONDS_EXPIRE,
	Float:FREQUENCY_UPDATE_ALL_FILES
}

enum _:PlayerDisconnectData
{
	Player_DisconnectName[ MAX_NAME_LENGTH ],
	Player_DisconnectSteamID[ MAX_AUTHID_LENGTH ],
	Player_DisconnectIP[ MAX_IP_LENGTH ],
	Player_DisconnectFlags[ MAX_FLAGS_LENGTH ],
	Player_DisconnectRank[ 32 ],
	Player_DataExpireDate[ MAX_DATE_LENGTH ]
}

enum _:BanMsg
{
	BAN_ID,
	BAN_MINUTES,
	BAN_REASON[ MAX_REASON_LENGTH ]
}

enum _:AddBanMsg
{
	ADDBAN_ID,
	ADDBAN_NAME[ MAX_NAME_LENGTH ],
	ADDBAN_STEAMID[ MAX_AUTHID_LENGTH ],
	ADDBAN_IP[ MAX_IP_LENGTH ],
	ADDBAN_MINUTES
}

enum _:AddGagMsg
{
	ADDGAG_ID,
	ADDGAG_NAME[ MAX_NAME_LENGTH ],
	ADDGAG_STEAMID[ MAX_AUTHID_LENGTH ],
	ADDGAG_IP[ MAX_IP_LENGTH ],
	ADDGAG_SECONDS,
	ADDGAG_FLAGS[ 5 ]
}

enum _:SlayMsg
{
	SLAY_ID,
	SLAY_REASON[ MAX_REASON_LENGTH ]
}

enum _:SlapMsg
{
	SLAP_ID,
	SLAP_VALUE,
	SLAP_REASON[ MAX_REASON_LENGTH ]
}

enum _:GagMsg
{
	GAG_ID,
	GAG_SECONDS,
	GAG_FLAGS[ 5 ],
	GAG_REASON[ MAX_REASON_LENGTH ]
}

enum
{
	METHOD_NONE = 0,
	METHOD_CHAT,
	METHOD_LOG,
	METHOD_BOTH
}

new g_iConfig[ FileConfig ];

new Array:g_aBans, Array:g_aGags, Array:g_aBanExists, Array:g_aGagExists, Array:g_aDataBase, Array:g_aMaps, Array:g_aDisconnectInfo;

new g_iKick[ MAX_PLAYERS + 1 ], g_iBan[ MAX_PLAYERS + 1 ][ BanMsg ], g_iGag[ MAX_PLAYERS + 1 ][ GagMsg ], g_iAddBan[ MAX_PLAYERS + 1 ][ AddBanMsg ], g_iAddGag[ MAX_PLAYERS + 1 ][ AddGagMsg ],
g_iSlay[ MAX_PLAYERS + 1 ][ SlayMsg ], g_iSlap[ MAX_PLAYERS + 1 ][ SlapMsg ], g_iTeamSwitch[ MAX_PLAYERS + 1 ], g_szTeamSwitch[ MAX_PLAYERS + 1 ][ 20 ], g_szConfigsDir[ 128 ], g_szMapsFile[ 32 ];

new Float:fAngles[ MAX_PLAYERS + 1 ][ 3 ];

new bool:g_bFrozen[ MAX_PLAYERS + 1 ];

new g_pRconPassword, g_iFwThink;

public plugin_precache( )
{
	get_configsdir( g_szConfigsDir, charsmax( g_szConfigsDir ) );

	g_aGags = ArrayCreate( PlayerGag );
	g_aBans = ArrayCreate( PlayerBan );
	g_aDataBase = ArrayCreate( PlayerData );
	g_aDisconnectInfo = ArrayCreate( PlayerDisconnectData );
	g_aBanExists = ArrayCreate( 1 );
	g_aGagExists = ArrayCreate( 1 );
	g_aMaps = ArrayCreate( 32 );
	
	get_cvar_string( "mapcyclefile", g_szMapsFile, charsmax( g_szMapsFile ) );
	
	ReadConfig( );
	ReadBans( );
	ReadGags( );
	ReadUsers( );
	ReadMaps( );
}

public plugin_init( )
{
	register_plugin( PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR );
	
	register_dictionary( "elite_admin_system.txt" );
	
	new szPrefix[ 32 ];
	formatex( szPrefix, charsmax( szPrefix ), "&x04%s", g_iConfig[ SYSTEM_PREFIX ] );
	CC_SetPrefix( szPrefix );
	
	set_task( g_iConfig[ FREQUENCY_UPDATE_ALL_FILES ], "UpdateAllFiles", .flags="b" );

	register_cvar( "eas_version", PLUGIN_VERSION, FCVAR_SERVER | FCVAR_SPONLY | FCVAR_UNLOGGED );
	
	register_clcmd( "say /i", "ShowImmunity" );
	
	register_clcmd( "say", "OnSay" );
	register_clcmd( "say_team", "OnSay" );
	
	g_pRconPassword = get_cvar_pointer( "rcon_password" );
	
	RegisterHam( Ham_Killed, "player", "@Ham_Killed_Pre", 0 );
	
	/////////////////// MessageMode Commands //////////////////////
	
	register_clcmd( "kickReason", "OnKickPlayer" );
	
	register_clcmd( "banPlayerMinutes", "OnBanPlayerMinutes" );
	register_clcmd( "banPlayerReason", "OnBanPlayerReason" );
	
	register_clcmd( "gagPlayerSeconds", "OnGagPlayerSeconds" );
	register_clcmd( "gagPlayerFlags", "OnGagPlayerFlags" );
	register_clcmd( "gagPlayerReason", "OnGagPlayerReason" );
	
	register_clcmd( "addbanPlayerName", "OnAddbanPlayerName" );
	register_clcmd( "addbanPlayerSteamID", "OnAddbanPlayerSteamID" );
	register_clcmd( "addbanPlayerIP", "OnAddbanPlayerIP" );
	register_clcmd( "addbanPlayerMinutes", "OnAddbanPlayerMinutes" );
	register_clcmd( "addbanPlayerReason", "OnAddbanPlayerReason" );
	
	register_clcmd( "addgagPlayerName", "OnAddGagPlayerName" );
	register_clcmd( "addgagPlayerSteamID", "OnAddGagPlayerSteamID" );
	register_clcmd( "addgagPlayerIP", "OnAddGagPlayerIP" );
	register_clcmd( "addgagPlayerSeconds", "OnAddGagPlayerSeconds" );
	register_clcmd( "addgagPlayerFlags", "OnAddGagPlayerFlags" );
	register_clcmd( "addgagPlayerReason", "OnAddGagPlayerReason" );
	
	register_clcmd( "slayPlayerReason", "OnSlayPlayerReason" );
	
	register_clcmd( "slapPlayerValue", "OnSlapPlayerValue" );
	register_clcmd( "slapPlayerReason", "OnSlapPlayerReason" );
	
	//////////////////// Console Commands ////////////////////
	
	register_concmd( "amx_kick", "@Kick" );
	register_concmd( "amx_ban", "@Ban" );
	register_concmd( "amx_addban", "@AddBan" );
	register_concmd( "amx_unban", "@Unban" );
	register_concmd( "amx_slay", "@Slay" );
	register_concmd( "amx_slap", "@Slap" );
	register_concmd( "amx_cvar", "@Cvar" );
	register_concmd( "amx_plugins", "@Plugins" );
	register_concmd( "amx_map", "@Map" );
	register_concmd( "amx_nick", "@Nick" );
	register_concmd( "amx_rcon", "@Rcon" );
	register_concmd( "amx_showrcon", "@ShowRcon" );
	register_concmd( "amx_modules", "@Modules" );
	register_concmd( "amx_freeze", "@Freeze" );
	register_concmd( "amx_ss", "@Screenshot" );
	register_concmd( "amx_help", "@Help" );
	register_concmd( "amx_noclip", "@Noclip" );
	register_concmd( "amx_godmode", "@Godmode" );
	register_concmd( "amx_warn", "@Warn" );
	register_concmd( "amx_gag", "@Gag" );
	register_concmd( "amx_ungag", "@UnGag" );
	register_concmd( "amx_say", "@AdminSay" );
	register_concmd( "amx_team", "@Team" );
	register_concmd( "amx_psay", "@Psay" );
	register_concmd( "amx_last", "@Last" );
	register_concmd( "amx_who", "@Who" );
	register_concmd( "amx_addgag", "@AddGag" );
	register_concmd( "amx_chat", "@AdminChat" );
	register_concmd( "amx_exgag", "@ExtendGag" );
	register_concmd( "amx_regag", "@ReduceGag" );

	//////////////////////////////////////////////////////////
}

public plugin_end( )
{
	ArrayDestroy( g_aBanExists );
	ArrayDestroy( g_aBans );
	ArrayDestroy( g_aDataBase );
	ArrayDestroy( g_aDisconnectInfo );
	ArrayDestroy( g_aGagExists );
	ArrayDestroy( g_aGags );
	ArrayDestroy( g_aMaps );
}

//////////////////////////////////////////////////////////// TASKS ///////////////////////////////////////////////////////////////////////////////////////////

public ShowImmunity( id )
{
	client_print( id, print_chat, "%d", GetImmunityLevel( id ) );
}

public UpdateAllFiles( )
{
	ReadUsers( );
	ReadGags( );
	CheckExistingGags( );
	CheckExpiredGags( );
	ReadBans( );
	CheckExistingBans( );
	CheckExpiredBans( );
	CheckGagExpire( );
}

public CheckGagExpire( )
{
	new iPlayers[ MAX_PLAYERS ], iNum, iTempId;
	get_players( iPlayers, iNum, "ch" );
	
	for( new i; i < iNum; i++ )
	{
		iTempId = iPlayers[ i ];
		
		if( IsGagged( iTempId ) && get_speak( iTempId ) == SPEAK_MUTED )
		{
			new szName[ MAX_NAME_LENGTH ], szSteamId[ MAX_AUTHID_LENGTH ], szIP[ MAX_IP_LENGTH ];
			get_user_name( iTempId, szName, charsmax( szName ) );
			get_user_authid( iTempId, szSteamId, charsmax( szSteamId ) );
			get_user_ip( iTempId, szIP, charsmax( szIP ), 1 );
			
			new eData[ PlayerGag ];
			for( new i; i < ArraySize( g_aGags ); i++ )
			{
				ArrayGetArray( g_aGags, i, eData );
				
				if( equali( szName, eData[ Player_Name ] ) || equali( szSteamId, eData[ Player_SteamId ] ) || equali( szIP, eData[ Player_IP ] ) && HasDatePassed( eData[ Player_GagExpire ] ) )
				{
					set_speak( iTempId, SPEAK_NORMAL );
					break;
				}
			}
		}
	}
	return PLUGIN_CONTINUE;
}

public OnMapChange( const szMap[ ] )
{
	server_cmd( "changelevel %s", szMap );
}

public ReOpenKickMenu( id )
{
	id -= TASK_KICK_MENU;

	KickMenu( id );
}

public ReOpenBanMenu( id )
{
	id -= TASK_BAN_MENU;
	
	BanMenu( id );
}

public client_putinserver_delayed( id )
{
	id -= TASK_AUTHORIZED;

	CheckBanned( id );
}

////////////////////////////////////////////////////////// END OF TASKS //////////////////////////////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////// EVENTS ///////////////////////////////////////////////////////////////////////////////////////////////////////////////

@Ham_Killed_Pre( iVictim )
{
	g_bFrozen[ iVictim ] = false;
}

public client_disconnect( id )
{
	CleanVars( id );
	CacheInfo( id );
}

public client_connect( id )
{
	CleanVars( id );
}

public client_putinserver( id )
{
	CheckGagged( id ); // using putinserver instead of authorized cuz its too early to call set_speak
	set_task( 1.0, "client_putinserver_delayed", id + TASK_AUTHORIZED );
}

public OnSay( id )
{
	if( IsGagged( id ) )
	{
		ReadGags( );

		new eData[ PlayerGag ], szSteamId[ MAX_AUTHID_LENGTH ], szName[ MAX_NAME_LENGTH ], szIP[ MAX_IP_LENGTH ];
		get_user_authid( id, szSteamId, charsmax( szSteamId ) );
		get_user_name( id, szName, charsmax( szName ) );
		get_user_ip( id, szIP, charsmax( szIP ), 1 );

		for( new i; i < ArraySize( g_aGags ); i++ )
		{
			ArrayGetArray( g_aGags, i, eData );
			
			if( ( equali( szSteamId, eData[ Player_SteamId ] ) || equali( szName, eData[ Player_Name ] ) || equali( szIP, eData[ Player_IP ] ) ) && ( containi( eData[ Player_GagFlags ], "s" ) != -1 ) )
			{
				if( equali( eData[ Player_GagExpire ], "never" ) )
				{
					CC_SendMessage( id, "%L", id, "GAG_EXPIRES_NEVER" );
					return PLUGIN_HANDLED;
				}
				
				else if( ! HasDatePassed( eData[ Player_GagExpire ] ) )
				{
					CC_SendMessage( id, "%L", id, "GAG_EXPIRES_IN", ( parse_time( eData[ Player_GagExpire ], "%m/%d/%Y - %H:%M:%S" ) - get_systime( ) ) );
					return PLUGIN_HANDLED;
				}
			}
		}
	}
	return PLUGIN_CONTINUE;
}

public fw_PlayerPreThink( id )
{
	if( is_user_alive( id ) && g_bFrozen[ id ] )
	{
		set_pev( id, pev_v_angle, fAngles[ id ] );
		set_pev( id, pev_fixangle, 1 );
	}
}

////////////////////////////////////////////////////////// END OF EVENTS ///////////////////////////////////////////////////////////////////////////////////////////


////////////////////////////////////////////////////////// MessageMode ///////////////////////////////////////////////////////////////////////////////////////////

public OnAddbanPlayerName( id )
{
	new szName[ MAX_NAME_LENGTH ];
	read_args( szName, charsmax( szName ) );
	
	trim( szName );
	remove_quotes( szName );
	
	if( ! szName[ 0 ] )
	{
		CC_SendMessage( id, "%L", id, "EMPTY_STRING" );
		return PLUGIN_HANDLED;
	}
	
	new iPlayer = find_player( "al", szName );

	if( is_user_connected( iPlayer ) )
	{
		new iImmunityLevel = GetImmunityLevel( id );
		new iImmunityLevelTarget = GetImmunityLevel( iPlayer );
		
		if( iImmunityLevel < iImmunityLevelTarget )
		{
			CC_SendMessage( id, "%L", id, "CANT_PERFORM_IMMUNITY" );
			arrayset( g_iAddBan[ id ], 0, sizeof( g_iAddBan[ ] ) );
			
			return PLUGIN_HANDLED;
		}
	}
	
	g_iAddBan[ id ][ ADDBAN_ID ] = iPlayer;
	copy( g_iAddBan[ id ][ ADDBAN_NAME ], charsmax( g_iAddBan[ ] ), szName );
	client_cmd( id, "messagemode addbanPlayerSteamID" );
	
	return PLUGIN_HANDLED;
}

public OnAddbanPlayerSteamID( id )
{
	new szSteamId[ MAX_AUTHID_LENGTH ];
	read_args( szSteamId, charsmax( szSteamId ) );

	trim( szSteamId );
	remove_quotes( szSteamId );
	
	if( ! szSteamId[ 0 ] )
	{
		CC_SendMessage( id, "%L", id, "EMPTY_STRING" );
		return PLUGIN_HANDLED;
	}
	
	new iPlayer = find_player( "cl", szSteamId );
	
	if( is_user_connected( iPlayer ) )
	{
		new iImmunityLevel = GetImmunityLevel( id );
		new iImmunityLevelTarget = GetImmunityLevel( iPlayer );
		
		if( iImmunityLevel < iImmunityLevelTarget )
		{
			CC_SendMessage( id, "%L", id, "CANT_PERFORM_IMMUNITY" );
			arrayset( g_iAddBan[ id ], 0, sizeof( g_iAddBan[ ] ) );
			
			return PLUGIN_HANDLED;
		}
	}
	
	copy( g_iAddBan[ id ][ ADDBAN_STEAMID ], charsmax( g_iAddBan[ ] ), szSteamId );
	client_cmd( id, "messagemode addbanPlayerIP" );
	
	return PLUGIN_HANDLED;
}

public OnAddbanPlayerIP( id )
{
	new szIP[ MAX_IP_LENGTH ];
	read_args( szIP, charsmax( szIP ) );
	
	trim( szIP );
	remove_quotes( szIP );
	
	if( ! szIP[ 0 ] )
	{
		CC_SendMessage( id, "%L", id, "EMPTY_STRING" );
		return PLUGIN_HANDLED;
	}
	
	new iPlayer = find_player( "dl", szIP );
	
	if( is_user_connected( iPlayer ) )
	{
		new iImmunityLevel = GetImmunityLevel( id );
		new iImmunityLevelTarget = GetImmunityLevel( iPlayer );
		
		if( iImmunityLevel < iImmunityLevelTarget )
		{
			CC_SendMessage( id, "%L", id, "CANT_PERFORM_IMMUNITY" );
			arrayset( g_iAddBan[ id ], 0, sizeof( g_iAddBan[ ] ) );
			
			return PLUGIN_HANDLED;
		}
	}
	
	copy( g_iAddBan[ id ][ ADDBAN_IP ], charsmax( g_iAddBan[ ] ), szIP );
	client_cmd( id, "messagemode addbanPlayerMinutes" );
	
	return PLUGIN_HANDLED;
}

public OnAddbanPlayerMinutes( id )
{
	new szMinutes[ 8 ];
	read_args( szMinutes, charsmax( szMinutes ) );
	
	trim( szMinutes );
	remove_quotes( szMinutes );
	
	new iMinutes = str_to_num( szMinutes );
	if( ! is_str_num( szMinutes ) || iMinutes < 0 )
	{
		send_message( id, CHAT, false, "%L", id, "INVALID_VALUE" );
		arrayset( g_iAddBan[ id ], 0, sizeof( g_iAddBan[ ] ) );
		
		return PLUGIN_HANDLED;
	}
	
	g_iAddBan[ id ][ ADDBAN_MINUTES ] = iMinutes;
	client_cmd( id, "messagemode addbanPlayerReason" );
	
	return PLUGIN_HANDLED;
}

public OnAddbanPlayerReason( id )
{
	new szReason[ MAX_REASON_LENGTH ];
	read_args( szReason, charsmax( szReason ) );
	
	trim( szReason );
	remove_quotes( szReason );
	
	new iPlayer = g_iAddBan[ id ][ ADDBAN_ID ];
	
	new szNameAdmin[ MAX_NAME_LENGTH ], szExpireDate[ MAX_DATE_LENGTH ], iMinutes = g_iAddBan[ id ][ ADDBAN_MINUTES ], szName[ MAX_NAME_LENGTH ], szSteamID[ MAX_AUTHID_LENGTH ], szIP[ MAX_IP_LENGTH ];
	
	copy( szName, charsmax( szName ), g_iAddBan[ id ][ ADDBAN_NAME ] );
	copy( szSteamID, charsmax( szSteamID ), g_iAddBan[ id ][ ADDBAN_STEAMID ] );
	copy( szIP, charsmax( szIP ), g_iAddBan[ id ][ ADDBAN_IP ] );

	get_user_name( id, szNameAdmin, charsmax( szNameAdmin ) );
	
	if( iMinutes == 0 )
	{
		CC_SendMessage( 0, "%L", LANG_PLAYER, "ADDED_TO_BANLIST_PERMANENT", szNameAdmin, szName, szSteamID, szIP, szReason );
		send_message( 0, LOG, false, "%L", LANG_PLAYER, "LOG_ADDED_TO_BANLIST_PERMANENT", szNameAdmin, szName, szSteamID, szIP, szReason );
		
		copy( szExpireDate, charsmax( szExpireDate ), "never" );	
	}
	
	else
	{
		get_time( "%m/%d/%Y - %H:%M:%S", szExpireDate, charsmax( szExpireDate ) );
		
		AddMinutesToDate( szExpireDate, iMinutes, szExpireDate, charsmax( szExpireDate ) );
		
		CC_SendMessage( 0, "%L", LANG_PLAYER, "ADDED_TO_BANLIST", szNameAdmin, szName, szSteamID, szIP, iMinutes, szReason );
		send_message( 0, LOG, false, "%L", LANG_PLAYER, "LOG_ADDED_TO_BANLIST", szNameAdmin, szName, szSteamID, szIP, iMinutes, szExpireDate, szReason );
	}

	trim( szName );
	trim( szSteamID );
	trim( szIP );
	trim( szExpireDate );
	trim( szReason );
	trim( szNameAdmin );
	
	new eData[ PlayerBan ];
	copy( eData[ Player_Name ], charsmax( eData[ Player_Name ] ), szName );
	copy( eData[ Player_SteamId ], charsmax( eData[ Player_SteamId ] ), szSteamID );
	copy( eData[ Player_IP ], charsmax( eData[ Player_IP ] ), szIP );
	copy( eData[ Player_BanExpire ], charsmax( eData[ Player_BanExpire ] ), szExpireDate );
	copy( eData[ Player_BanReason ], charsmax( eData[ Player_BanReason ] ), szReason );
	copy( eData[ Player_BannedBy ], charsmax( eData[ Player_BannedBy ] ), szNameAdmin );
	
	ArrayPushArray( g_aBans, eData );
	AddBan( szName, szSteamID, szIP, szExpireDate, szReason, szNameAdmin );
	
	arrayset( g_iAddBan[ id ], 0, sizeof( g_iAddBan[ ] ) );
	
	if( is_user_connected( iPlayer ) )
	{
		ScreenShot( iPlayer );
		KickPlayerOut( iPlayer );
	}
	
	if( is_user_connected( id ) ) // checking to see if he's still connected (maybe he banned himself)
	{
		AddBanMenu( id );
	}
	
	return PLUGIN_HANDLED;
}

public OnAddGagPlayerName( id )
{
	new szName[ MAX_NAME_LENGTH ];
	read_args( szName, charsmax( szName ) );
	
	trim( szName );
	remove_quotes( szName );
	
	if( ! szName[ 0 ] )
	{
		CC_SendMessage( id, "%L", id, "EMPTY_STRING" );
		return PLUGIN_HANDLED;
	}
	
	new iPlayer = find_player( "al", szName );

	if( is_user_connected( iPlayer ) )
	{
		new iImmunityLevel = GetImmunityLevel( id );
		new iImmunityLevelTarget = GetImmunityLevel( iPlayer );
		
		if( iImmunityLevel < iImmunityLevelTarget )
		{
			CC_SendMessage( id, "%L", id, "CANT_PERFORM_IMMUNITY" );
			arrayset( g_iAddGag[ id ], 0, sizeof( g_iAddGag[ ] ) );
			
			return PLUGIN_HANDLED;
		}
	}
	
	if( IsGagged( iPlayer ) )
	{
		send_message( id, CHAT, false, "%L", id, "PLAYER_ALREADY_GAGGED" );
		return PLUGIN_HANDLED;
	}
	
	g_iAddGag[ id ][ ADDGAG_ID ] = iPlayer;
	copy( g_iAddGag[ id ][ ADDGAG_NAME ], charsmax( g_iAddGag[ ] ), szName );
	client_cmd( id, "messagemode addgagPlayerSteamID" );
	
	return PLUGIN_HANDLED;
}

public OnAddGagPlayerSteamID( id )
{
	new szSteamId[ MAX_AUTHID_LENGTH ];
	read_args( szSteamId, charsmax( szSteamId ) );

	trim( szSteamId );
	remove_quotes( szSteamId );
	
	if( ! szSteamId[ 0 ] )
	{
		CC_SendMessage( id, "%L", id, "EMPTY_STRING" );
		return PLUGIN_HANDLED;
	}
	
	new iPlayer = find_player( "cl", szSteamId );
	
	if( is_user_connected( iPlayer ) )
	{
		new iImmunityLevel = GetImmunityLevel( id );
		new iImmunityLevelTarget = GetImmunityLevel( iPlayer );
		
		if( iImmunityLevel < iImmunityLevelTarget )
		{
			CC_SendMessage( id, "%L", id, "CANT_PERFORM_IMMUNITY" );
			arrayset( g_iAddGag[ id ], 0, sizeof( g_iAddGag[ ] ) );
			
			return PLUGIN_HANDLED;
		}
	}
	
	if( IsGagged( iPlayer ) )
	{
		send_message( id, CHAT, false, "%L", id, "PLAYER_ALREADY_GAGGED" );
		return PLUGIN_HANDLED;
	}
	
	copy( g_iAddGag[ id ][ ADDGAG_STEAMID ], charsmax( g_iAddGag[ ] ), szSteamId );
	client_cmd( id, "messagemode addgagPlayerIP" );
	
	return PLUGIN_HANDLED;
}

public OnAddGagPlayerIP( id )
{
	new szIP[ MAX_IP_LENGTH ];
	read_args( szIP, charsmax( szIP ) );
	
	trim( szIP );
	remove_quotes( szIP );
	
	if( ! szIP[ 0 ] )
	{
		CC_SendMessage( id, "%L", id, "EMPTY_STRING" );
		return PLUGIN_HANDLED;
	}
	
	new iPlayer = find_player( "dl", szIP );
	
	if( is_user_connected( iPlayer ) )
	{
		new iImmunityLevel = GetImmunityLevel( id );
		new iImmunityLevelTarget = GetImmunityLevel( iPlayer );
		
		if( iImmunityLevel < iImmunityLevelTarget )
		{
			CC_SendMessage( id, "%L", id, "CANT_PERFORM_IMMUNITY" );
			arrayset( g_iAddGag[ id ], 0, sizeof( g_iAddGag[ ] ) );
			
			return PLUGIN_HANDLED;
		}
	}
	
	if( IsGagged( iPlayer ) )
	{
		send_message( id, CHAT, false, "%L", id, "PLAYER_ALREADY_GAGGED" );
		return PLUGIN_HANDLED;
	}
	
	copy( g_iAddGag[ id ][ ADDGAG_IP ], charsmax( g_iAddGag[ ] ), szIP );
	client_cmd( id, "messagemode addgagPlayerSeconds" );
	
	return PLUGIN_HANDLED;
}

public OnAddGagPlayerSeconds( id )
{
	new szSeconds[ 8 ];
	read_args( szSeconds, charsmax( szSeconds ) );
	
	trim( szSeconds );
	remove_quotes( szSeconds );
	
	new iSeconds = str_to_num( szSeconds );
	if( ! is_str_num( szSeconds ) || iSeconds < 0 )
	{
		send_message( id, CHAT, false, "%L", id, "INVALID_VALUE" );
		arrayset( g_iAddGag[ id ], 0, sizeof( g_iAddGag[ ] ) );
		
		return PLUGIN_HANDLED;
	}
	
	g_iAddGag[ id ][ ADDGAG_SECONDS ] = iSeconds;
	client_cmd( id, "messagemode addgagPlayerFlags" );
	
	return PLUGIN_HANDLED;
}

public OnAddGagPlayerFlags( id )
{
	new szFlags[ 5 ];
	read_args( szFlags, charsmax( szFlags ) );
	
	trim( szFlags );
	remove_quotes( szFlags );
	
	if( equali( szFlags, "sv" ) || equali( szFlags, "vs" ) || equali( szFlags, "s" ) || equali( szFlags, "v" ) )
	{
		copy( g_iAddGag[ id ][ ADDGAG_FLAGS ], charsmax( g_iAddGag[ ] ), szFlags );
		client_cmd( id, "messagemode addgagPlayerReason" );
	}
	
	else
	{
		send_message( id, CHAT, false, "%L", id, "INVALID_FLAGS" );
		arrayset( g_iAddGag[ id ], 0, sizeof( g_iAddGag[ ] ) );
		
		return PLUGIN_HANDLED;
	}
	return PLUGIN_CONTINUE;
}

public OnAddGagPlayerReason( id )
{
	new szReason[ MAX_REASON_LENGTH ];
	read_args( szReason, charsmax( szReason ) );
	
	trim( szReason );
	remove_quotes( szReason );
	
	new iPlayer = g_iAddGag[ id ][ ADDGAG_ID ];
	
	new szNameAdmin[ MAX_NAME_LENGTH ], szExpireDate[ MAX_DATE_LENGTH ], iSeconds = g_iAddGag[ id ][ ADDGAG_SECONDS ], szName[ MAX_NAME_LENGTH ], szSteamID[ MAX_AUTHID_LENGTH ], szIP[ MAX_IP_LENGTH ], szFlags[ MAX_FLAGS_LENGTH ];
	get_user_name( id, szNameAdmin, charsmax( szNameAdmin ) );
	
	copy( szName, charsmax( szName ), g_iAddGag[ id ][ ADDGAG_NAME ] );
	copy( szSteamID, charsmax( szSteamID ), g_iAddGag[ id ][ ADDGAG_STEAMID ] );
	copy( szIP, charsmax( szIP ), g_iAddGag[ id ][ ADDGAG_IP ] );
	copy( szFlags, charsmax( szFlags ), g_iAddGag[ id ][ ADDGAG_FLAGS ] );
	
	if( iSeconds == 0 )
	{
		CC_SendMessage( 0, "%L", LANG_PLAYER, "ADDED_TO_GAGLIST_PERMANENT", szNameAdmin, szName, szSteamID, szIP, szFlags, szReason );
		send_message( 0, LOG, false, "%L", LANG_PLAYER, "LOG_ADDED_TO_GAGLIST_PERMANENT", szNameAdmin, szName, szSteamID, szIP, szFlags, szReason );
		
		copy( szExpireDate, charsmax( szExpireDate ), "never" );	
	}
	
	else
	{
		get_time( "%m/%d/%Y - %H:%M:%S", szExpireDate, charsmax( szExpireDate ) );
		
		AddSecondsToDate( szExpireDate, iSeconds, szExpireDate, charsmax( szExpireDate ) );
		
		CC_SendMessage( 0, "%L", LANG_PLAYER, "ADDED_TO_GAGLIST", szNameAdmin, szName, szSteamID, szIP, iSeconds );
		send_message( 0, LOG, false, "%L", LANG_PLAYER, "LOG_ADDED_TO_GAGLIST", szNameAdmin, szName, szSteamID, szIP, iSeconds, szExpireDate, szFlags, szReason );
	}

	trim( szName );
	trim( szSteamID );
	trim( szIP );
	trim( szReason );
	trim( szFlags );
	trim( szExpireDate );
	trim( szNameAdmin );
	
	new eData[ PlayerGag ];
	copy( eData[ Player_Name ], charsmax( eData[ Player_Name ] ), szName );
	copy( eData[ Player_SteamId ], charsmax( eData[ Player_SteamId ] ), szSteamID);
	copy( eData[ Player_IP ], charsmax( eData[ Player_IP ] ), szIP );
	copy( eData[ Player_GagFlags ], charsmax( eData[ Player_GagFlags ] ), szFlags );
	copy( eData[ Player_GagReason ], charsmax( eData[ Player_GagReason ] ), szReason );
	copy( eData[ Player_GagExpire ], charsmax( eData[ Player_GagExpire ] ), szExpireDate );
	copy( eData[ Player_GaggedBy ], charsmax( eData[ Player_GaggedBy ] ), szNameAdmin );
	
	ArrayPushArray( g_aGags, eData );
	
	AddGag( szName, szSteamID, szIP, szReason, szFlags, szExpireDate, szNameAdmin );
	
	if( is_user_connected( iPlayer ) )
	{
		CheckGagged( iPlayer );
	}
	
	if( is_user_connected( id ) )
	{
		AddGagMenu( id );
	}
	
	arrayset( g_iAddGag[ id ], 0, sizeof( g_iAddGag[ ] ) );
	
	return PLUGIN_HANDLED;
}

public OnKickPlayer( id )
{
	new szReason[ MAX_REASON_LENGTH ];
	read_args( szReason, charsmax( szReason ) );
	
	trim( szReason );
	remove_quotes( szReason );
	
	new iPlayer = g_iKick[ id ];
	
	new szNameAdmin[ MAX_NAME_LENGTH ], szNameUser[ MAX_NAME_LENGTH ];
	
	get_user_name( id, szNameAdmin, charsmax( szNameAdmin ) );
	get_user_name( iPlayer, szNameUser, charsmax( szNameUser ) );
	
	server_cmd( "kick #%d ^"%s^"", get_user_userid( iPlayer ), szReason );
	
	CC_SendMessage( 0, "%L", LANG_PLAYER, "KICKED", szNameAdmin, szNameUser, szReason );
	send_message( 0, LOG, false, "%L", LANG_PLAYER, "KICKED", szNameAdmin, szNameUser, szReason );
	
	g_iKick[ id ] = 0;
	
	if( is_user_connected( id ) )
	{
		set_task( 0.1, "ReOpenKickMenu", id + TASK_KICK_MENU ); // needs a delay to update players 
	}
	
	return PLUGIN_HANDLED;
}

public OnGagPlayerSeconds( id )
{
	new szSeconds[ 8 ];
	read_args( szSeconds, charsmax( szSeconds ) );
	
	trim( szSeconds );
	remove_quotes( szSeconds );
	
	new iSeconds = str_to_num( szSeconds );
	if( ! is_str_num( szSeconds ) || iSeconds < 0 )
	{
		send_message( id, CHAT, false, "%L", id, "INVALID_VALUE" );
		arrayset( g_iGag[ id ], 0, sizeof( g_iGag[ ] ) );
		
		return PLUGIN_HANDLED;
	}
	
	g_iGag[ id ][ GAG_SECONDS ] = iSeconds;
	client_cmd( id, "messagemode gagPlayerFlags" );
	
	return PLUGIN_HANDLED;
}

public OnGagPlayerFlags( id )
{
	new szFlags[ 5 ];
	read_args( szFlags, charsmax( szFlags ) );
	
	trim( szFlags );
	remove_quotes( szFlags );
	
	if( equali( szFlags, "sv" ) || equali( szFlags, "vs" ) || equali( szFlags, "s" ) || equali( szFlags, "v" ) )
	{
		copy( g_iGag[ id ][ GAG_FLAGS ], charsmax( g_iGag[ ] ), szFlags );
		client_cmd( id, "messagemode gagPlayerReason" );
	}
	
	else
	{
		send_message( id, CHAT, false, "%L", id, "INVALID_FLAGS" );
		arrayset( g_iGag[ id ], 0, sizeof( g_iGag[ ] ) );
		
		return PLUGIN_HANDLED;
	}
	return PLUGIN_HANDLED;
}

public OnGagPlayerReason( id )
{
	new szReason[ MAX_REASON_LENGTH ];
	read_args( szReason, charsmax( szReason ) );
	
	trim( szReason );
	remove_quotes( szReason );
	
	new iPlayer = g_iGag[ id ][ GAG_ID ];
	
	new szFlags[ 5 ];
	copy( szFlags, charsmax( szFlags ), g_iGag[ id ][ GAG_FLAGS ] );
	
	new szNameAdmin[ MAX_NAME_LENGTH ], szExpireDate[ MAX_DATE_LENGTH ], szNameUser[ MAX_NAME_LENGTH ], szSteamIdUser[ MAX_AUTHID_LENGTH ], szIpUser[ MAX_IP_LENGTH ], iSeconds = g_iGag[ id ][ GAG_SECONDS ];

	get_user_name( id, szNameAdmin, charsmax( szNameAdmin ) );
	get_user_name( iPlayer, szNameUser, charsmax( szNameUser ) );
	get_user_authid( iPlayer, szSteamIdUser, charsmax( szSteamIdUser ) );
	get_user_ip( iPlayer, szIpUser, charsmax( szIpUser ), 1 );
	
	if( iSeconds == 0 )
	{
		CC_SendMessage( 0, "%L", LANG_PLAYER, "GAGGED_PERMANENT", szNameAdmin, szNameUser, szFlags, szReason );
		send_message( 0, LOG, false, "%L", LANG_PLAYER, "LOG_GAGGED_PERMANENT", szNameAdmin, szNameUser, szSteamIdUser, szIpUser, szReason, szFlags );
		
		copy( szExpireDate, charsmax( szExpireDate ), "never" );
	}
	
	else
	{
		get_time( "%m/%d/%Y - %H:%M:%S", szExpireDate, charsmax( szExpireDate ) );
		AddSecondsToDate( szExpireDate, iSeconds, szExpireDate, charsmax( szExpireDate ) );
		
		if( iSeconds == 1 )
		{
			CC_SendMessage( 0, "%L", LANG_PLAYER, "GAGGED_SINGULAR", szNameAdmin, szNameUser, szReason, szFlags );
			send_message( 0, LOG, false, "%L", LANG_PLAYER, "LOG_GAGGED_SINGULAR", szNameAdmin, szNameUser, szSteamIdUser, szIpUser, szReason, szExpireDate, szFlags );
		}
		
		else
		{
			CC_SendMessage( 0, "%L", LANG_PLAYER, "GAGGED_PLURAL", szNameAdmin, szNameUser, iSeconds, szReason, szFlags );
			send_message( 0, LOG, false, "%L", LANG_PLAYER, "LOG_GAGGED_PLURAL", szNameAdmin, szNameUser, szSteamIdUser, szIpUser, iSeconds, szReason, szExpireDate, szFlags );
		}
	}
	
	trim( szNameUser );
	trim( szSteamIdUser );
	trim( szIpUser );
	trim( szExpireDate );
	trim( szReason );
	trim( szNameAdmin );
	
	new eData[ PlayerGag ];	
	copy( eData[ Player_Name ], charsmax( eData[ Player_Name ] ), szNameUser );
	copy( eData[ Player_SteamId ], charsmax( eData[ Player_SteamId ] ), szSteamIdUser );
	copy( eData[ Player_IP ], charsmax( eData[ Player_IP ] ), szIpUser );
	copy( eData[ Player_GagExpire ], charsmax( eData[ Player_GagExpire ] ), szExpireDate );
	copy( eData[ Player_GagReason ], charsmax( eData[ Player_GagReason ] ), szReason );
	copy( eData[ Player_GagFlags ], charsmax( eData[ Player_GagFlags ] ), szFlags );
	copy( eData[ Player_GaggedBy ], charsmax( eData[ Player_GaggedBy ] ), szNameAdmin );
	
	ArrayPushArray( g_aGags, eData );
	
	if( containi( szFlags, "v" ) != -1 && is_user_connected( iPlayer ) )
	{
		set_speak( iPlayer, SPEAK_MUTED );
	}
	
	GagPlayer( szNameUser, szSteamIdUser, szIpUser, szReason, szFlags, szExpireDate, szNameAdmin );	
	arrayset( g_iGag[ id ], 0, sizeof( g_iGag[ ] ) );
	
	if( is_user_connected( id ) )
	{
		GagMenu( id );
	}
	
	return PLUGIN_HANDLED;
}

public OnBanPlayerMinutes( id )
{
	new szMinutes[ 8 ];
	read_args( szMinutes, charsmax( szMinutes ) );
	
	trim( szMinutes );
	remove_quotes( szMinutes );
	
	new iMinutes = str_to_num( szMinutes );
	
	if( ! is_str_num( szMinutes ) || iMinutes < 0 )
	{
		send_message( id, CHAT, false, "%L", id, "INVALID_VALUE" );
		arrayset( g_iBan[ id ], 0, sizeof( g_iBan[ ] ) );
		
		return PLUGIN_HANDLED;
	}
	
	g_iBan[ id ][ BAN_MINUTES ] = iMinutes;
	client_cmd( id, "messagemode banPlayerReason" );
	
	return PLUGIN_HANDLED;
}

public OnBanPlayerReason( id )
{
	new szReason[ MAX_REASON_LENGTH ];
	read_args( szReason, charsmax( szReason ) );
	
	trim( szReason );
	remove_quotes( szReason );
	
	new iPlayer = g_iBan[ id ][ BAN_ID ], szNameUser[ MAX_NAME_LENGTH ], szNameAdmin[ MAX_NAME_LENGTH ], szSteamIdUser[ MAX_AUTHID_LENGTH ], szIpUser[ MAX_IP_LENGTH ], szExpireDate[ MAX_DATE_LENGTH ], iMinutes = g_iBan[ id ][ BAN_MINUTES ];
	
	get_user_name( id, szNameAdmin, charsmax( szNameAdmin ) );
	get_user_name( iPlayer, szNameUser, charsmax( szNameUser ) );
	get_user_authid( iPlayer, szSteamIdUser, charsmax( szSteamIdUser ) );
	get_user_ip( iPlayer, szIpUser, charsmax( szIpUser ), 1 );
	
	if( iMinutes == 0 )
	{
		CC_SendMessage( 0, "%L", LANG_PLAYER, "BANNED_PERMANENT", szNameAdmin, szNameUser, szReason );
		send_message( 0, LOG, false, "%L", LANG_PLAYER, "LOG_BANNED_PERMANENT", szNameAdmin, szNameUser, szSteamIdUser, szIpUser, szReason );
		
		copy( szExpireDate, charsmax( szExpireDate ), "never" );
	}
	
	else
	{
		get_time( "%m/%d/%Y - %H:%M:%S", szExpireDate, charsmax( szExpireDate ) );
		
		AddMinutesToDate( szExpireDate, iMinutes, szExpireDate, charsmax( szExpireDate ) );
		
		if( iMinutes == 1 )
		{
			CC_SendMessage( 0, "%L", LANG_PLAYER, "BANNED_SINGULAR", szNameAdmin, szNameUser, szReason );
			send_message( 0, LOG, false, "%L", LANG_PLAYER, "LOG_BANNED_SINGULAR", szNameAdmin, szNameUser, szSteamIdUser, szIpUser, szReason, szExpireDate );
		}
		
		else
		{
			CC_SendMessage( 0, "%L", LANG_PLAYER, "BANNED_PLURAL", szNameAdmin, szNameUser, iMinutes, szReason );
			send_message( 0, LOG, false, "%L", LANG_PLAYER, "LOG_BANNED_PLURAL", szNameAdmin, szNameUser, szSteamIdUser, szIpUser, iMinutes, szReason, szExpireDate );
		}
	}
	
	trim( szNameUser );
	trim( szSteamIdUser );
	trim( szIpUser );
	trim( szExpireDate );
	trim( szReason );
	trim( szNameAdmin );
	
	new eData[ PlayerBan ];	
	copy( eData[ Player_Name ], charsmax( eData[ Player_Name ] ), szNameUser );
	copy( eData[ Player_SteamId ], charsmax( eData[ Player_SteamId ] ), szSteamIdUser );
	copy( eData[ Player_IP ], charsmax( eData[ Player_IP ] ), szIpUser );
	copy( eData[ Player_BanExpire ], charsmax( eData[ Player_BanExpire ] ), szExpireDate );
	copy( eData[ Player_BanReason ], charsmax( eData[ Player_BanReason ] ), szReason );
	copy( eData[ Player_BannedBy ], charsmax( eData[ Player_BannedBy ] ), szNameAdmin );
	
	ArrayPushArray( g_aBans, eData );
	BanPlayer( szNameUser, szSteamIdUser, szIpUser, szExpireDate, szReason, szNameAdmin );
	
	arrayset( g_iBan[ id ], 0, sizeof( g_iBan[ ] ) );
	
	if( is_user_connected( iPlayer ) )
	{
		ScreenShot( iPlayer );
		KickPlayerOut( iPlayer );
	}
	
	if( is_user_connected( id ) )
	{
		set_task( 0.1, "ReOpenBanMenu", id + TASK_BAN_MENU ); // needs a delay to update players 
	}
	
	return PLUGIN_HANDLED;
}

public OnSlapPlayerValue( id )
{
	new szValue[ 6 ];
	read_args( szValue, charsmax( szValue ) );
	
	trim( szValue );
	remove_quotes( szValue );
	
	new iValue = str_to_num( szValue );
	
	if( ! is_str_num( szValue ) )
	{
		send_message( id, CHAT, true, "%L", id, "INVALID_VALUE" );
		return PLUGIN_HANDLED;
	}
	
	if( ! is_user_alive( g_iSlap[ id ][ SLAP_ID ] ) )
	{
		send_message( id, CHAT, true, "%L", id, "SLAP_DEAD_PLAYER" );
		return PLUGIN_HANDLED;
	}
	
	g_iSlap[ id ][ SLAP_VALUE ] = iValue;
	client_cmd( id, "messagemode slapPlayerReason" );
	
	return PLUGIN_HANDLED;
}

public OnSlapPlayerReason( id )
{
	new szReason[ MAX_REASON_LENGTH ];
	read_args( szReason, charsmax( szReason ) );
	
	trim( szReason );
	remove_quotes( szReason );
	
	new iValue = g_iSlap[ id ][ SLAP_VALUE ], iPlayer = g_iSlap[ id ][ SLAP_ID ];
	
	if( ! is_user_alive( iPlayer ) )
	{
		send_message( id, CHAT, true, "%L", id, "SLAP_DEAD_PLAYER" );
		return PLUGIN_HANDLED;
	}
	
	new szNameAdmin[ MAX_NAME_LENGTH ], szNameUser[ MAX_NAME_LENGTH ];
	
	get_user_name( id, szNameAdmin, charsmax( szNameAdmin ) );
	get_user_name( iPlayer, szNameUser, charsmax( szNameUser ) );
	
	user_slap( iPlayer, iValue );
	
	CC_SendMessage( 0, "%L", LANG_PLAYER, "SLAP", szNameAdmin, szNameUser, iValue, szReason );
	send_message( 0, LOG, false, "%L", LANG_PLAYER, "SLAP", szNameAdmin, szNameUser, iValue, szReason );
	
	arrayset( g_iSlap[ id ], 0, sizeof( g_iSlap[ ] ) );

	SlapMenu( id );

	return PLUGIN_HANDLED;
}

public OnSlayPlayerReason( id )
{
	new szReason[ MAX_REASON_LENGTH ];
	read_args( szReason, charsmax( szReason ) );
	
	trim( szReason );
	remove_quotes( szReason );
	
	new iPlayer = g_iSlay[ id ][ SLAY_ID ];
	
	if( ! is_user_alive( iPlayer ) )
	{
		send_message( id, CHAT, true, "%L", id, "SLAY_DEAD_PLAYER" );
		return PLUGIN_HANDLED;
	}
	
	new szNameAdmin[ MAX_NAME_LENGTH ], szNameUser[ MAX_NAME_LENGTH ];
	
	get_user_name( id, szNameAdmin, charsmax( szNameAdmin ) );
	get_user_name( iPlayer, szNameUser, charsmax( szNameUser ) );
	
	user_kill( iPlayer );
	
	CC_SendMessage( 0, "%L", LANG_PLAYER, "SLAY", szNameAdmin, szNameUser, szReason );
	send_message( 0, LOG, false, "%L", LANG_PLAYER, "SLAY", szNameAdmin, szNameUser, szReason );
	
	arrayset( g_iSlay[ id ], 0, sizeof( g_iSlay[ ] ) );

	SlayMenu( id );

	return PLUGIN_HANDLED;
}

///////////////////////////////////////////////////////////////////// END OF MESSAGEMODE /////////////////////////////////////////////////////////////////////////////////////////////////////////

///////////////////////////////////////////////////////////////////// COMMANDS MENU /////////////////////////////////////////////////////////////////////////////////////////////////////////
@CommandsMenu( id )
{
	if( ~ get_user_flags( id ) & g_iConfig[ COMMANDS_MENU_FLAG ] )
	{
		send_message( id, CONSOLE, true, "%L", id, "NO_ACCESS_COMMAND" );
		return PLUGIN_HANDLED;
	}
	
	new szMenuTitle[ 64 ];
	formatex( szMenuTitle, charsmax( szMenuTitle ), "\rElite Admin System Menu^n\wVersion: \r%s", PLUGIN_VERSION );
	
	new iMenu = menu_create( szMenuTitle, "@CommandsMenu_Handler" );
	
	new szMenuItem[ 64 ];
	
	formatex( szMenuItem, charsmax( szMenuItem ), "%L", id, "KICK_MENU" );
	menu_additem( iMenu, szMenuItem );
	
	formatex( szMenuItem, charsmax( szMenuItem ), "%L", id, "BAN_MENU" );
	menu_additem( iMenu, szMenuItem );
	
	formatex( szMenuItem, charsmax( szMenuItem ), "%L", id, "ADDBAN_MENU" );
	menu_additem( iMenu, szMenuItem );
	
	formatex( szMenuItem, charsmax( szMenuItem ), "%L", id, "ADDGAG_MENU" );
	menu_additem( iMenu, szMenuItem );
	
	formatex( szMenuItem, charsmax( szMenuItem ), "%L", id, "GAG_MENU" );
	menu_additem( iMenu, szMenuItem );
	
	formatex( szMenuItem, charsmax( szMenuItem ), "%L", id, "UNBAN_MENU" );
	menu_additem( iMenu, szMenuItem );

	formatex( szMenuItem, charsmax( szMenuItem ), "%L", id, "UNGAG_MENU" );
	menu_additem( iMenu, szMenuItem );

	formatex( szMenuItem, charsmax( szMenuItem ), "%L", id, "SLAY_MENU" );
	menu_additem( iMenu, szMenuItem );
	
	formatex( szMenuItem, charsmax( szMenuItem ), "%L", id, "SLAP_MENU" );
	menu_additem( iMenu, szMenuItem );
	
	formatex( szMenuItem, charsmax( szMenuItem ), "%L", id, "TEAM_MENU" );
	menu_additem( iMenu, szMenuItem );
	
	formatex( szMenuItem, charsmax( szMenuItem ), "%L", id, "MAP_MENU" );
	menu_additem( iMenu, szMenuItem );
	
	formatex( szMenuItem, charsmax( szMenuItem ), "%L", id, "FREEZE_MENU" );
	menu_additem( iMenu, szMenuItem );
	
	menu_display( id, iMenu, 0 );
	return PLUGIN_HANDLED;
}

KickMenu( id )
{
	new szMenuTitle[ 64 ];
	formatex( szMenuTitle, charsmax( szMenuTitle ), "%L", id, "KICK_MENU" );
	new iMenu = menu_create( szMenuTitle, "@KickMenu" );
	
	new iPlayers[ MAX_PLAYERS ], iNum, iTempId, szName[ MAX_NAME_LENGTH ], szId[ 3 ];
	get_players( iPlayers, iNum, "h" );
	
	for( new i; i < iNum; i++ )
	{	
		iTempId = iPlayers[ i ];
		
		get_user_name( iTempId, szName, charsmax( szName ) );
		num_to_str( iTempId, szId, charsmax( szId ) );
		
		menu_additem( iMenu, szName, szId );
	}
	menu_display( id, iMenu, 0 );
}

BanMenu( id )
{
	new szMenuTitle[ 64 ];
	formatex( szMenuTitle, charsmax( szMenuTitle ), "%L", id, "BAN_MENU" );
	new iMenu = menu_create( szMenuTitle, "@BanMenu" );
	
	new iPlayers[ MAX_PLAYERS ], iNum, iTempId, szName[ MAX_NAME_LENGTH ], szId[ 3 ];
	get_players( iPlayers, iNum, "ch" );
	
	for( new i; i < iNum; i++ )
	{
		iTempId = iPlayers[ i ];
		
		get_user_name( iTempId, szName, charsmax( szName ) );
		num_to_str( iTempId, szId, charsmax( szId ) );
		
		menu_additem( iMenu, szName, szId );
	}
	menu_display( id, iMenu, 0 );
}

AddBanMenu( id )
{
	new szMenuTitle[ 64 ];
	formatex( szMenuTitle, charsmax( szMenuTitle ), "%L", id, "ADDBAN_MENU" );
	new iMenu = menu_create( szMenuTitle, "@AddBanMenu" );
	
	new szAddNewBan[ 20 ];
	formatex( szAddNewBan, charsmax( szAddNewBan ), "%L", id, "ADD_NEW_BAN" );
	
	menu_additem( iMenu, szAddNewBan );
	
	menu_display( id, iMenu, 0 );
}

AddGagMenu( id )
{
	new szMenuTitle[ 64 ];
	formatex( szMenuTitle, charsmax( szMenuTitle ), "%L", id, "ADDGAG_MENU" );
	new iMenu = menu_create( szMenuTitle, "@AddGagMenu" );
	
	new szAddNewGag[ 20 ];
	formatex( szAddNewGag, charsmax( szAddNewGag ), "%L", id, "ADD_NEW_GAG" );
	
	menu_additem( iMenu, szAddNewGag );
	menu_display( id, iMenu, 0 );
}

GagMenu( id )
{
	new szMenuTitle[ 64 ];
	formatex( szMenuTitle, charsmax( szMenuTitle ), "%L", id, "GAG_MENU" );
	new iMenu = menu_create( szMenuTitle, "@GagMenu" );
	
	new iPlayers[ MAX_PLAYERS ], iNum, iTempId, szName[ MAX_NAME_LENGTH ], szId[ 3 ];
	get_players( iPlayers, iNum, "ch" );
	
	for( new i; i < iNum; i++ )
	{
		iTempId = iPlayers[ i ];
		
		if( IsGagged( iTempId ) )
		{
			continue;
		}
		
		get_user_name( iTempId, szName, charsmax( szName ) );
		num_to_str( iTempId, szId, charsmax( szId ) );
		
		menu_additem( iMenu, szName, szId );
	}
	menu_display( id, iMenu, 0 );
}

UnBanMenu( id )
{
	ReadBans( );
	CheckExistingBans( );
	
	new szItemName[ 192 ], szInfo[ 128 ], szMenuTitle[ 64 ];
	formatex( szMenuTitle, charsmax( szMenuTitle ), "%L", id, "UNBAN_MENU" );
	new iMenu = menu_create( szMenuTitle, "@UnbanMenu" );
	
	menu_setprop( iMenu, MPROP_PERPAGE, 5 );
	
	new eData[ PlayerBan ], bool:bBansFound;
	for( new i; i < ArraySize( g_aBans ); i++ )
	{			
		ArrayGetArray( g_aBans, i, eData );
		
		formatex( szItemName, charsmax( szItemName ), "\r%s \w| \y%s \w| \d%s", eData[ Player_Name ], eData[ Player_SteamId ], eData[ Player_IP ] );
		formatex( szInfo, charsmax( szInfo ), "^"%s^" ^"%s^" ^"%s^"", eData[ Player_Name ], eData[ Player_SteamId ], eData[ Player_IP ] );
		
		menu_additem( iMenu, szItemName, szInfo );
		
		bBansFound = true;
	}
	
	if( ! bBansFound )
	{
		CC_SendMessage( id, "%L", id, "NO_BANS_FOUND" );
		return PLUGIN_HANDLED;
	}
	menu_display( id, iMenu, 0 );
	return PLUGIN_HANDLED;
}

UnGagMenu( id )
{
	ReadGags( );
	CheckExistingGags( );
	
	new szItemName[ 192 ], szInfo[ 128 ], szMenuTitle[ 64 ];
	formatex( szMenuTitle, charsmax( szMenuTitle ), "%L", id, "UNGAG_MENU" );
	new iMenu = menu_create( szMenuTitle, "@UnGagMenu" );
	
	new eData[ PlayerGag ], bool:bGagsFound;
	for( new i; i < ArraySize( g_aGags ); i++ )
	{			
		ArrayGetArray( g_aGags, i, eData );
		
		formatex( szItemName, charsmax( szItemName ), "\r%s \w| \y%s \w| \d%s", eData[ Player_Name ], eData[ Player_SteamId ], eData[ Player_IP ] );
		formatex( szInfo, charsmax( szInfo ), "^"%s^" ^"%s^" ^"%s^"", eData[ Player_Name ], eData[ Player_SteamId ], eData[ Player_IP ] );
		
		menu_additem( iMenu, szItemName, szInfo );
		
		bGagsFound = true;
	}
	
	if( ! bGagsFound )
	{
		CC_SendMessage( id, "%L", id, "NO_GAGS_FOUND" );
		return PLUGIN_HANDLED;
	}
	menu_display( id, iMenu, 0 );
	return PLUGIN_HANDLED;
}

SlayMenu( id )
{
	new szMenuTitle[ 64 ];
	formatex( szMenuTitle, charsmax( szMenuTitle ), "%L", id, "SLAY_MENU" );
	new iMenu = menu_create( szMenuTitle, "@SlayMenu" );
	
	new iPlayers[ MAX_PLAYERS ], iNum, iTempId, szName[ MAX_NAME_LENGTH ], szId[ 3 ];
	get_players( iPlayers, iNum, "ach" );
	
	for( new i; i < iNum; i++ )
	{
		iTempId = iPlayers[ i ];
		
		get_user_name( iTempId, szName, charsmax( szName ) );
		
		num_to_str( iTempId, szId, charsmax( szId ) );
		menu_additem( iMenu, szName, szId );
	}
	menu_display( id, iMenu, 0 );
}

SlapMenu( id )
{
	new szMenuTitle[ 64 ];
	formatex( szMenuTitle, charsmax( szMenuTitle ), "%L", id, "SLAP_MENU" );
	new iMenu = menu_create( szMenuTitle, "@SlapMenu" );
	
	new iPlayers[ MAX_PLAYERS ], iNum, iTempId, szName[ MAX_NAME_LENGTH ], szId[ 3 ];
	get_players( iPlayers, iNum, "ach" );
	
	for( new i; i < iNum; i++ )
	{
		iTempId = iPlayers[ i ];
		
		get_user_name( iTempId, szName, charsmax( szName ) );
		
		num_to_str( iTempId, szId, charsmax( szId ) );
		menu_additem( iMenu, szName, szId );
	}
	menu_display( id, iMenu, 0 );
}

TeamMenu( id )
{
	new iPlayers[ MAX_PLAYERS ], iNum, iTempId, szName[ MAX_NAME_LENGTH*2 ], szSwitch[ 64 ], szPlayerTeam[ 20 ], szId[ 3 ], iCount, bool:bSwitchAdded;
	get_players( iPlayers, iNum, "ch" );
	
	if( g_iTeamSwitch[ id ] == TEAM_UNASSIGNED )
	{
		get_user_team( id ) == TEAM_T ? ( g_iTeamSwitch[ id ] = TEAM_CT ) : ( g_iTeamSwitch[ id ] = TEAM_T );
		GetTeamName( g_iTeamSwitch[ id ], g_szTeamSwitch[ id ], charsmax( g_szTeamSwitch[ ] ) );
	}
	
	new szMenuTitle[ 64 ];
	formatex( szMenuTitle, charsmax( szMenuTitle ), "%L", id, "TEAM_MENU" );
	new iMenu = menu_create( szMenuTitle, "@TeamMenu" );
	
	formatex( szSwitch, charsmax( szSwitch ), "%L: \r%s", id, "CURRENT_SWITCH_TEAM", g_szTeamSwitch[ id ] );

	if( iNum > 6 ) // more than 6 players, if we want switch to always be 7th we have to stop adding items and add the switch
	{
		for( new i; i < iNum; i++ )
		{
			iTempId = iPlayers[ i ];
			
			if( iCount == 6 && ! bSwitchAdded )
			{
				menu_additem( iMenu, szSwitch, "switch" );
				bSwitchAdded = true;
			}
			
			get_user_name( iTempId, szName, charsmax( szName ) );
			get_user_team( iTempId, szPlayerTeam, charsmax( szPlayerTeam ) );
			
			num_to_str( iTempId, szId, charsmax( szId ) );
			
			if( ! equali( szPlayerTeam, g_szTeamSwitch[ id ] ) )
			{
				format( szName, charsmax( szName ), "%s \y[%s]", szName, szPlayerTeam );
			}
			
			else
			{
				format( szName, charsmax( szName ), "\d%s [%s]", szName, szPlayerTeam );
			}
			menu_additem( iMenu, szName, szId );
			iCount++;
		}
	}

	else
	{
		if( iNum == 6 ) // if theres 6 players no need to add blanks
		{
			for( new i; i < iNum; i++ )
			{
				iTempId = iPlayers[ i ];
				
				get_user_name( iTempId, szName, charsmax( szName ) );
				get_user_team( iTempId, szPlayerTeam, charsmax( szPlayerTeam ) );
				
				num_to_str( iTempId, szId, charsmax( szId ) );

				if( ! equali( szPlayerTeam, g_szTeamSwitch[ id ] ) )
				{
					format( szName, charsmax( szName ), "%s \y[%s]", szName, szPlayerTeam );
				}
				
				else
				{
					format( szName, charsmax( szName ), "\d%s [%s]", szName, szPlayerTeam );
				}
				menu_additem( iMenu, szName, szId );
			}
			menu_additem( iMenu, szSwitch, "switch" );
		}
		
		else // need to add blanks
		{
			for( new i; i < iNum; i++ ) // add all players to the list
			{
				iTempId = iPlayers[ i ];
				
				get_user_name( iTempId, szName, charsmax( szName ) );
				get_user_team( iTempId, szPlayerTeam, charsmax( szPlayerTeam ) );
				
				num_to_str( iTempId, szId, charsmax( szId ) );
				
				if( ! equali( szPlayerTeam, g_szTeamSwitch[ id ] ) )
				{
					format( szName, charsmax( szName ), "%s \y[%s]", szName, szPlayerTeam );
				}
				
				else
				{
					format( szName, charsmax( szName ), "\d%s [%s]", szName, szPlayerTeam );
				}
				menu_additem( iMenu, szName, szId );
			}
			new iCalculateBlanks = 6 - iNum; // calculate how many blanks we need
			for( new i = 1; i <= iCalculateBlanks; i++ )
			{
				menu_addblank( iMenu, 0 ); // add the blanks
			}
			menu_additem( iMenu, szSwitch, "switch" ); // add switch
		}
	}
	menu_display( id, iMenu, 0 );
}	

MapMenu( id )
{
	new szMenuTitle[ 64 ];
	formatex( szMenuTitle, charsmax( szMenuTitle ), "%L", id, "MAP_MENU" );
	new iMenu = menu_create( szMenuTitle, "@MapMenu" );
	
	new szMapName[ MAX_MAP_NAME_LENGTH ];
	for( new i; i < ArraySize( g_aMaps ); i++ )
	{
		ArrayGetString( g_aMaps, i, szMapName, charsmax( szMapName ) );

		menu_additem( iMenu, szMapName, szMapName );
	}
	menu_display( id, iMenu, 0 );
}			

FreezeMenu( id )
{
	new szMenuTitle[ 64 ];
	formatex( szMenuTitle, charsmax( szMenuTitle ), "%L", id, "FREEZE_MENU" );
	new iMenu = menu_create( szMenuTitle, "@FreezeMenu" );
	
	new iPlayers[ MAX_PLAYERS ], iNum, iTempId, szName[ MAX_NAME_LENGTH ], szId[ 3 ];
	get_players( iPlayers, iNum, "ach" );
	
	for( new i; i < iNum; i++ )
	{
		iTempId = iPlayers[ i ];
		
		get_user_name( iTempId, szName, charsmax( szName ) );
		
		num_to_str( iTempId, szId, charsmax( szId ) );
		menu_additem( iMenu, szName, szId );
	}
	menu_display( id, iMenu, 0 );
}

@CommandsMenu_Handler( id, iMenu, iItem )
{
	if( iItem == MENU_EXIT )
	{
		menu_destroy( iMenu );
		return PLUGIN_HANDLED;
	}
	
	switch( iItem )
	{	
	case 0:
		{
			if( ~ get_user_flags( id ) & g_iConfig[ KICK_FLAG ] )
			{
				send_message( id, CHAT, true, "%L", id, "NO_ACCESS_MENU" );
				menu_destroy( iMenu );
				
				return PLUGIN_HANDLED;
			}
			KickMenu( id );
		}
		
	case 1:
		{
			if( ~ get_user_flags( id ) & g_iConfig[ BAN_FLAG ] )
			{
				send_message( id, CHAT, true, "%L", id, "NO_ACCESS_MENU" );
				menu_destroy( iMenu );
				
				return PLUGIN_HANDLED;
			}
			BanMenu( id );
		}
		
	case 2:
		{
			if( ~ get_user_flags( id ) & g_iConfig[ ADD_BAN_FLAG ] )
			{
				send_message( id, CHAT, true, "%L", id, "NO_ACCESS_MENU" );
				menu_destroy( iMenu );
				
				return PLUGIN_HANDLED;
			}
			AddBanMenu( id );
		}
		
	case 3:
		{
			if( ~ get_user_flags( id ) & g_iConfig[ ADD_GAG_FLAG ] )
			{
				send_message( id, CHAT, true, "%L", id, "NO_ACCESS_MENU" );
				menu_destroy( iMenu );
				
				return PLUGIN_HANDLED;
			}
			AddGagMenu( id );
		}
		
	case 4:
		{
			if( ~ get_user_flags( id ) & g_iConfig[ GAG_FLAG ] )
			{
				send_message( id, CHAT, true, "%L", id, "NO_ACCESS_MENU" );
				menu_destroy( iMenu );
				
				return PLUGIN_HANDLED;
			}
			GagMenu( id );
		}
		
	case 5:
		{
			if( ~ get_user_flags( id ) & g_iConfig[ UNBAN_FLAG ] )
			{
				send_message( id, CHAT, true, "%L", id, "NO_ACCESS_MENU" );
				menu_destroy( iMenu );
				
				return PLUGIN_HANDLED;
			}
			UnBanMenu( id );
		}
		
	case 6:
		{
			if( ~ get_user_flags( id ) & g_iConfig[ UNGAG_FLAG ] )
			{
				send_message( id, CHAT, true, "%L", id, "NO_ACCESS_MENU" );
				menu_destroy( iMenu );
				
				return PLUGIN_HANDLED;
			}
			UnGagMenu( id );
		}	
		
	case 7:
		{
			if( ~ get_user_flags( id ) & g_iConfig[ SLAY_FLAG ] )
			{
				send_message( id, CHAT, true, "%L", id, "NO_ACCESS_MENU" );
				menu_destroy( iMenu );
				
				return PLUGIN_HANDLED;
			}
			SlayMenu( id );
		}
		
	case 8:
		{
			if( ~ get_user_flags( id ) & g_iConfig[ SLAP_FLAG ] )
			{
				send_message( id, CHAT, true, "%L", id, "NO_ACCESS_MENU" );
				menu_destroy( iMenu );
				
				return PLUGIN_HANDLED;
			}
			SlapMenu( id );
		}
		
	case 9:
		{
			if( ~ get_user_flags( id ) & g_iConfig[ TEAM_FLAG ] )
			{
				send_message( id, CHAT, true, "%L", id, "NO_ACCESS_MENU" );
				menu_destroy( iMenu );
				
				return PLUGIN_HANDLED;
			}
			TeamMenu( id );
		}
		
	case 10:
		{
			if( ~ get_user_flags( id ) & g_iConfig[ MAP_FLAG ] )
			{
				send_message( id, CHAT, true, "%L", id, "NO_ACCESS_MENU" );
				menu_destroy( iMenu );
				
				return PLUGIN_HANDLED;
			}
			
			MapMenu( id );
		}
		
	case 11:
		{
			if( ~ get_user_flags( id ) & g_iConfig[ FREEZE_FLAG ] )
			{
				send_message( id, CHAT, true, "%L", id, "NO_ACCESS_MENU" );
				menu_destroy( iMenu );
				
				return PLUGIN_HANDLED;
			}
			FreezeMenu( id );
		}
	}
	menu_destroy( iMenu );
	return PLUGIN_HANDLED;
}

GetTeamName( iTeam, szOutput[ ], iSize )
{
	switch( iTeam )
	{
	case TEAM_T:
		{
			copy( szOutput, iSize, "TERRORIST" );
		}

	case TEAM_CT:
		{
			copy( szOutput, iSize, "CT" );
		}

	case TEAM_SPEC:
		{
			copy( szOutput, iSize, "SPECTATOR" );
		}
	}
}
///////////////////////////////////////////////////////////////////// END OF COMMANDS MENU /////////////////////////////////////////////////////////////////////////////////////////////////////////


///////////////////////////////////////////////////////////////////// COMMAND MENUS /////////////////////////////////////////////////////////////////////////////////////////////////////////

@MapMenu( id, iMenu, iItem )
{
	if( iItem == MENU_EXIT )
	{
		menu_destroy( iMenu );
		return PLUGIN_HANDLED;
	}
	
	new iAccess, szMap[ MAX_MAP_NAME_LENGTH ], iCallback;
	menu_item_getinfo( iMenu, iItem, iAccess, szMap, charsmax( szMap ), _, _, iCallback );
	menu_destroy( iMenu );
	
	if( ! is_map_valid( szMap ) )
	{
		CC_SendMessage( id, "%L", id, "MAP_NOT_FOUND" );
		return PLUGIN_HANDLED;
	}
	
	new szName[ MAX_NAME_LENGTH ], szModName[ 10 ];
	get_user_name( id, szName, charsmax( szName ) );
	get_modname( szModName, charsmax( szModName ) );
	
	if( ! equali( szModName, "zp" ) )
	{
		message_begin( MSG_ALL, SVC_INTERMISSION );
		message_end( );
	}
	
	CC_SendMessage( 0, "%L", LANG_PLAYER, "MAP_CHANGE", szName, szMap );
	send_message( 0, LOG, false, "%L", LANG_PLAYER, "MAP_CHANGE", szName, szMap );
	
	set_task( 2.0, "OnMapChange", _, szMap, ( strlen( szMap ) + 1 ) );
	return PLUGIN_HANDLED;
}

@SlapMenu( id, iMenu, iItem )
{
	if( iItem == MENU_EXIT )
	{
		menu_destroy( iMenu );
		return PLUGIN_HANDLED;
	}
	
	new iAccess, szId[ 3 ], iCallback;
	menu_item_getinfo( iMenu, iItem, iAccess, szId, charsmax( szId ), _, _, iCallback );
	menu_destroy( iMenu );
	
	new iPlayer = str_to_num( szId );
	
	if( ! is_user_connected( iPlayer ) )
	{
		CC_SendMessage( id, "%L", id, "PLAYER_NOT_FOUND" );
		return PLUGIN_HANDLED;
	}
	
	if( ! is_user_alive( iPlayer ) )
	{
		send_message( id, CHAT, true, "%L", id, "SLAP_DEAD_PLAYER" );
		return PLUGIN_HANDLED;
	}
	
	new iImmunityLevel = GetImmunityLevel( id );
	new iImmunityLevelTarget = GetImmunityLevel( iPlayer );
	
	if( iImmunityLevel < iImmunityLevelTarget )
	{
		CC_SendMessage( id, "%L", id, "CANT_PERFORM_IMMUNITY" );
		return PLUGIN_HANDLED;
	}
	
	g_iSlap[ id ][ SLAP_ID ] = iPlayer;	
	client_cmd( id, "messagemode slapPlayerValue" );
	
	return PLUGIN_HANDLED;
}

@TeamMenu( id, iMenu, iItem )
{
	if( iItem == MENU_EXIT )
	{
		g_iTeamSwitch[ id ] = 0;
		arrayset( g_szTeamSwitch[ id ], 0, sizeof( g_szTeamSwitch[ ] ) );
		
		menu_destroy( iMenu );
		return PLUGIN_HANDLED;
	}

	new iAccess, szInfo[ 10 ], iCallback;
	menu_item_getinfo( iMenu, iItem, iAccess, szInfo, charsmax( szInfo ), _, _, iCallback );
	menu_destroy( iMenu );
	
	if( equali( szInfo, "switch" ) )
	{
		// if it's TEAM_SPEC (3), reset back to TEAM_T (1), otherwise increase by 1 (TEAM_T becomes TEAM_CT, TEAM_CT becomes TEAM_SPEC)
		switch( g_iTeamSwitch[ id ] )
		{
		case TEAM_T:
			{
				g_iTeamSwitch[ id ] = TEAM_CT;
			}
			
		case TEAM_CT:
			{
				g_iTeamSwitch[ id ] = TEAM_SPEC;
			}
			
		case TEAM_SPEC:
			{
				g_iTeamSwitch[ id ] = TEAM_T;
			}
		}
		
		GetTeamName( g_iTeamSwitch[ id ], g_szTeamSwitch[ id ], charsmax( g_szTeamSwitch[ ] ) );
		TeamMenu( id );
		
		return PLUGIN_HANDLED;
	}
	
	new iPlayer = str_to_num( szInfo );
	
	if( ! is_user_connected( iPlayer ) )
	{
		CC_SendMessage( id, "%L", id, "PLAYER_NOT_FOUND" );
		return PLUGIN_HANDLED;
	}

	new szTeam[ 20 ];
	get_user_team( iPlayer, szTeam, charsmax( szTeam ) );
	
	if( equali( szTeam, g_szTeamSwitch[ id ] ) ) // same team, reopen menu
	{
		TeamMenu( id );
		return PLUGIN_HANDLED;
	}
	
	new iImmunityLevel = GetImmunityLevel( id );
	new iImmunityLevelTarget = GetImmunityLevel( iPlayer );
	
	if( iImmunityLevel < iImmunityLevelTarget )
	{
		CC_SendMessage( id, "%L", id, "CANT_PERFORM_IMMUNITY" );
		return PLUGIN_HANDLED;
	}
	
	new szSteamIdAdmin[ MAX_AUTHID_LENGTH ], szNameAdmin[ MAX_NAME_LENGTH ], szNamePlayer[ MAX_NAME_LENGTH ], szTeamFinal[ 20 ];

	get_user_authid( id, szSteamIdAdmin, charsmax( szSteamIdAdmin ) );
	get_user_name( id, szNameAdmin, charsmax( szNameAdmin ) );
	get_user_name( iPlayer, szNamePlayer, charsmax( szNamePlayer ) );
	
	if( equali( g_szTeamSwitch[ id ], "TERRORIST" ) )
	{
		eas_set_user_team( iPlayer, 1 );
		copy( szTeamFinal, charsmax( szTeamFinal ), "Terrorist" );
	}
	
	else if( equali( g_szTeamSwitch[ id ], "CT" ) )
	{
		eas_set_user_team( iPlayer, 2 );
		copy( szTeamFinal, charsmax( szTeamFinal ), "Counter-Terrorist" );
	}
	
	else if( equali( g_szTeamSwitch[ id ], "SPECTATOR" ) )
	{
		eas_set_user_team( iPlayer, 3 );
		copy( szTeamFinal, charsmax( szTeamFinal ), "Spectator" );
	}
	
	CC_SendMatched( 0, iPlayer, "%L", LANG_PLAYER, "TEAM_CHANGE", szNameAdmin, szNamePlayer, szTeamFinal );
	send_message( 0, LOG, false, "%L", LANG_PLAYER, "TEAM_CHANGE", szNameAdmin, szNamePlayer, szTeamFinal );
	
	TeamMenu( id );
	return PLUGIN_HANDLED;
}

@FreezeMenu( id, iMenu, iItem )
{
	if( iItem == MENU_EXIT )
	{
		menu_destroy( iMenu );
		return PLUGIN_HANDLED;
	}
	
	new iAccess, szId[ 3 ], iCallback;
	menu_item_getinfo( iMenu, iItem, iAccess, szId, charsmax( szId ), _, _, iCallback );
	menu_destroy( iMenu );
	
	new iPlayer = str_to_num( szId );
	
	if( ! is_user_connected( iPlayer ) )
	{
		CC_SendMessage( id, "%L", id, "PLAYER_NOT_FOUND" );
		return PLUGIN_HANDLED;
	}
	
	if( ! is_user_alive( iPlayer ) )
	{
		send_message( id, CHAT, true, "%L", id, "FREEZE_DEAD_PLAYER" );
		return PLUGIN_HANDLED;
	}
	
	new iImmunityLevel = GetImmunityLevel( id );
	new iImmunityLevelTarget = GetImmunityLevel( iPlayer );
	
	if( iImmunityLevel < iImmunityLevelTarget )
	{
		CC_SendMessage( id, "%L", id, "CANT_PERFORM_IMMUNITY" );
		return PLUGIN_HANDLED;
	}
	
	new iValue = g_bFrozen[ iPlayer ] ? 0 : 1;
	FreezePlayer( iPlayer, iValue );

	new szAdminName[ MAX_NAME_LENGTH ], szPlayerName[ MAX_NAME_LENGTH ];
	get_user_name( iPlayer, szPlayerName, charsmax( szPlayerName ) );
	get_user_name( id, szAdminName, charsmax( szAdminName ) );
	
	switch( iValue )
	{
	case 0:
		{
			send_message( 0, LOG, false, "%L", LANG_PLAYER, "FREEZE_UNSET", szAdminName, szPlayerName );
			CC_SendMessage( 0, "%L", LANG_PLAYER, "FREEZE_UNSET", szAdminName, szPlayerName );
		}
		
	case 1:
		{
			send_message( 0, LOG, false, "%L", LANG_PLAYER, "FREEZE_SET", szAdminName, szPlayerName );
			CC_SendMessage( 0, "%L", LANG_PLAYER, "FREEZE_SET", szAdminName, szPlayerName );
		}
	}
	
	FreezeMenu( id );
	return PLUGIN_HANDLED;
}

@SlayMenu( id, iMenu, iItem )
{
	if( iItem == MENU_EXIT )
	{
		menu_destroy( iMenu );
		return PLUGIN_HANDLED;
	}
	
	new iAccess, szId[ 3 ], iCallback;
	menu_item_getinfo( iMenu, iItem, iAccess, szId, charsmax( szId ), _, _, iCallback );
	menu_destroy( iMenu );
	
	new iPlayer = str_to_num( szId );
	
	if( ! is_user_connected( iPlayer ) )
	{
		CC_SendMessage( id, "%L", id, "PLAYER_NOT_FOUND" );
		return PLUGIN_HANDLED;
	}
	
	if( ! is_user_alive( iPlayer ) )
	{
		send_message( id, CHAT, true, "%L", id, "SLAY_DEAD_PLAYER" );
		return PLUGIN_HANDLED;
	}
	
	new iImmunityLevel = GetImmunityLevel( id );
	new iImmunityLevelTarget = GetImmunityLevel( iPlayer );
	
	if( iImmunityLevel < iImmunityLevelTarget )
	{
		CC_SendMessage( id, "%L", id, "CANT_PERFORM_IMMUNITY" );
		return PLUGIN_HANDLED;
	}
	
	g_iSlay[ id ][ SLAY_ID ] = iPlayer;
	client_cmd( id, "messagemode slayPlayerReason" );
	
	return PLUGIN_HANDLED;
}

@UnbanMenu( id, iMenu, iItem )
{
	if( iItem == MENU_EXIT )
	{
		menu_destroy( iMenu );
		return PLUGIN_HANDLED;
	}
	
	new iAccess, szInfo[ 128 ], szName[ MAX_NAME_LENGTH ], szSteamId[ MAX_AUTHID_LENGTH ], szIP[ MAX_IP_LENGTH ], iCallback;
	menu_item_getinfo( iMenu, iItem, iAccess, szInfo, charsmax( szInfo ), _, _, iCallback );
	menu_destroy( iMenu );
	
	parse( szInfo, szName, charsmax( szName ), szSteamId, charsmax( szSteamId ), szIP, charsmax( szIP ) );
	
	trim( szName );
	trim( szSteamId );
	trim( szIP );
	
	UnbanPlayer2( szName, szSteamId, szIP );
	
	new szNameAdmin[ MAX_NAME_LENGTH ];
	get_user_name( id, szNameAdmin, charsmax( szNameAdmin ) );
	
	CC_SendMessage( 0, "%L", LANG_PLAYER, "UNBANNED", szNameAdmin, szName, szSteamId, szIP );		
	send_message( 0, LOG, false, "%L", LANG_PLAYER, "UNBANNED", szNameAdmin, szName, szSteamId, szIP );
	
	if( ArraySize( g_aBans ) )
	{
		UnBanMenu( id );
	}
	
	else
	{
		@CommandsMenu( id );
	}
	return PLUGIN_HANDLED;
}

@UnGagMenu( id, iMenu, iItem )
{
	if( iItem == MENU_EXIT )
	{
		menu_destroy( iMenu );
		return PLUGIN_HANDLED;
	}
	
	new iAccess, szInfo[ 128 ], szName[ MAX_NAME_LENGTH ], szSteamId[ MAX_AUTHID_LENGTH ], szIP[ MAX_IP_LENGTH ], iCallback;
	menu_item_getinfo( iMenu, iItem, iAccess, szInfo, charsmax( szInfo ), _, _, iCallback );
	menu_destroy( iMenu );
	
	parse( szInfo, szName, charsmax( szName ), szSteamId, charsmax( szSteamId ), szIP, charsmax( szIP ) );
	
	trim( szName );
	trim( szSteamId );
	trim( szIP );
	
	UnGagPlayer2( szName, szSteamId, szIP );
	
	new szNameAdmin[ MAX_NAME_LENGTH ];
	get_user_name( id, szNameAdmin, charsmax( szNameAdmin ) );
	
	CC_SendMessage( 0, "%L", LANG_PLAYER, "UNGAGGED", szNameAdmin, szName, szSteamId, szIP );
	send_message( 0, LOG, false, "%L", LANG_PLAYER, "UNGAGGED", szNameAdmin, szName, szSteamId, szIP );
	
	if( ArraySize( g_aGags ) )
	{
		UnGagMenu( id );
	}
	
	else
	{
		@CommandsMenu( id );
	}
	return PLUGIN_HANDLED;
}

@AddBanMenu( id, iMenu, iItem )
{
	if( iItem == MENU_EXIT )
	{
		menu_destroy( iMenu );
		return PLUGIN_HANDLED;
	}
	
	switch( iItem )
	{
	case 0:
		{
			client_cmd( id, "messagemode addBanPlayerName" );
		}
	}
	menu_destroy( iMenu );
	return PLUGIN_HANDLED;
}

@AddGagMenu( id, iMenu, iItem )
{
	if( iItem == MENU_EXIT )
	{
		menu_destroy( iMenu );
		return PLUGIN_HANDLED;
	}
	
	else if( iItem == 0 )
	{
		client_cmd( id, "messagemode addgagPlayerName" );
	}
	menu_destroy( iMenu );
	return PLUGIN_HANDLED;
}

@KickMenu( id, iMenu, iItem )
{
	if( iItem == MENU_EXIT )
	{
		menu_destroy( iMenu );
		return PLUGIN_HANDLED;
	}
	
	new iAccess, szId[ 3 ], iCallback;
	menu_item_getinfo( iMenu, iItem, iAccess, szId, charsmax( szId ), _, _, iCallback );
	menu_destroy( iMenu );
	
	new iPlayer = str_to_num( szId );
	
	if( ! is_user_connected( iPlayer ) )
	{
		CC_SendMessage( id, "%L", id, "PLAYER_NOT_FOUND" );
		return PLUGIN_HANDLED;
	}
	
	new iImmunityLevel = GetImmunityLevel( id );
	new iImmunityLevelTarget = GetImmunityLevel( iPlayer );
	
	if( iImmunityLevel < iImmunityLevelTarget )
	{
		CC_SendMessage( id, "%L", id, "CANT_PERFORM_IMMUNITY" );
		return PLUGIN_HANDLED;
	}
	
	g_iKick[ id ] = iPlayer;
	client_cmd( id, "messagemode kickReason" );

	return PLUGIN_HANDLED;
}

@BanMenu( id, iMenu, iItem )
{
	if( iItem == MENU_EXIT )
	{
		menu_destroy( iMenu );
		return PLUGIN_HANDLED;
	}
	
	new iAccess, szId[ 3 ], iCallback;
	menu_item_getinfo( iMenu, iItem, iAccess, szId, charsmax( szId ), _, _, iCallback );
	menu_destroy( iMenu );
	
	new iPlayer = str_to_num( szId );
	
	if( ! is_user_connected( iPlayer ) )
	{
		CC_SendMessage( id, "%L", id, "PLAYER_NOT_FOUND" );
		return PLUGIN_HANDLED;
	}
	
	new iImmunityLevel = GetImmunityLevel( id );
	new iImmunityLevelTarget = GetImmunityLevel( iPlayer );
	
	if( iImmunityLevel < iImmunityLevelTarget )
	{
		CC_SendMessage( id, "%L", id, "CANT_PERFORM_IMMUNITY" );
		return PLUGIN_HANDLED;
	}
	
	g_iBan[ id ][ BAN_ID ] = iPlayer;
	client_cmd( id, "messagemode banPlayerMinutes" );

	return PLUGIN_HANDLED;
}

@GagMenu( id, iMenu, iItem )
{
	if( iItem == MENU_EXIT )
	{
		menu_destroy( iMenu );
		return PLUGIN_HANDLED;
	}
	
	new iAccess, szId[ 3 ], iCallback;
	menu_item_getinfo( iMenu, iItem, iAccess, szId, charsmax( szId ), _, _, iCallback );
	menu_destroy( iMenu );
	
	new iPlayer = str_to_num( szId );
	
	if( ! is_user_connected( iPlayer ) )
	{
		CC_SendMessage( id, "%L", id, "PLAYER_NOT_FOUND" );
		return PLUGIN_HANDLED;
	}
	
	new iImmunityLevel = GetImmunityLevel( id );
	new iImmunityLevelTarget = GetImmunityLevel( iPlayer );
	
	if( iImmunityLevel < iImmunityLevelTarget )
	{
		CC_SendMessage( id, "%L", id, "CANT_PERFORM_IMMUNITY" );
		return PLUGIN_HANDLED;
	}
	
	g_iGag[ id ][ GAG_ID ] = iPlayer;
	client_cmd( id, "messagemode gagPlayerSeconds" );

	return PLUGIN_HANDLED;
}

///////////////////////////////////////////////////////////////////// END OF COMMAND MENUS /////////////////////////////////////////////////////////////////////////////////////////////////////////


///////////////////////////////////////////////////////////////////// CONSOLE COMMANDS /////////////////////////////////////////////////////////////////////////////////////////////////////////////

@ExtendGag( id )
{
	if( ~ get_user_flags( id ) & g_iConfig[ GAG_FLAG ] )
	{
		send_message( id, CONSOLE, true, "%L", id, "NO_ACCESS_COMMAND" );
		return PLUGIN_HANDLED;
	}
	
	new szName[ MAX_NAME_LENGTH ], szSeconds[ 8 ];
	read_argv( 1, szName, charsmax( szName ) );
	read_argv( 2, szSeconds, charsmax( szSeconds ) );
	
	if( read_argc( ) != 3 )
	{
		send_message( id, CONSOLE, true, "%L", id, "AMX_EXTEND_GAG_USAGE" );
		return PLUGIN_HANDLED;
	}
	
	new iPlayer = cmd_target( id, szName, CMDTARGET_NO_BOTS );
	
	if( ! iPlayer )
	{
		send_message( id, CONSOLE, true, "%L", id, "PLAYER_NOT_FOUND" );
		return PLUGIN_HANDLED;
	}
	
	new iImmunityLevel = GetImmunityLevel( id );
	new iImmunityLevelTarget = GetImmunityLevel( iPlayer );
	
	if( iImmunityLevel < iImmunityLevelTarget )
	{
		send_message( id, CONSOLE, true, "%L", id, "CANT_PERFORM_IMMUNITY" );
		return PLUGIN_HANDLED;
	}
	
	if( !IsGagged( id ) )
	{
		send_message( id, CONSOLE, true, "%L", id, "PLAYER_NOT_GAGGED" );
		return PLUGIN_HANDLED;
	}
	
	new iSeconds = str_to_num( szSeconds );
	
	new eData[ PlayerGag ];
	for( new i; i < ArraySize( g_aGags ); i++ )
	{
		ArrayGetArray( g_aGags, i, eData );
		
		if( equali( szName, eData[ Player_Name ] ) )
		{
			AddSecondsToDate( eData[ Player_GagExpire ], iSeconds, eData[ Player_GagExpire ], charsmax( eData[ Player_GagExpire ] ) );
			
			ArraySetArray( g_aGags, i, eData );
			UpdateGagExpireDate( eData[ Player_Name ], eData[ Player_GagExpire ] );
			
			break;
		}
	}
	
	new szPlayerName[ MAX_NAME_LENGTH ], szAdminName[ MAX_NAME_LENGTH ];
	get_user_name( iPlayer, szPlayerName, charsmax( szPlayerName ) );
	get_user_name( iPlayer, szAdminName, charsmax( szAdminName ) );
	
	send_message( id, CONSOLE, true, "%L", id, "EXTENDED_GAG", szPlayerName, iSeconds );
	send_message( id, LOG, true, "%L", id, "EXTENDED_GAG_LOG", szAdminName, szPlayerName, iSeconds );
	
	CC_SendMessage( 0, "%L", id, "EXTENDED_GAG_CHAT", szAdminName, szPlayerName, iSeconds );
	
	return PLUGIN_HANDLED;
}

@ReduceGag( id )
{
	if( ~ get_user_flags( id ) & g_iConfig[ GAG_FLAG ] )
	{
		send_message( id, CONSOLE, true, "%L", id, "NO_ACCESS_COMMAND" );
		return PLUGIN_HANDLED;
	}
	
	new szName[ MAX_NAME_LENGTH ], szSeconds[ 8 ];
	read_argv( 1, szName, charsmax( szName ) );
	read_argv( 2, szSeconds, charsmax( szSeconds ) );
	
	if( read_argc( ) != 3 )
	{
		send_message( id, CONSOLE, true, "%L", id, "AMX_REDUCE_GAG_USAGE" );
		return PLUGIN_HANDLED;
	}
	
	new iPlayer = cmd_target( id, szName, CMDTARGET_NO_BOTS );
	
	if( ! iPlayer )
	{
		send_message( id, CONSOLE, true, "%L", id, "PLAYER_NOT_FOUND" );
		return PLUGIN_HANDLED;
	}
	
	new iImmunityLevel = GetImmunityLevel( id );
	new iImmunityLevelTarget = GetImmunityLevel( iPlayer );
	
	if( iImmunityLevel < iImmunityLevelTarget )
	{
		send_message( id, CONSOLE, true, "%L", id, "CANT_PERFORM_IMMUNITY" );
		return PLUGIN_HANDLED;
	}
	
	if( !IsGagged( id ) )
	{
		send_message( id, CONSOLE, true, "%L", id, "PLAYER_NOT_GAGGED" );
		return PLUGIN_HANDLED;
	}
	
	new iSeconds = str_to_num( szSeconds );
	
	new eData[ PlayerGag ];
	for( new i; i < ArraySize( g_aGags ); i++ )
	{
		ArrayGetArray( g_aGags, i, eData );
		
		if( equali( szName, eData[ Player_Name ] ) )
		{
			RemoveSecondsFromDate( eData[ Player_GagExpire ], iSeconds, eData[ Player_GagExpire ], charsmax( eData[ Player_GagExpire ] ) );
			
			ArraySetArray( g_aGags, i, eData );
			UpdateGagExpireDate( eData[ Player_Name ], eData[ Player_GagExpire ] );
			
			break;
		}
	}
	
	new szPlayerName[ MAX_NAME_LENGTH ], szAdminName[ MAX_NAME_LENGTH ];
	get_user_name( iPlayer, szPlayerName, charsmax( szPlayerName ) );
	get_user_name( iPlayer, szAdminName, charsmax( szAdminName ) );
	
	send_message( id, CONSOLE, true, "%L", id, "REDUCED_GAG", iSeconds, szPlayerName );
	send_message( id, LOG, true, "%L", id, "REDUCED_GAG_LOG", szAdminName, iSeconds, szPlayerName );
	
	CC_SendMessage( 0, "%L", id, "REDUCED_GAG_CHAT", szAdminName, iSeconds, szPlayerName );
	
	return PLUGIN_HANDLED;
}

@Gag( id )
{
	if( ~ get_user_flags( id ) & g_iConfig[ GAG_FLAG ] )
	{
		send_message( id, CONSOLE, true, "%L", id, "NO_ACCESS_COMMAND" );
		return PLUGIN_HANDLED;
	}

	new szName[ MAX_NAME_LENGTH ], szReason[ MAX_REASON_LENGTH ], szSeconds[ 8 ], szFlags[ 5 ];
	read_argv( 1, szName, charsmax( szName ) );
	read_argv( 2, szSeconds, charsmax( szSeconds ) );
	read_argv( 3, szReason, charsmax( szReason ) );
	read_argv( 4, szFlags, charsmax( szFlags ) );
	
	if( read_argc( ) != 5 )
	{
		send_message( id, CONSOLE, true, "%L", id, "AMX_GAG_USAGE" );
		return PLUGIN_HANDLED;
	}
	
	new iPlayer = cmd_target( id, szName, CMDTARGET_NO_BOTS );
	
	if( ! iPlayer )
	{
		send_message( id, CONSOLE, true, "%L", id, "PLAYER_NOT_FOUND" );
		return PLUGIN_HANDLED;
	}
	
	new iImmunityLevel = GetImmunityLevel( id );
	new iImmunityLevelTarget = GetImmunityLevel( iPlayer );
	
	if( iImmunityLevel < iImmunityLevelTarget )
	{
		send_message( id, CONSOLE, true, "%L", id, "CANT_PERFORM_IMMUNITY" );
		return PLUGIN_HANDLED;
	}
	
	if( IsGagged( id ) )
	{
		send_message( id, CONSOLE, true, "%L", id, "PLAYER_ALREADY_GAGGED" );
		return PLUGIN_HANDLED;
	}
	
	new szSteamIdUser[ MAX_AUTHID_LENGTH ], szExpireDate[ MAX_DATE_LENGTH ], szIpUser[ MAX_IP_LENGTH ], szNameAdmin[ MAX_NAME_LENGTH ], szNameUser[ MAX_NAME_LENGTH ];
	
	get_user_ip( iPlayer, szIpUser, charsmax( szIpUser ), 1 );
	get_user_authid( iPlayer, szSteamIdUser, charsmax( szSteamIdUser ) );
	get_user_name( id, szNameAdmin, charsmax( szNameAdmin ) );
	get_user_name( iPlayer, szNameUser, charsmax( szNameUser ) );

	new iSeconds = str_to_num( szSeconds );
	
	if( iSeconds == 0 )
	{
		CC_SendMessage( 0, "%L", LANG_PLAYER, "GAGGED_PERMANENT", szNameAdmin, szNameUser, szFlags, szReason );
		send_message( 0, LOG, false, "%L", LANG_PLAYER, "LOG_GAGGED_PERMANENT", szNameAdmin, szNameUser, szSteamIdUser, szIpUser, szReason, szFlags );
		
		copy( szExpireDate, charsmax( szExpireDate ), "never" );
	}
	
	else
	{
		get_time( "%m/%d/%Y - %H:%M:%S", szExpireDate, charsmax( szExpireDate ) );
		
		AddSecondsToDate( szExpireDate, iSeconds, szExpireDate, charsmax( szExpireDate ) );
		
		if( iSeconds == 1 )
		{
			CC_SendMessage( 0, "%L", LANG_PLAYER, "GAGGED_SINGULAR", szNameAdmin, szNameUser, szReason, szFlags );
			send_message( 0, LOG, false, "%L", LANG_PLAYER, "LOG_GAGGED_SINGULAR", szNameAdmin, szNameUser, szSteamIdUser, szIpUser, szReason, szExpireDate, szFlags );
		}
		
		else
		{
			CC_SendMessage( 0, "%L", LANG_PLAYER, "GAGGED_PLURAL", szNameAdmin, szNameUser, iSeconds, szReason, szFlags );
			send_message( 0, LOG, false, "%L", LANG_PLAYER, "LOG_GAGGED_PLURAL", szNameAdmin, szNameUser, szSteamIdUser, szIpUser, iSeconds, szReason, szExpireDate, szFlags );
		}
	}
	
	trim( szNameUser );
	trim( szSteamIdUser );
	trim( szIpUser );
	trim( szExpireDate );
	trim( szReason );
	trim( szNameAdmin );
	
	new eData[ PlayerGag ];	
	copy( eData[ Player_Name ], charsmax( eData[ Player_Name ] ), szNameUser );
	copy( eData[ Player_SteamId ], charsmax( eData[ Player_SteamId ] ), szSteamIdUser );
	copy( eData[ Player_IP ], charsmax( eData[ Player_IP ] ), szIpUser );
	copy( eData[ Player_GagExpire ], charsmax( eData[ Player_GagExpire ] ), szExpireDate );
	copy( eData[ Player_GagReason ], charsmax( eData[ Player_GagReason ] ), szReason );
	copy( eData[ Player_GagFlags ], charsmax( eData[ Player_GagFlags ] ), szFlags );
	copy( eData[ Player_GaggedBy ], charsmax( eData[ Player_GaggedBy ] ), szNameAdmin );
	
	ArrayPushArray( g_aGags, eData );
	
	if( ( szFlags[ 0 ] == 'v' || szFlags[ 1 ] == 'v' ) && is_user_connected( iPlayer ) )
	{
		set_speak( iPlayer, SPEAK_MUTED );
	}
	
	GagPlayer( szNameUser, szSteamIdUser, szIpUser, szReason, szFlags, szExpireDate, szNameAdmin );
	
	return PLUGIN_HANDLED;
}

@UnGag( id )
{
	if( ~ get_user_flags( id ) & g_iConfig[ UNGAG_FLAG ] )
	{
		send_message( id, CONSOLE, true, "%L", id, "NO_ACCESS_COMMAND" );
		return PLUGIN_HANDLED;
	}
	
	new szIdentity[ MAX_AUTHID_LENGTH ];
	read_argv( 1, szIdentity, charsmax( szIdentity ) );
	
	if( read_argc( ) != 2 )
	{
		send_message( id, CONSOLE, true, "%L", id, "AMX_UNGAG_USAGE" );
		return PLUGIN_HANDLED;
	}
	
	ReadGags( );
	
	new eData[ PlayerGag ], bool:bFoundPlayer;
	for( new i; i < ArraySize( g_aGags ); i++ )
	{
		ArrayGetArray( g_aGags, i, eData );
		
		if( equali( szIdentity, eData[ Player_Name ] ) || equali( szIdentity, eData[ Player_SteamId ] ) || equali( szIdentity, eData[ Player_IP ] ) )
		{
			UnGagPlayer( szIdentity );
			
			new szNameAdmin[ MAX_NAME_LENGTH ];
			get_user_name( id, szNameAdmin, charsmax( szNameAdmin ) );
			
			CC_SendMessage( 0, "%L", LANG_PLAYER, "UNGAGGED", szNameAdmin, eData[ Player_Name ] );
			
			send_message( 0, LOG, false, "%L", LANG_PLAYER, "UNGAGGED", szNameAdmin, eData[ Player_Name ] );
			bFoundPlayer = true;
			
			break;
		}
	}
	
	if( ! bFoundPlayer )
	{
		send_message( id, CONSOLE, true, "%L", id, "PLAYER_NOT_FOUND" );
	}
	
	return PLUGIN_HANDLED;
}

@AdminSay( id )
{
	if( ~ get_user_flags( id ) & g_iConfig[ SAY_FLAG ] )
	{
		send_message( id, CONSOLE, true, "%L", id, "NO_ACCESS_COMMAND" );
		return PLUGIN_HANDLED;
	}
	
	new szText[ MAX_TEXT_LENGTH ];
	read_args( szText, charsmax( szText ) );

	trim( szText );
	remove_quotes( szText );
	
	if( ! szText[ 0 ] )
	{
		send_message( id, CONSOLE, true, "%L", id, "EMPTY_STRING" );
		return PLUGIN_HANDLED;
	}
	
	new szName[ MAX_NAME_LENGTH ];
	get_user_name( id, szName, charsmax( szName ) );
	
	CC_SendMessage( 0, "&x00&x04%s : &x04%s", szName, szText );
	return PLUGIN_HANDLED;
}

@AdminChat( id )
{
	if( ~ get_user_flags( id ) & g_iConfig[ CHAT_FLAG ] )
	{
		send_message( id, CONSOLE, true, "%L", id, "NO_ACCESS_COMMAND" );
		return PLUGIN_HANDLED;
	}
	
	new szText[ MAX_TEXT_LENGTH ];
	read_args( szText, charsmax( szText ) );

	trim( szText );
	remove_quotes( szText );
	
	if( ! szText[ 0 ] )
	{
		send_message( id, CONSOLE, true, "%L", id, "EMPTY_STRING" );
		return PLUGIN_HANDLED;
	}
	
	new szName[ MAX_NAME_LENGTH ];
	get_user_name( id, szName, charsmax( szName ) );
	
	new iPlayers[ 32 ], iNum, iTempId;
	get_players( iPlayers, iNum, "ch" );
	
	for( new i; i < iNum; i++ )
	{
		iTempId = iPlayers[ i ];
		
		if( get_user_flags( iTempId ) & g_iConfig[ CHAT_FLAG ] )
		{
			CC_SendMessage( iTempId, "&x00&x04(CHAT) &x03%s &x04: &x01%s", szName, szText );
		}
	}
	return PLUGIN_HANDLED;
}

@Warn( id )
{
	if( ~ get_user_flags( id ) & g_iConfig[ WARN_FLAG ] )
	{
		send_message( id, CONSOLE, true, "%L", id, "NO_ACCESS_COMMAND" );
		return PLUGIN_HANDLED;
	}
	
	new szName[ MAX_NAME_LENGTH ], szReason[ MAX_REASON_LENGTH ];
	read_argv( 1, szName, charsmax( szName ) );
	read_argv( 2, szReason, charsmax( szReason ) );
	
	if( read_argc( ) != 3 )
	{
		send_message( id, CONSOLE, true, "%L", id, "AMX_WARN_USAGE" );
		return PLUGIN_HANDLED;
	}
	
	new iPlayer = cmd_target( id, szName, CMDTARGET_NO_BOTS );
	
	if( ! is_user_connected( iPlayer ) )
	{
		send_message( id, CONSOLE, true, "%L", id, "PLAYER_NOT_FOUND" );
		return PLUGIN_HANDLED;
	}
	
	new iImmunityLevel = GetImmunityLevel( id );
	new iImmunityLevelTarget = GetImmunityLevel( iPlayer );
	
	if( iImmunityLevel < iImmunityLevelTarget )
	{
		send_message( id, CONSOLE, true, "%L", id, "CANT_PERFORM_IMMUNITY" );
		return PLUGIN_HANDLED;
	}
	
	new szAdminSteamId[ MAX_AUTHID_LENGTH ], szAdminName[ MAX_NAME_LENGTH ], szPlayerName[ MAX_NAME_LENGTH ];
	get_user_name( iPlayer, szPlayerName, charsmax( szPlayerName ) );
	get_user_name( id, szAdminName, charsmax( szAdminName ) );
	get_user_authid( id, szAdminSteamId, charsmax( szAdminSteamId ) );
	
	send_message( 0, LOG, false, "%L", LANG_PLAYER, "WARN_OTHERS", szAdminName, szPlayerName, szReason );
	
	new iPlayers[ MAX_PLAYERS ], iNum, iTempId;
	get_players( iPlayers, iNum, "ch" );
	
	CC_SendMessage( iPlayer, "%L", iPlayer, "WARN_HIM", szAdminName, szReason );
	
	for( new i; i < iNum; i++ )
	{
		iTempId = iPlayers[ i ];
		
		if( iTempId != iPlayer )
		{
			CC_SendMessage( iTempId, "%L", iTempId, "WARN_OTHERS", szAdminName, szPlayerName, szReason );
		}
	}
	
	return PLUGIN_HANDLED;
}

@Noclip( id )
{
	if( ~ get_user_flags( id ) & g_iConfig[ NOCLIP_FLAG ] )
	{
		send_message( id, CONSOLE, true, "%L", id, "NO_ACCESS_COMMAND" );
		return PLUGIN_HANDLED;
	}
	
	new szName[ MAX_NAME_LENGTH ], szValue[ 3 ];
	read_argv( 1, szName, charsmax( szName ) );
	read_argv( 2, szValue, charsmax( szValue ) );
	
	if( read_argc( ) != 3 )
	{
		send_message( id, CONSOLE, true, "%L", id, "AMX_NOCLIP_USAGE" );
		return PLUGIN_HANDLED;
	}
	
	new iPlayer = cmd_target( id, szName, CMDTARGET_ALLOW_SELF );
	
	if( ! is_user_connected( iPlayer ) )
	{
		send_message( id, CONSOLE, true, "%L", id, "PLAYER_NOT_FOUND" );
		return PLUGIN_HANDLED;
	}
	
	if( ! is_user_alive( iPlayer ) )
	{
		send_message( id, CONSOLE, true, "%L", id, "NOCLIP_DEAD_PLAYER" );
		return PLUGIN_HANDLED;
	}
	
	new iImmunityLevel = GetImmunityLevel( id );
	new iImmunityLevelTarget = GetImmunityLevel( iPlayer );
	
	if( iImmunityLevel < iImmunityLevelTarget )
	{
		send_message( id, CONSOLE, true, "%L", id, "CANT_PERFORM_IMMUNITY" );
		return PLUGIN_HANDLED;
	}
	
	new iValue = str_to_num( szValue );
	
	if( iValue < 0 || iValue > 1 )
	{
		send_message( id, CONSOLE, true, "%L", id, "INVALID_NOCLIP_VALUE" );
		return PLUGIN_HANDLED;
	}
	
	set_user_noclip( iPlayer, iValue );
	
	new szAdminSteamId[ MAX_AUTHID_LENGTH ], szAdminName[ MAX_NAME_LENGTH ], szPlayerName[ MAX_NAME_LENGTH ];
	get_user_name( iPlayer, szPlayerName, charsmax( szPlayerName ) );
	get_user_name( id, szAdminName, charsmax( szAdminName ) );
	get_user_authid( id, szAdminSteamId, charsmax( szAdminSteamId ) );

	switch( iValue )
	{
	case 0:
		{
			send_message( 0, LOG, false, "%L", LANG_PLAYER, "NOCLIP_UNSET", szAdminName, szPlayerName );
			CC_SendMessage( 0, "%L", LANG_PLAYER, "NOCLIP_UNSET", szAdminName, szPlayerName );
		}
		
	case 1:
		{
			send_message( 0, LOG, false, "%L", LANG_PLAYER, "NOCLIP_SET", szAdminName, szPlayerName );
			CC_SendMessage( 0, "%L", LANG_PLAYER, "NOCLIP_SET", szAdminName, szPlayerName );
		}
	}
	
	return PLUGIN_HANDLED;
}

@Godmode( id )
{
	if( ~ get_user_flags( id ) & g_iConfig[ GODMODE_FLAG ] )
	{
		send_message( id, CONSOLE, true, "%L", id, "NO_ACCESS_COMMAND" );
		return PLUGIN_HANDLED;
	}
	
	new szName[ MAX_NAME_LENGTH ], szValue[ 3 ];
	read_argv( 1, szName, charsmax( szName ) );
	read_argv( 2, szValue, charsmax( szValue ) );
	
	if( read_argc( ) != 3 )
	{
		send_message( id, CONSOLE, true, "%L", id, "AMX_GODMODE_USAGE" );
		return PLUGIN_HANDLED;
	}
	
	new iPlayer = cmd_target( id, szName, CMDTARGET_ALLOW_SELF );
	
	if( ! is_user_connected( iPlayer ) )
	{
		send_message( id, CONSOLE, true, "%L", id, "PLAYER_NOT_FOUND" );
		return PLUGIN_HANDLED;
	}
	
	if( ! is_user_alive( iPlayer ) )
	{
		send_message( id, CHAT, true, "%L", id, "GODMODE_DEAD_PLAYER" );
		return PLUGIN_HANDLED;
	}
	
	new iImmunityLevel = GetImmunityLevel( id );
	new iImmunityLevelTarget = GetImmunityLevel( iPlayer );
	
	if( iImmunityLevel < iImmunityLevelTarget )
	{
		send_message( id, CONSOLE, true, "%L", id, "CANT_PERFORM_IMMUNITY" );
		return PLUGIN_HANDLED;
	}
	
	new iValue = str_to_num( szValue );
	
	if( iValue < 0 || iValue > 1 )
	{
		send_message( id, CONSOLE, true, "%L", id, "INVALID_GODMODE_VALUE" );
		return PLUGIN_HANDLED;
	}
	
	set_user_godmode( iPlayer, iValue );
	
	new szAdminSteamId[ MAX_AUTHID_LENGTH ], szAdminName[ MAX_NAME_LENGTH ], szPlayerName[ MAX_NAME_LENGTH ];
	get_user_name( iPlayer, szPlayerName, charsmax( szPlayerName ) );
	get_user_name( id, szAdminName, charsmax( szAdminName ) );
	get_user_authid( id, szAdminSteamId, charsmax( szAdminSteamId ) );

	switch( iValue )
	{
	case 0:
		{
			send_message( 0, LOG, false, "%L", LANG_PLAYER, "GODMODE_UNSET", szAdminName, szPlayerName );
			CC_SendMessage( 0, "%L", LANG_PLAYER, "GODMODE_UNSET", szAdminName, szPlayerName );
		}
		
	case 1:
		{
			send_message( 0, LOG, false, "%L", LANG_PLAYER, "GODMODE_SET", szAdminName, szPlayerName );
			CC_SendMessage( 0, "%L", LANG_PLAYER, "GODMODE_SET", szAdminName, szPlayerName );
		}
	}
	
	return PLUGIN_HANDLED;
}

@Freeze( id )
{
	if( ~ get_user_flags( id ) & g_iConfig[ FREEZE_FLAG ] )
	{
		send_message( id, CONSOLE, true, "%L", id, "NO_ACCESS_COMMAND" );
		return PLUGIN_HANDLED;
	}
	
	new szName[ MAX_NAME_LENGTH ], szValue[ 3 ];
	read_argv( 1, szName, charsmax( szName ) );
	read_argv( 2, szValue, charsmax( szValue ) );
	
	if( read_argc( ) != 3 )
	{
		send_message( id, CONSOLE, true, "%L", id, "AMX_FREEZE_USAGE" );
		return PLUGIN_HANDLED;
	}
	
	new iPlayer = cmd_target( id, szName, CMDTARGET_ALLOW_SELF );
	
	if( ! is_user_connected( iPlayer ) )
	{
		send_message( id, CONSOLE, true, "%L", id, "PLAYER_NOT_FOUND" );
		return PLUGIN_HANDLED;
	}
	
	if( ! is_user_alive( iPlayer ) )
	{
		send_message( id, CHAT, true, "%L", id, "FREEZE_DEAD_PLAYER" );
		return PLUGIN_HANDLED;
	}
	
	new iImmunityLevel = GetImmunityLevel( id );
	new iImmunityLevelTarget = GetImmunityLevel( iPlayer );
	
	if( iImmunityLevel < iImmunityLevelTarget )
	{
		send_message( id, CONSOLE, true, "%L", id, "CANT_PERFORM_IMMUNITY" );
		return PLUGIN_HANDLED;
	}
	
	new iValue = str_to_num( szValue );
	
	if( iValue < 0 || iValue > 1 )
	{
		send_message( id, CONSOLE, true, "%L", id, "INVALID_FREEZE_VALUE" );
		return PLUGIN_HANDLED;
	}
	
	FreezePlayer( iPlayer, iValue );
	
	new szAdminName[ MAX_NAME_LENGTH ], szPlayerName[ MAX_NAME_LENGTH ];
	get_user_name( iPlayer, szPlayerName, charsmax( szPlayerName ) );
	get_user_name( id, szAdminName, charsmax( szAdminName ) );
	
	switch( iValue )
	{
	case 0:
		{
			send_message( 0, LOG, false, "%L", LANG_PLAYER, "FREEZE_UNSET", szAdminName, szPlayerName );
			CC_SendMessage( 0, "%L", LANG_PLAYER, "FREEZE_UNSET", szAdminName, szPlayerName );
		}
		
	case 1:
		{
			send_message( 0, LOG, false, "%L", LANG_PLAYER, "FREEZE_SET", szAdminName, szPlayerName );
			CC_SendMessage( 0, "%L", LANG_PLAYER, "FREEZE_SET", szAdminName, szPlayerName );
		}
	}
	
	return PLUGIN_HANDLED;
}

@Screenshot( id )
{
	if( ~ get_user_flags( id ) & g_iConfig[ SCREENSHOT_FLAG ] )
	{
		send_message( id, CONSOLE, true, "%L", id, "NO_ACCESS_COMMAND" );
		return PLUGIN_HANDLED;
	}
	
	new szName[ MAX_NAME_LENGTH ];
	read_argv( 1, szName, charsmax( szName ) );
	
	if( read_argc( ) != 2 )
	{
		send_message( id, CONSOLE, true, "%L", id, "AMX_SCREENSHOT_USAGE" );
		return PLUGIN_HANDLED;
	}
	
	new iPlayer = cmd_target( id, szName, CMDTARGET_ALLOW_SELF );
	
	if( ! iPlayer )
	{
		send_message( id, CONSOLE, true, "%L", id, "PLAYER_NOT_FOUND" );
		return PLUGIN_HANDLED;
	}
	
	new iImmunityLevel = GetImmunityLevel( id );
	new iImmunityLevelTarget = GetImmunityLevel( iPlayer );
	
	if( iImmunityLevel < iImmunityLevelTarget )
	{
		send_message( id, CONSOLE, true, "%L", id, "CANT_PERFORM_IMMUNITY" );
		return PLUGIN_HANDLED;
	}
	
	ScreenShot( iPlayer );
	
	new szAdminSteamId[ MAX_AUTHID_LENGTH ], szAdminName[ MAX_NAME_LENGTH ], szPlayerName[ MAX_NAME_LENGTH ];
	get_user_name( iPlayer, szPlayerName, charsmax( szPlayerName ) );
	get_user_name( id, szAdminName, charsmax( szAdminName ) );
	get_user_authid( id, szAdminSteamId, charsmax( szAdminSteamId ) );

	send_message( 0, LOG, false, "%L", LANG_PLAYER, "SCREENSHOT", szAdminName, szAdminSteamId, szPlayerName );
	CC_SendMessage( 0, "%L", LANG_PLAYER, "SCREENSHOT", szAdminName, szPlayerName );
	
	return PLUGIN_HANDLED;
}

@Help( id )
{
	new szArg1[ 8 ], iFlags = get_user_flags( id );
	new iStart = read_argv( 1, szArg1, 7 ) ? str_to_num( szArg1 ) : 1;
	new iHelpAmount = 10;
	
	// HACK: ADMIN_ADMIN is never set as a user's actual flags, so those types of commands never show
	if( iFlags > 0 && !( iFlags & ADMIN_USER ) )
	{
		iFlags |= ADMIN_ADMIN;
	}
	
	if( id == 0 && read_argc( ) == 3 )
	iHelpAmount = read_argv( 2, szArg1, 7 ) ? str_to_num( szArg1 ) : 10;

	if( --iStart < 0 )
	iStart = 0;

	new iClcmdNum = get_concmdsnum( iFlags, id );

	if( iStart >= iClcmdNum )
	iStart = iClcmdNum - 1;

	console_print( id, "^n----- %L -----", id, "HELP_COMS" );
	
	new szInfo[ 128 ], szCmd[ 32 ], eFlags;
	new iEnd = iStart + iHelpAmount // HELPAMOUNT

	if( iEnd > iClcmdNum )
	iEnd = iClcmdNum;

	for( new i = iStart; i < iEnd; i++ )
	{
		get_concmd( i, szCmd, charsmax( szCmd ), eFlags, szInfo, charsmax( szInfo ), iFlags, id );
		console_print( id, "%3d: %s %s", i + 1, szCmd, szInfo );
	}
	
	console_print( id, "----- %L -----", id, "HELP_ENTRIES", iStart + 1, iEnd, iClcmdNum );

	if( iEnd < iClcmdNum )
	console_print( id, "----- %L -----", id, "HELP_USE_MORE", iEnd + 1 );
	
	else
	console_print( id, "----- %L -----", id, "HELP_USE_BEGIN" );

	return PLUGIN_HANDLED;
}

@Plugins( id )
{
	if( ~ get_user_flags( id ) & g_iConfig[ PLUGINS_FLAG ] )
	{
		send_message( id, CONSOLE, true, "%L", id, "NO_ACCESS_COMMAND" );
		return PLUGIN_HANDLED;
	}
	
	if( id == 0 ) // If server executes redirect this to "amxx plugins" for more in depth output
	{
		server_cmd( "amxx plugins" );
		server_exec( );
		
		return PLUGIN_HANDLED;
	}

	new szName[ MAX_NAME_LENGTH ], szVersion[ 8 ], szAuthor[ MAX_NAME_LENGTH ], szFileName[ 64 ], szStatus[ 32 ];
	new iStartId, iEndId;

	new szTemp[ 128 ];

	new iNum = get_pluginsnum( );
	
	if( read_argc( ) > 1 )
	{
		read_argv( 1, szTemp, charsmax( szTemp ) );
		iStartId = str_to_num( szTemp ) - 1; // zero-based
	}

	iEndId = min( iStartId + 10, iNum );
	
	new iRunning;
	
	console_print( id, "%L", id, "CURRENTLY_LOADED" );
	
	new i = iStartId;
	
	while( i < iEndId )
	{
		get_plugin( i++, szFileName, charsmax( szFileName ), szName, charsmax( szName ), szVersion, charsmax( szVersion ), szAuthor, charsmax( szAuthor ), szStatus, charsmax( szStatus ) );
		console_print( id, "%-18.17s %-11.10s %-17.16s %-16.15s %-9.8s", szName, szVersion, szAuthor, szFileName, szStatus );
		
		if( szStatus[ 0 ] == 'd' || szStatus[ 0 ] == 'r') // "debug" or "running"
		{
			iRunning++;
		}
	}
	console_print( id, "%d %L, %d %L", iEndId-iStartId, id, "PLUGINS", iRunning, id, "RUNNING" );
	console_print( id, "----- Entries %d - %d of %d -----", iStartId + 1, iEndId, iNum );
	
	if( iEndId < iNum )
	{
		formatex( szTemp, charsmax( szTemp ),"----- %L -----", id, "HELP_USE_MORE", iEndId + 1);
		replace_all( szTemp, charsmax( szTemp ), "amx_help", "amx_plugins" );
		console_print( id, "%s", szTemp );
	}
	
	else
	{
		formatex( szTemp, charsmax( szTemp ),"----- %L -----", id, "HELP_USE_BEGIN" );
		replace_all( szTemp, charsmax( szTemp ), "amx_help", "amx_plugins" );
		console_print( id, "%s", szTemp );
	}

	return PLUGIN_HANDLED;
}

@Modules( id )
{
	if( ~ get_user_flags( id ) & g_iConfig[ MODULES_FLAG ] )
	{
		send_message( id, CONSOLE, true, "%L", id, "NO_ACCESS_COMMAND" );
		return PLUGIN_HANDLED;
	}

	new szName[ MAX_NAME_LENGTH ], szVersion[ 8 ], szAuthor[ MAX_NAME_LENGTH ], iStatus, szStatus[ 16 ];
	
	new iNum = get_modulesnum( );
	
	console_print( id, "%L", id, "LOADED_MODULES" );
	
	for( new i; i < iNum; i++ )
	{
		get_module( i, szName, charsmax( szName ), szAuthor, charsmax( szAuthor ), szVersion, charsmax( szVersion ), iStatus )
		
		switch( iStatus )
		{
		case module_loaded:
			{
				new szRunning[ 15 ];
				formatex( szRunning, charsmax( szRunning ), "%L", id, "RUNNING" );
				copy( szStatus, charsmax( szStatus ), szRunning );
			}
			
		default:
			{
				new szTempString[ 64 ];
				
				formatex( szTempString, charsmax( szTempString ), "%L", id, "BAD_LOAD" );
				copy( szStatus, charsmax( szStatus ), szTempString );
				
				formatex( szTempString, charsmax( szTempString ), "%L", id, "UNKNOWN" );
				copy( szName, charsmax( szName ), szTempString );
				copy( szAuthor, charsmax( szAuthor ), szTempString );
				copy( szVersion, charsmax( szVersion ), szTempString );
			}
		}
		
		console_print( id, "%-23.22s %-11.10s %-20.19s %-11.10s", szName, szVersion, szAuthor, szStatus );
	}
	console_print( id, "%d %L", iNum, id, "MODULES" );
	return PLUGIN_HANDLED;
}

@Cvar( id )
{
	if( ~ get_user_flags( id ) & g_iConfig[ CVAR_FLAG ] )
	{
		send_message( id, CONSOLE, true, "%L", id, "NO_ACCESS_COMMAND" );
		return PLUGIN_HANDLED;
	}
	
	new szCvar[ 32 ], szValue[ 64 ];
	
	read_argv( 1, szCvar, charsmax( szCvar ) );
	read_argv( 2, szValue, charsmax( szValue ) );
	
	new iPointer;
	
	if( equali( szCvar, "add" ) && ( get_user_flags( id ) & ADMIN_RCON ) )
	{
		if( ( iPointer = get_cvar_pointer( szValue ) ) != 0 )
		{
			new iFlags = get_pcvar_flags( iPointer );
			
			if( ! ( iFlags & FCVAR_PROTECTED ) )
			{
				set_pcvar_flags( iPointer, iFlags | FCVAR_PROTECTED );
			}
		}
		return PLUGIN_HANDLED;
	}
	
	if( ( iPointer = get_cvar_pointer( szCvar ) ) == 0 )
	{
		console_print( id, "%L", id, "UNKNOWN_CVAR", szCvar );
		return PLUGIN_HANDLED;
	}
	
	if( bOnlyRcon( szCvar ) && ! ( get_user_flags( id ) & ADMIN_RCON ) )
	{
		// Exception for the new onlyRcon rules:
		// sv_password is allowed to be modified by ADMIN_PASSWORD
		if( ! ( equali( szCvar, "sv_password" ) && ( get_user_flags( id ) & ADMIN_PASSWORD ) ) )
		{
			console_print( id, "%L", id, "NO_ACCESS_CVAR" );
			return PLUGIN_HANDLED;
		}
	}
	
	if( read_argc( ) < 3 )
	{
		get_pcvar_string( iPointer, szValue, charsmax( szValue ) );
		console_print( id, "CVAR ^"%s^" %L ^"%s^"", szCvar, id, "IS", szValue );
		
		return PLUGIN_HANDLED;
	}

	new szSteamId[ MAX_AUTHID_LENGTH ], szName[ MAX_NAME_LENGTH ];
	
	get_user_authid( id, szSteamId, charsmax( szSteamId ) );
	get_user_name( id, szName, charsmax( szName ) );
	
	send_message( 0, LOG, false, "%L", LANG_PLAYER, "CVAR_SET", szName, szCvar, szValue );
	set_cvar_string( szCvar, szValue );

	new iPlayers[ MAX_PLAYERS ], iNum, iTempId, szCvarValue[ 64 ];
	get_players( iPlayers, iNum, "ch" );
	
	for( new i; i < iNum; i++ )
	{
		iTempId = iPlayers[ i ];
		
		if( get_pcvar_flags( iPointer ) & FCVAR_PROTECTED || equali( szCvar, "rcon_password" ) )
		{
			formatex( szCvarValue, charsmax( szCvarValue ), "*** %L ***", id, "PROTECTED" );
		}
		else
		{
			copy( szCvarValue, charsmax( szCvarValue ), szValue );
		}
		CC_SendMessage( iTempId, "%L", id, "CVAR_SET", szName, szCvar, szCvarValue );
	}
	console_print( id, "%L", id, "CVAR_SET_SUCCESS", szCvar, szValue );
	return PLUGIN_HANDLED;
}

@Rcon( id )
{
	if( ~ get_user_flags( id ) & g_iConfig[ RCON_FLAG ] )
	{
		send_message( id, CONSOLE, true, "%L", id, "NO_ACCESS_COMMAND" );
		return PLUGIN_HANDLED;
	}
	
	new szCmd[ 128 ], szSteamId[ MAX_AUTHID_LENGTH ], szName[ MAX_NAME_LENGTH ];
	
	read_args( szCmd, charsmax( szCmd ) );
	
	get_user_authid( id, szSteamId, charsmax( szSteamId ) );
	get_user_name( id, szName, charsmax( szName ) );
	
	send_message( 0, LOG, false, "%L", LANG_PLAYER, "RCON_SENT", szName, szCmd );
	
	console_print( id, "%L", id, "CMD_SENT_SERVER", szCmd );
	server_cmd( "%s", szCmd );
	
	return PLUGIN_HANDLED;
}

@ShowRcon( id )
{
	if( ~ get_user_flags( id ) & g_iConfig[ SHOW_RCON_FLAG ] )
	{
		send_message( id, CONSOLE, true, "%L", id, "NO_ACCESS_COMMAND" );
		return PLUGIN_HANDLED;
	}
	
	new szRconPw[ 64 ];
	get_pcvar_string( g_pRconPassword, szRconPw, charsmax( szRconPw ) );
	
	if( ! szRconPw[ 0 ] )
	{
		@Rcon( id );
	}
	
	else
	{
		new szArgs[ 128 ];
		
		read_args( szArgs, charsmax( szArgs ) );
		client_cmd( id, "rcon_password %s", szRconPw );
		client_cmd( id, "rcon %s", szArgs );
	}
	
	return PLUGIN_HANDLED
}

@Kick( id )
{
	if( ~ get_user_flags( id ) & g_iConfig[ KICK_FLAG ] )
	{	
		send_message( id, CONSOLE, true, "%L", id, "NO_ACCESS_COMMAND" );
		return PLUGIN_HANDLED;
	}

	new szName[ MAX_NAME_LENGTH ], szReason[ MAX_REASON_LENGTH ];
	read_argv( 1, szName, charsmax( szName ) );
	read_argv( 2, szReason, charsmax( szReason ) );
	
	trim( szReason );
	remove_quotes( szReason );
	
	if( read_argc( ) != 3 )
	{
		send_message( id, CONSOLE, true, "%L", id, "AMX_KICK_USAGE" );
		return PLUGIN_HANDLED;
	}
	
	new iPlayer = cmd_target( id, szName, CMDTARGET_ALLOW_SELF );
	
	if( ! iPlayer || ! is_user_connected( iPlayer ) )
	{
		send_message( id, CONSOLE, true, "%L", id, "PLAYER_NOT_FOUND" );
		return PLUGIN_HANDLED;
	}
	
	new iImmunityLevel = GetImmunityLevel( id );
	new iImmunityLevelTarget = GetImmunityLevel( iPlayer );
	
	if( iImmunityLevel < iImmunityLevelTarget )
	{
		send_message( id, CONSOLE, true, "%L", id, "CANT_PERFORM_IMMUNITY" );
		return PLUGIN_HANDLED;
	}
	
	new szNameAdmin[ MAX_NAME_LENGTH ], szNameUser[ MAX_NAME_LENGTH ], iUserIdUser;
	
	get_user_name( id, szNameAdmin, charsmax( szNameAdmin ) );
	get_user_name( iPlayer, szNameUser, charsmax( szNameUser ) );
	
	iUserIdUser = get_user_userid( iPlayer );
	
	server_cmd( "kick #%d ^"%s^"", iUserIdUser, szReason );
	
	CC_SendMessage( 0, "%L", LANG_PLAYER, "KICKED", szNameAdmin, szNameUser, szReason );
	send_message( 0, LOG, false, "%L", LANG_PLAYER, "KICKED", szNameAdmin, szNameUser, szReason );
	
	return PLUGIN_HANDLED;
}

@AddBan( id )
{
	if( ~ get_user_flags( id ) & g_iConfig[ ADD_BAN_FLAG ] )
	{
		send_message( id, CONSOLE, true, "%L", id, "NO_ACCESS_COMMAND" );
		return PLUGIN_HANDLED;
	}
	
	new szName[ MAX_NAME_LENGTH ], szSteamId[ MAX_AUTHID_LENGTH ], szIP[ MAX_IP_LENGTH ], szMinutes[ 8 ], szReason[ MAX_REASON_LENGTH ], szNameAdmin[ MAX_NAME_LENGTH ];
	read_argv( 1, szName, charsmax( szName ) );
	read_argv( 2, szSteamId, charsmax( szSteamId ) );
	read_argv( 3, szIP, charsmax( szIP ) );
	read_argv( 4, szMinutes, charsmax( szMinutes ) );
	read_argv( 5, szReason, charsmax( szReason ) );
	
	if( read_argc( ) != 6 )
	{
		send_message( id, CONSOLE, true, "%L", id, "AMX_ADDBAN_USAGE" );
		return PLUGIN_HANDLED;
	}

	new iPlayer = cmd_target( id, szName, CMDTARGET_NO_BOTS );
	
	if( is_user_connected( iPlayer ) )
	{
		new iImmunityLevel = GetImmunityLevel( id );
		new iImmunityLevelTarget = GetImmunityLevel( iPlayer );
		
		if( iImmunityLevel < iImmunityLevelTarget )
		{
			send_message( id, CONSOLE, true, "%L", id, "CANT_PERFORM_IMMUNITY" );
			return PLUGIN_HANDLED;
		}
	}
	
	new szExpireDate[ MAX_DATE_LENGTH ], iMinutes = str_to_num( szMinutes );
	
	get_user_name( id, szNameAdmin, charsmax( szNameAdmin ) );
	get_user_name( id, szName, charsmax( szName ) );
	
	if( iMinutes == 0 )
	{
		CC_SendMessage( 0, "%L", LANG_PLAYER, "ADDED_TO_BANLIST_PERMANENT", szNameAdmin, szName, szSteamId, szIP );
		send_message( 0, LOG, false, "%L", LANG_PLAYER, "LOG_ADDED_TO_BANLIST_PERMANENT", szNameAdmin, szName, szSteamId, szIP, szReason );
		
		copy( szExpireDate, charsmax( szExpireDate ), "never" );
	}
	
	else
	{
		get_time( "%m/%d/%Y - %H:%M:%S", szExpireDate, charsmax( szExpireDate ) );
		
		AddMinutesToDate( szExpireDate, iMinutes, szExpireDate, charsmax( szExpireDate ) );
		
		CC_SendMessage( 0, "%L", LANG_PLAYER, "ADDED_TO_BANLIST", szNameAdmin, szName, szSteamId, szIP, iMinutes );
		send_message( 0, LOG, false, "%L", LANG_PLAYER, "LOG_ADDED_TO_BANLIST", szNameAdmin, szName, szSteamId, szIP, iMinutes, szExpireDate, szReason );
	}
	
	trim( szName );
	trim( szSteamId );
	trim( szIP );
	trim( szExpireDate );
	trim( szReason );
	trim( szNameAdmin );
	
	new eData[ PlayerBan ];	
	copy( eData[ Player_Name ], charsmax( eData[ Player_Name ] ), szName );
	copy( eData[ Player_SteamId ], charsmax( eData[ Player_SteamId ] ), szSteamId );
	copy( eData[ Player_IP ], charsmax( eData[ Player_IP ] ), szIP );
	copy( eData[ Player_BanExpire ], charsmax( eData[ Player_BanExpire ] ), szExpireDate );
	copy( eData[ Player_BanReason ], charsmax( eData[ Player_BanReason ] ), szReason );
	copy( eData[ Player_BannedBy ], charsmax( eData[ Player_BannedBy ] ), szNameAdmin );
	
	ArrayPushArray( g_aBans, eData );
	AddBan( szName, szSteamId, szIP, szExpireDate, szReason, szNameAdmin );
	
	if( is_user_connected( iPlayer ) )
	{
		ScreenShot( iPlayer );
		KickPlayerOut( iPlayer );
	}
	
	return PLUGIN_HANDLED;
}

@AddGag( id )
{
	if( ~ get_user_flags( id ) & g_iConfig[ ADD_GAG_FLAG ] )
	{
		send_message( id, CONSOLE, true, "%L", id, "NO_ACCESS_COMMAND" );
		return PLUGIN_HANDLED;
	}
	
	new szName[ MAX_NAME_LENGTH ], szSteamId[ MAX_AUTHID_LENGTH ], szIP[ MAX_IP_LENGTH ], szSeconds[ 8 ], szFlags[ 5 ], szReason[ MAX_REASON_LENGTH ], szNameAdmin[ MAX_NAME_LENGTH ];
	read_argv( 1, szName, charsmax( szName ) );
	read_argv( 2, szSteamId, charsmax( szSteamId ) );
	read_argv( 3, szIP, charsmax( szIP ) );
	read_argv( 4, szSeconds, charsmax( szSeconds ) );
	read_argv( 5, szFlags, charsmax( szFlags ) );
	read_argv( 6, szReason, charsmax( szReason ) );
	
	if( read_argc( ) != 7 )
	{
		send_message( id, CONSOLE, true, "%L", id, "AMX_ADDGAG_USAGE" );
		return PLUGIN_HANDLED;
	}

	if( ! equali( szFlags, "sv" ) && ! equali( szFlags, "vs" ) && ! equali( szFlags, "s" ) && ! equali( szFlags, "v" ) )
	{
		send_message( id, CONSOLE, false, "%L", id, "INVALID_FLAGS" );
		return PLUGIN_HANDLED;
	}
	
	new iPlayer = cmd_target( id, szName, CMDTARGET_NO_BOTS );
	
	if( is_user_connected( iPlayer ) )
	{
		new iImmunityLevel = GetImmunityLevel( id );
		new iImmunityLevelTarget = GetImmunityLevel( iPlayer );
		
		if( iImmunityLevel < iImmunityLevelTarget )
		{
			send_message( id, CONSOLE, true, "%L", id, "CANT_PERFORM_IMMUNITY" );
			return PLUGIN_HANDLED;
		}
	}
	
	new szExpireDate[ MAX_DATE_LENGTH ], iSeconds = str_to_num( szSeconds );
	get_user_name( id, szNameAdmin, charsmax( szNameAdmin ) );
	get_user_name( id, szName, charsmax( szName ) );
	
	if( iSeconds == 0 )
	{
		CC_SendMessage( 0, "%L", LANG_PLAYER, "ADDED_TO_GAGLIST_PERMANENT", szNameAdmin, szName, szSteamId, szIP );
		send_message( 0, LOG, false, "%L", LANG_PLAYER, "LOG_ADDED_TO_GAGLIST_PERMANENT", szNameAdmin, szName, szSteamId, szIP, szFlags, szReason );
		
		copy( szExpireDate, charsmax( szExpireDate ), "never" );
	}
	
	else
	{
		get_time( "%m/%d/%Y - %H:%M:%S", szExpireDate, charsmax( szExpireDate ) );
		
		AddSecondsToDate( szExpireDate, iSeconds, szExpireDate, charsmax( szExpireDate ) );
		
		CC_SendMessage( 0, "%L", LANG_PLAYER, "ADDED_TO_GAGLIST", szNameAdmin, szName, szSteamId, szIP, iSeconds );
		send_message( 0, LOG, false, "%L", LANG_PLAYER, "LOG_ADDED_TO_GAGLIST", szNameAdmin, szName, szSteamId, szIP, iSeconds, szExpireDate, szFlags, szReason );
	}
	
	trim( szName );
	trim( szSteamId );
	trim( szIP );
	trim( szReason );
	trim( szFlags );
	trim( szExpireDate );
	trim( szNameAdmin );
	
	new eData[ PlayerGag ];	
	copy( eData[ Player_Name ], charsmax( eData[ Player_Name ] ), szName );
	copy( eData[ Player_SteamId ], charsmax( eData[ Player_SteamId ] ), szSteamId );
	copy( eData[ Player_IP ], charsmax( eData[ Player_IP ] ), szIP );
	copy( eData[ Player_GagReason ], charsmax( eData[ Player_GagReason ] ), szReason );
	copy( eData[ Player_GagFlags ], charsmax( eData[ Player_GagFlags ] ), szFlags );
	copy( eData[ Player_GagExpire ], charsmax( eData[ Player_GagExpire ] ), szExpireDate );
	copy( eData[ Player_GaggedBy ], charsmax( eData[ Player_GaggedBy ] ), szNameAdmin );
	
	ArrayPushArray( g_aGags, eData );
	AddGag( szName, szSteamId, szIP, szReason, szFlags, szExpireDate, szNameAdmin );

	if( is_user_connected( iPlayer ) )
	{
		CheckGagged( iPlayer );
	}
	
	return PLUGIN_HANDLED;
}

@Psay( id )
{
	if( ~ get_user_flags( id ) & g_iConfig[ PSAY_FLAG ] )
	{
		send_message( id, CONSOLE, true, "%L", id, "NO_ACCESS_COMMAND" );
		return PLUGIN_HANDLED;
	}
	
	new szName[ MAX_NAME_LENGTH ], szMessage[ 192 ];
	read_argv( 1, szName, charsmax( szName ) );
	read_argv( 2, szMessage, charsmax( szMessage ) );
	
	if( read_argc( ) != 3 )
	{
		send_message( id, CONSOLE, true, "%L", id, "AMX_PSAY_USAGE" );
		return PLUGIN_HANDLED;
	}
	
	new iPlayer = cmd_target( id, szName, CMDTARGET_NO_BOTS );
	
	if( ! is_user_connected( iPlayer ) )
	{
		send_message( id, CONSOLE, true, "%L", id, "PLAYER_NOT_FOUND" );
		return PLUGIN_HANDLED;
	}
	
	get_user_name( iPlayer, szName, charsmax( szName ) );
	
	new szAdminName[ 32 ];
	get_user_name( id, szAdminName, charsmax( szAdminName ) );
	
	CC_SendMessage( id, "&x00%L", id, "PSAY_HIM", szName, szMessage );
	CC_SendMessage( iPlayer, "&x00%L", iPlayer, "PSAY_YOU", szAdminName, szMessage );
	
	return PLUGIN_HANDLED;
}

@Who( id )
{
	if( ~ get_user_flags( id ) & g_iConfig[ WHO_FLAG ] )
	{
		send_message( id, CONSOLE, true, "%L", id, "NO_ACCESS_COMMAND" );
		return PLUGIN_HANDLED;
	}
	
	new iFlags, szFlags[ MAX_FLAGS_LENGTH ], szRank[ 32 ], iPlayers[ MAX_PLAYERS ], iNum, iTempId, szName[ MAX_NAME_LENGTH ], szSteamId[ MAX_AUTHID_LENGTH ], szIp[ MAX_IP_LENGTH ];
	get_players( iPlayers, iNum );
	
	send_message( id, CONSOLE, false, "^nName    SteamID    IP    Flags    Rank" );
	
	for( new i; i < iNum; i++ )
	{
		iTempId = iPlayers[ i ];
		
		get_user_name( iTempId, szName, charsmax( szName ) );
		get_user_authid( iTempId, szSteamId, charsmax( szSteamId ) );
		get_user_ip( iTempId, szIp, charsmax( szIp ), 1 );
		
		iFlags = get_user_flags( iTempId );
		get_flags( iFlags, szFlags, charsmax( szFlags ) );
		
		if( g_iConfig[ RANKS_ENABLED ] )
		{
			eas_get_player_rank( iTempId, szRank, charsmax( szRank ) );
			send_message( id, CONSOLE, false, "%s  %s  %s  %s  %s", szName, szSteamId, szIp, szFlags, szRank );
		}
		
		else
		{
			send_message( id, CONSOLE, false, "%s  %s  %s  %s", szName, szSteamId, szIp, szFlags );
		}
	}
	return PLUGIN_HANDLED;
}

@Last( id )
{
	if( ~ get_user_flags( id ) & g_iConfig[ LAST_FLAG ] )
	{
		send_message( id, CONSOLE, true, "%L", id, "NO_ACCESS_COMMAND" );
		return PLUGIN_HANDLED;
	}
	
	send_message( id, CONSOLE, false, "%L      %L      %L      %L      %L", id, "NAME", id, "STEAM_ID", id, "IP", id, "FLAGS", id, "RANK" );
	
	FlushDisconnectedPlayers( );
	
	new eData[ PlayerDisconnectData ];
	for( new i; i < ArraySize( g_aDisconnectInfo ); i++ )
	{
		ArrayGetArray( g_aDisconnectInfo, i, eData );
		send_message( id, CONSOLE, false, "%s    %s    %s    %s    %s", eData[ Player_DisconnectName ], eData[ Player_DisconnectSteamID ], eData[ Player_DisconnectIP ], eData[ Player_DisconnectFlags ], eData[ Player_DisconnectRank ] );
	}
	return PLUGIN_HANDLED;
}

@Team( id )
{
	if( ~ get_user_flags( id ) & g_iConfig[ TEAM_FLAG ] )
	{
		send_message( id, CONSOLE, true, "%L", id, "NO_ACCESS_COMMAND" );
		return PLUGIN_HANDLED;
	}
	
	new szName[ MAX_NAME_LENGTH ], szTeam[ 12 ], szRespawn[ 2 ];
	read_argv( 1, szName, charsmax( szName ) );
	read_argv( 2, szTeam, charsmax( szTeam ) );
	read_argv( 3, szRespawn, charsmax( szRespawn ) );
	
	if( read_argc( ) != 4 )
	{
		send_message( id, CONSOLE, true, "%L", id, "AMX_TEAM_USAGE" );
		return PLUGIN_HANDLED;
	}
	
	new iPlayer = cmd_target( id, szName, CMDTARGET_ALLOW_SELF );
	
	if( ! iPlayer )
	{
		send_message( id, CONSOLE, true, "%L", id, "PLAYER_NOT_FOUND" );
		return PLUGIN_HANDLED;
	}
	
	new iImmunityLevel = GetImmunityLevel( id );
	new iImmunityLevelTarget = GetImmunityLevel( iPlayer );
	
	if( iImmunityLevel < iImmunityLevelTarget )
	{
		send_message( id, CONSOLE, true, "%L", id, "CANT_PERFORM_IMMUNITY" );
		return PLUGIN_HANDLED;
	}
	
	new iTeam, szTeamFinal[ 20 ];
	if( is_str_num( szTeam ) )
	{
		iTeam = str_to_num( szTeam );
		switch( iTeam )
		{
		case 1:
			{
				eas_set_user_team( iPlayer, 1 );
				copy( szTeamFinal, charsmax( szTeamFinal ), "Terrorist" );
			}
			
		case 2:
			{
				eas_set_user_team( iPlayer, 2 );
				copy( szTeamFinal, charsmax( szTeamFinal ), "Counter-Terrorist" );
			}
			
		case 3:
			{
				eas_set_user_team( iPlayer, 3 );
				copy( szTeamFinal, charsmax( szTeamFinal ), "Spectator" );
			}
			
		default:
			{
				send_message( id, CONSOLE, true, "%L", id, "INVALID_TEAM" );
				return PLUGIN_HANDLED;
			}
		}
	}
	
	else
	{
		if( equali( szTeam, "T" ) || equali( szTeam, "TERRORIST" ) )
		{
			iTeam = 1;
			eas_set_user_team( iPlayer, iTeam );
			
			copy( szTeamFinal, charsmax( szTeamFinal ), "Terrorist" );
		}
		
		else if( equali( szTeam, "CT" ) )
		{
			iTeam = 2;
			eas_set_user_team( iPlayer, iTeam );
			
			copy( szTeamFinal, charsmax( szTeamFinal ), "Counter-Terrorist" );
		}
		
		else if( equali( szTeam, "SPEC" ) || equali( szTeam, "SPECTATOR" ) )
		{
			iTeam = 3;
			eas_set_user_team( iPlayer, iTeam );
			
			copy( szTeamFinal, charsmax( szTeamFinal ), "Spectator" );
		}
		
		else
		{
			send_message( id, CONSOLE, true, "%L", id, "INVALID_TEAM" );
			return PLUGIN_HANDLED;
		}
	}
	
	new iRespawn = str_to_num( szRespawn );
	
	!( 0 <= iRespawn <= 1 ) ? ( iRespawn = 0 ) : iRespawn;
	
	if( iRespawn == 1 )
	{
		ExecuteHamB( Ham_CS_RoundRespawn, iPlayer );
	}

	new szSteamIdAdmin[ MAX_AUTHID_LENGTH ], szNameAdmin[ MAX_NAME_LENGTH ], szNamePlayer[ MAX_NAME_LENGTH ];

	get_user_authid( id, szSteamIdAdmin, charsmax( szSteamIdAdmin ) );
	get_user_name( id, szNameAdmin, charsmax( szNameAdmin ) );
	get_user_name( iPlayer, szNamePlayer, charsmax( szNamePlayer ) );
	
	CC_SendMatched( 0, iPlayer, "%L", LANG_PLAYER, "TEAM_CHANGE", szNameAdmin, szNamePlayer, szTeamFinal );
	send_message( 0, LOG, false, "%L", LANG_PLAYER, "TEAM_CHANGE", szNameAdmin, szNamePlayer, szTeamFinal );
	
	return PLUGIN_HANDLED;
}	

@Ban( id )
{
	if( ~ get_user_flags( id ) & g_iConfig[ BAN_FLAG ] )
	{
		send_message( id, CONSOLE, true, "%L", id, "NO_ACCESS_COMMAND" );
		return PLUGIN_HANDLED;
	}

	new szName[ MAX_NAME_LENGTH ], szReason[ MAX_REASON_LENGTH ], szMinutes[ 8 ];
	read_argv( 1, szName, charsmax( szName ) );
	read_argv( 2, szMinutes, charsmax( szMinutes ) );
	read_argv( 3, szReason, charsmax( szReason ) );
	
	if( read_argc( ) != 4 )
	{
		send_message( id, CONSOLE, true, "%L", id, "AMX_BAN_USAGE" );
		return PLUGIN_HANDLED;
	}
	
	new iPlayer = cmd_target( id, szName, CMDTARGET_NO_BOTS );
	
	if( ! iPlayer )
	{
		send_message( id, CONSOLE, true, "%L", id, "PLAYER_NOT_FOUND" );
		return PLUGIN_HANDLED;
	}
	
	new iImmunityLevel = GetImmunityLevel( id );
	new iImmunityLevelTarget = GetImmunityLevel( iPlayer );
	
	if( iImmunityLevel < iImmunityLevelTarget )
	{
		send_message( id, CONSOLE, true, "%L", id, "CANT_PERFORM_IMMUNITY" );
		return PLUGIN_HANDLED;
	}
	
	new szSteamIdUser[ MAX_AUTHID_LENGTH ], szIpUser[ MAX_IP_LENGTH ], szNameAdmin[ MAX_NAME_LENGTH ], szNameUser[ MAX_NAME_LENGTH ];
	
	get_user_ip( iPlayer, szIpUser, charsmax( szIpUser ), 1 );
	get_user_authid( iPlayer, szSteamIdUser, charsmax( szSteamIdUser ) );
	get_user_name( id, szNameAdmin, charsmax( szNameAdmin ) );
	get_user_name( iPlayer, szNameUser, charsmax( szNameUser ) );
	
	new szExpireDate[ MAX_DATE_LENGTH ], iMinutes = str_to_num( szMinutes );
	
	if( iMinutes == 0 )
	{
		CC_SendMessage( 0, "%L", LANG_PLAYER, "BANNED_PERMANENT", szNameAdmin, szNameUser, szReason );
		send_message( 0, LOG, false, "%L", LANG_PLAYER, "LOG_BANNED_PERMANENT", szNameAdmin, szNameUser, szSteamIdUser, szIpUser, szReason );
		
		copy( szExpireDate, charsmax( szExpireDate ), "never" );
	}
	
	else
	{
		get_time( "%m/%d/%Y - %H:%M:%S", szExpireDate, charsmax( szExpireDate ) );
		
		AddMinutesToDate( szExpireDate, iMinutes, szExpireDate, charsmax( szExpireDate ) );
		
		if( iMinutes == 1 )
		{
			CC_SendMessage( 0, "%L", LANG_PLAYER, "BANNED_SINGULAR", szNameAdmin, szNameUser, szReason, szExpireDate );
			send_message( 0, LOG, false, "%L", LANG_PLAYER, "LOG_BANNED_SINGULAR", szNameAdmin, szNameUser, szSteamIdUser, szIpUser, szReason, szExpireDate );
		}
		
		else
		{
			CC_SendMessage( 0, "%L", LANG_PLAYER, "BANNED_PLURAL", szNameAdmin, szNameUser, iMinutes, szReason, szExpireDate );
			send_message( 0, LOG, false, "%L", LANG_PLAYER, "LOG_BANNED_PLURAL", szNameAdmin, szNameUser, szSteamIdUser, szIpUser, iMinutes, szReason, szExpireDate );
		}
	}
	
	trim( szNameUser );
	trim( szSteamIdUser );
	trim( szIpUser );
	trim( szExpireDate );
	trim( szReason );
	trim( szNameAdmin );
	
	new eData[ PlayerBan ];	
	copy( eData[ Player_Name ], charsmax( eData[ Player_Name ] ), szNameUser );
	copy( eData[ Player_SteamId ], charsmax( eData[ Player_SteamId ] ), szSteamIdUser );
	copy( eData[ Player_IP ], charsmax( eData[ Player_IP ] ), szIpUser );
	copy( eData[ Player_BanExpire ], charsmax( eData[ Player_BanExpire ] ), szExpireDate );
	copy( eData[ Player_BanReason ], charsmax( eData[ Player_BanReason ] ), szReason );
	copy( eData[ Player_BannedBy ], charsmax( eData[ Player_BannedBy ] ), szNameAdmin );
	
	ArrayPushArray( g_aBans, eData );
	BanPlayer( szNameUser, szSteamIdUser, szIpUser, szExpireDate, szReason, szNameAdmin );
	
	if( is_user_connected( iPlayer ) )
	{
		ScreenShot( iPlayer );
		KickPlayerOut( iPlayer );
	}
	
	return PLUGIN_HANDLED;
}

@Unban( id )
{
	if( ~ get_user_flags( id ) & g_iConfig[ UNBAN_FLAG ] )
	{
		send_message( id, CONSOLE, true, "%L", id, "NO_ACCESS_COMMAND" );
		return PLUGIN_HANDLED;
	}
	
	new szIdentity[ MAX_AUTHID_LENGTH ];
	read_argv( 1, szIdentity, charsmax( szIdentity ) );
	
	if( read_argc( ) != 2 )
	{
		send_message( id, CONSOLE, true, "%L", id, "AMX_UNBAN_USAGE" );
		return PLUGIN_HANDLED;
	}
	
	ReadBans( );
	
	new eData[ PlayerBan ], bool:bPlayerFound;
	for( new i; i < ArraySize( g_aBans ); i++ )
	{
		ArrayGetArray( g_aBans, i, eData );
		
		if( equali( szIdentity, eData[ Player_Name ] ) || equali( szIdentity, eData[ Player_SteamId ] ) || equali( szIdentity, eData[ Player_IP ] ) )
		{
			UnbanPlayer( szIdentity );
			
			new szNameAdmin[ MAX_NAME_LENGTH ];
			get_user_name( id, szNameAdmin, charsmax( szNameAdmin ) );
			
			CC_SendMessage( 0, "%L", LANG_PLAYER, "UNBANNED", szNameAdmin, eData[ Player_Name ], eData[ Player_SteamId ], eData[ Player_IP ] );

			send_message( 0, LOG, false, "%L", LANG_PLAYER, "UNBANNED", szNameAdmin, eData[ Player_Name ], eData[ Player_SteamId ], eData[ Player_IP ] );
			bPlayerFound = true;
			
			break;
		}
	}
	if( ! bPlayerFound )
	{
		send_message( id, CONSOLE, true, "%L", id, "PLAYER_NOT_FOUND" );
	}
	return PLUGIN_HANDLED;
}

@Slay( id )
{
	if( ~ get_user_flags( id ) & g_iConfig[ SLAY_FLAG ] )
	{
		send_message( id, CONSOLE, true, "%L", id, "NO_ACCESS_COMMAND" );
		return PLUGIN_HANDLED;
	}

	new szName[ MAX_NAME_LENGTH ], szReason[ MAX_REASON_LENGTH ];
	read_argv( 1, szName, charsmax( szName ) );
	read_argv( 2, szReason, charsmax( szReason ) );
	
	trim( szReason );
	remove_quotes( szReason );
	
	if( read_argc( ) != 3 )
	{
		send_message( id, CONSOLE, true, "%L", id, "AMX_SLAY_USAGE" );
		return PLUGIN_HANDLED;
	}
	
	new iPlayer = cmd_target( id, szName, CMDTARGET_ALLOW_SELF );
	
	if( ! is_user_connected( iPlayer ) )
	{
		send_message( id, CONSOLE, true, "%L", id, "PLAYER_NOT_FOUND" );
		return PLUGIN_HANDLED;
	}
	
	if( ! is_user_alive( iPlayer ) )
	{
		send_message( id, CONSOLE, true, "%L", id, "SLAY_DEAD_PLAYER" );
		return PLUGIN_HANDLED;
	}
	
	new iImmunityLevel = GetImmunityLevel( id );
	new iImmunityLevelTarget = GetImmunityLevel( iPlayer );
	
	if( iImmunityLevel < iImmunityLevelTarget )
	{
		send_message( id, CONSOLE, true, "%L", id, "CANT_PERFORM_IMMUNITY" );
		return PLUGIN_HANDLED;
	}
	
	new szNameAdmin[ MAX_NAME_LENGTH ], szNameUser[ MAX_NAME_LENGTH ];
	
	get_user_name( id, szNameAdmin, charsmax( szNameAdmin ) );
	get_user_name( iPlayer, szNameUser, charsmax( szNameUser ) );
	
	user_kill( iPlayer );
	
	CC_SendMessage( 0, "%L", LANG_PLAYER, "SLAY", szNameAdmin, szNameUser, szReason );
	send_message( 0, LOG, false, "%L", LANG_PLAYER, "SLAY", szNameAdmin, szNameUser, szReason );
	
	return PLUGIN_HANDLED;
}

@Slap( id )
{
	if( ~ get_user_flags( id ) & g_iConfig[ SLAP_FLAG ] )
	{
		send_message( id, CONSOLE, true, "%L", id, "NO_ACCESS_COMMAND" );
		return PLUGIN_HANDLED;
	}

	new szName[ MAX_NAME_LENGTH ], szReason[ MAX_REASON_LENGTH ], szValue[ 3 ], iValue;
	read_argv( 1, szName, charsmax( szName ) );
	read_argv( 2, szValue, charsmax( szValue ) );
	read_argv( 3, szReason, charsmax( szReason ) );
	
	trim( szReason );
	remove_quotes( szReason );
	
	if( read_argc( ) != 4 )
	{
		send_message( id, CONSOLE, true, "%L", id, "AMX_SLAP_USAGE" );
		return PLUGIN_HANDLED;
	}
	
	new iPlayer = cmd_target( id, szName, CMDTARGET_ALLOW_SELF );
	
	if( ! is_user_connected( iPlayer ) )
	{
		send_message( id, CONSOLE, true, "%L", id, "PLAYER_NOT_FOUND" );
		return PLUGIN_HANDLED;
	}
	
	if( ! is_user_alive( iPlayer ) )
	{
		send_message( id, CHAT, true, "%L", id, "SLAP_DEAD_PLAYER" );
		return PLUGIN_HANDLED;
	}
	
	new iImmunityLevel = GetImmunityLevel( id );
	new iImmunityLevelTarget = GetImmunityLevel( iPlayer );
	
	if( iImmunityLevel < iImmunityLevelTarget )
	{
		send_message( id, CONSOLE, true, "%L", id, "CANT_PERFORM_IMMUNITY" );
		return PLUGIN_HANDLED;
	}
	
	new szNameAdmin[ MAX_NAME_LENGTH ], szNameUser[ MAX_NAME_LENGTH ];
	
	get_user_name( id, szNameAdmin, charsmax( szNameAdmin ) );
	get_user_name( iPlayer, szNameUser, charsmax( szNameUser ) );
	
	iValue = str_to_num( szValue );
	
	user_slap( iPlayer, iValue );
	
	CC_SendMessage( 0, "%L", LANG_PLAYER, "SLAP", szNameAdmin, szNameUser, iValue, szReason );
	send_message( 0, LOG, false, "%L", LANG_PLAYER, "SLAP", szNameAdmin, szNameUser, iValue, szReason );
	
	return PLUGIN_HANDLED;
}

@Map( id )
{
	if( ~ get_user_flags( id ) & g_iConfig[ MAP_FLAG ] )
	{
		send_message( id, CONSOLE, true, "%L", id, "NO_ACCESS_COMMAND" );
		return PLUGIN_HANDLED;
	}

	new szMap[ MAX_MAP_NAME_LENGTH ];
	new iMapLen = read_argv( 1, szMap, charsmax( szMap ) );
	
	if( read_argc( ) != 2 )
	{
		send_message( id, CONSOLE, true, "%L", id, "AMX_MAP_USAGE" );
		return PLUGIN_HANDLED;
	}
	
	if( ! is_map_valid( szMap ) )
	{
		send_message( id, CONSOLE, true, "%L", id, "MAP_NOT_FOUND" );
		return PLUGIN_HANDLED;
	}

	new szName[ MAX_NAME_LENGTH ];
	get_user_name( id, szName, charsmax( szName ) );

	new szModName[ 10 ];
	get_modname( szModName, charsmax( szModName ) );
	
	if( ! equali( szModName, "zp" ) )
	{
		message_begin( MSG_ALL, SVC_INTERMISSION );
		message_end( );
	}
	
	CC_SendMessage( 0, "%L", LANG_PLAYER, "MAP_CHANGE", szName, szMap );
	send_message( 0, LOG, false, "%L", LANG_PLAYER, "MAP_CHANGE", szName, szMap );

	set_task( 2.0, "OnMapChange", _, szMap, iMapLen + 1 );
	
	return PLUGIN_HANDLED
}

@Nick( id )
{
	if( ~ get_user_flags( id ) & g_iConfig[ NICK_FLAG ] )
	{
		send_message( id, CONSOLE, true, "%L", id, "NO_ACCESS_COMMAND" );
		return PLUGIN_HANDLED;
	}

	new szCurrentName[ MAX_NAME_LENGTH ], szNewName[ MAX_NAME_LENGTH ], szAdminName[ MAX_NAME_LENGTH ];

	read_argv( 1, szCurrentName, charsmax( szCurrentName ) );
	read_argv( 2, szNewName, charsmax( szNewName ) );
	
	if( read_argc( ) != 3 )
	{
		send_message( id, CONSOLE, true, "%L", id, "AMX_NICK_USAGE" );
		return PLUGIN_HANDLED;
	}
	
	get_user_name( id, szAdminName, charsmax( szAdminName ) );
	
	new iPlayer = cmd_target( id, szCurrentName, CMDTARGET_ALLOW_SELF );
	
	if( ! iPlayer )
	{
		send_message( id, CONSOLE, true, "%L", id, "PLAYER_NOT_FOUND" );
		return PLUGIN_HANDLED;
	}
	
	get_user_name( iPlayer, szCurrentName, charsmax( szCurrentName ) );
	
	new iImmunityLevel = GetImmunityLevel( id );
	new iImmunityLevelTarget = GetImmunityLevel( iPlayer );
	
	if( iImmunityLevel < iImmunityLevelTarget )
	{
		send_message( id, CONSOLE, true, "%L", id, "CANT_PERFORM_IMMUNITY" );
		return PLUGIN_HANDLED;
	}

	client_cmd( iPlayer, "name ^"%s^"", szNewName );

	CC_SendMessage( 0, "%L", LANG_PLAYER, "NICK_CHANGE", szAdminName, szCurrentName, szNewName );
	send_message( 0, LOG, false, "%L", LANG_PLAYER, "NICK_CHANGE", szAdminName, szCurrentName, szNewName );
	
	return PLUGIN_HANDLED;
}

///////////////////////////////////////////////////////////////////////////////// END OF CONSOLE COMMANDS /////////////////////////////////////////////////////////////////////////////////

///////////////////////////////////////////////////////////////////////////////// STOCKS AND PRIVATE FUNCTIONS ///////////////////////////////////////////////////////////////////////////////////////////////

CacheInfo( id )
{
	new eData[ PlayerDisconnectData ], eData2[ PlayerDisconnectData ]; 
	
	get_user_name( id, eData[ Player_Name ], charsmax( eData[ Player_Name ] ) );
	get_user_authid( id, eData[ Player_SteamId ], charsmax( eData[ Player_SteamId ] ) );
	get_user_ip( id, eData[ Player_IP ], charsmax( eData[ Player_IP ] ), 1 );
	
	new bool:bExists;
	for( new i; i < ArraySize( g_aDisconnectInfo ); i++ )
	{
		ArrayGetArray( g_aDisconnectInfo, i, eData2 );

		if( equali( eData[ Player_Name ], eData2[ Player_Name ] ) || equali( eData[ Player_SteamId ], eData2[ Player_SteamId ] ) || equali( eData[ Player_IP ], eData2[ Player_IP ] ) )
		{
			bExists = true;
			break;
		}
	}
	
	if( ! bExists )
	{
		get_flags( get_user_flags( id ), eData[ Player_DisconnectFlags ], charsmax( eData[ Player_DisconnectFlags ] ) );
		
		eas_get_player_rank( id, eData[ Player_DisconnectRank ], charsmax( eData[ Player_DisconnectRank ] ) );
		
		new szDate[ MAX_DATE_LENGTH ];
		get_time( "%m/%d/%Y - %H:%M:%S", szDate, charsmax( szDate ) );
		
		AddSecondsToDate( szDate, g_iConfig[ DISCONNECT_INFO_SECONDS_EXPIRE ], eData[ Player_DataExpireDate ], charsmax( eData[ Player_DataExpireDate ] ) );
		
		ArrayPushArray( g_aDisconnectInfo, eData );
	}
	return PLUGIN_HANDLED;
}

FlushDisconnectedPlayers( )
{
	new eData[ PlayerDisconnectData ];
	for( new i; i < ArraySize( g_aDisconnectInfo ); i++ )
	{
		ArrayGetArray( g_aDisconnectInfo, i, eData );
		
		if( HasDatePassed( eData[ Player_DataExpireDate ] ) )
		{
			ArrayDeleteItem( g_aDisconnectInfo, i );
		}
	}
}

CleanVars( id )
{
	g_bFrozen[ id ] = false;
	g_iKick[ id ] = 0;
	g_iTeamSwitch[ id ] = 0;
	
	arrayset( g_iBan[ id ], 0, sizeof( g_iBan[ ] ) );
	arrayset( g_iGag[ id ], 0, sizeof( g_iGag[ ] ) );
	arrayset( g_iAddBan[ id ], 0, sizeof( g_iAddBan[ ] ) );
	arrayset( g_iAddGag[ id ], 0, sizeof( g_iAddGag[ ] ) );
	arrayset( g_iSlay[ id ], 0, sizeof( g_iSlay[ ] ) );
	arrayset( g_iSlap[ id ], 0, sizeof( g_iSlap[ ] ) );
	arrayset( _:fAngles[ id ], _:0.0, sizeof( fAngles[ ] ) );
	arrayset( g_szTeamSwitch[ id ], 0, sizeof( g_szTeamSwitch[ ] ) );
}

GetImmunityLevel( id )
{
	new eData[ PlayerData ], szName[ MAX_NAME_LENGTH ], szSteamID[ MAX_AUTHID_LENGTH ], iImmunityLevel;
	get_user_name( id, szName, charsmax( szName ) );
	get_user_authid( id, szSteamID, charsmax( szSteamID ) );

	for( new i; i < ArraySize( g_aDataBase ); i++ )
	{
		ArrayGetArray( g_aDataBase, i, eData );
		
		if( equali( szName, eData[ Player_ID ] ) || equali( szSteamID, eData[ Player_ID ] ) )
		{
			iImmunityLevel = eData[ Player_Immunity ];
			break;
		}
	}
	return iImmunityLevel;
}

AddBan( const szName[ ], const szSteamId[ ], const szIP[ ], const szExpireDate[ ], const szReason[ ], const szAdminName[ ] )
{
	new szFormat[ 192 ];
	
	formatex( szFormat, charsmax( szFormat ), "%s/%s", g_szConfigsDir, g_iConfig[ BANS_FILE ] );
	new iFilePointer = fopen( szFormat, "r+" );
	
	if( iFilePointer )
	{			
		new szByteVal[ 1 ];
		
		fseek( iFilePointer , -1 , SEEK_END );
		fread_raw( iFilePointer , szByteVal , sizeof( szByteVal ) , BLOCK_BYTE );
		fseek( iFilePointer , 0 , SEEK_END );
		
		fprintf( iFilePointer, "%s^"%s^" ^"%s^" ^"%s^" ^"%s^" ^"%s^" ^"%s^"", ( szByteVal[ 0 ] == 10 ) ? "" : "^n", szName, szSteamId, szIP, szExpireDate, szReason, szAdminName ); // add him to banlist
		fclose( iFilePointer );
	}
	return 1;
}

AddGag( const szName[ ], const szSteamId[ ], const szIP[ ], const szReason[ ], const szFlags[ ], const szExpireDate[ ], const szGaggedBy[ ] )
{
	new szFormat[ 192 ];
	
	formatex( szFormat, charsmax( szFormat ), "%s/%s", g_szConfigsDir, g_iConfig[ GAGS_FILE ] );
	new iFilePointer = fopen( szFormat, "r+" );
	
	if( iFilePointer )
	{			
		new szByteVal[ 1 ];
		
		fseek( iFilePointer , -1 , SEEK_END );
		fread_raw( iFilePointer , szByteVal , sizeof( szByteVal ) , BLOCK_BYTE );
		fseek( iFilePointer , 0 , SEEK_END );
		
		fprintf( iFilePointer, "%s^"%s^" ^"%s^" ^"%s^" ^"%s^" ^"%s^" ^"%s^" ^"%s^"", ( szByteVal[ 0 ] == 10 ) ? "" : "^n", szName, szSteamId, szIP, szReason, szFlags, szExpireDate, szGaggedBy ); // add him to gaglist
		fclose( iFilePointer );
	}
	return 1;
}

UnbanPlayer( const szIdentity[ ] )
{
	new const szTempFileName[ ] = "tempfile.ini";

	new szFormat[ 128 ], szData[ 128 ], szName[ MAX_NAME_LENGTH ], szSteamId[ MAX_AUTHID_LENGTH ], szIP[ MAX_IP_LENGTH ];
	
	static szTempFilePath[ 256 ];
	formatex( szTempFilePath, charsmax( szTempFilePath ), "%s/%s", g_szConfigsDir, szTempFileName );
	
	formatex( szFormat, charsmax( szFormat ), "%s/%s", g_szConfigsDir, g_iConfig[ BANS_FILE ] );
	new iFilePointer = fopen( szFormat, "rt" );

	if( iFilePointer )
	{
		new iInputFilePointer = fopen( szTempFilePath, "wt" );
		
		if( iInputFilePointer )
		{
			while( fgets( iFilePointer, szData, charsmax( szData ) ) )
			{
				switch( szData[ 0 ] )
				{
				case EOS, '#', ';', '/', '\':
					{
						fprintf( iInputFilePointer, szData ); // write as it was before
					}

				default:
					{			
						parse( szData, szName, charsmax( szName ), szSteamId, charsmax( szSteamId ), szIP, charsmax( szIP ) );
						
						trim( szName );
						trim( szSteamId );
						trim( szIP );
						
						if( ! equali( szIdentity, szName ) && ! equali( szIdentity, szSteamId ) && ! equali( szIdentity, szIP ) ) // not the person we're looking for
						{
							fprintf( iInputFilePointer, szData ); // write as it was before
						}
						
						else
						{
							continue;
						}
					}
				}
			}
			fclose( iInputFilePointer );
			fclose( iFilePointer );

			delete_file( szFormat );
			rename_file( szTempFilePath, szFormat, 1 );
		}
	}
	return 0;
}

UnGagPlayer( const szIdentity[ ] )
{
	new const szTempFileName[ ] = "tempfile.ini";

	new szFormat[ 128 ], szData[ 192 ], szName[ MAX_NAME_LENGTH ], szSteamId[ MAX_AUTHID_LENGTH ], szIP[ MAX_IP_LENGTH ];
	
	new szTempFilePath[ 64 ];
	formatex( szTempFilePath, charsmax( szTempFilePath ), "%s/%s", g_szConfigsDir, szTempFileName );
	
	formatex( szFormat, charsmax( szFormat ), "%s/%s", g_szConfigsDir, g_iConfig[ GAGS_FILE ] );
	new iFilePointer = fopen( szFormat, "rt" );
	
	if( iFilePointer )
	{
		new iInputFilePointer = fopen( szTempFilePath, "wt" );
		
		if( iInputFilePointer )
		{
			while( fgets( iFilePointer, szData, charsmax( szData ) ) )
			{
				switch( szData[ 0 ] )
				{
				case EOS, '#', ';', '/', '\':
					{
						fprintf( iInputFilePointer, szData ); // write as it was before
					}

				default:
					{								
						parse( szData, szName, charsmax( szName ), szSteamId, charsmax( szSteamId ), szIP, charsmax( szIP ) );
						
						trim( szName );
						trim( szSteamId );
						trim( szIP );
						
						remove_quotes( szName );
						remove_quotes( szSteamId );
						remove_quotes( szIP );
						
						if( ! equali( szIdentity, szName ) && ! equali( szIdentity, szSteamId ) && ! equali( szIdentity, szIP ) ) // not the person we're looking for
						{
							fprintf( iInputFilePointer, szData ); // write as it was before
						}
					}
				}
			}
			fclose( iInputFilePointer );
			fclose( iFilePointer );

			delete_file( szFormat );
			rename_file( szTempFilePath, szFormat, 1 );
		}
	}
	return 0;
}

UnGagPlayer2( const szNamePlayer[ ], const szSteamIdPlayer[ ], const szIpPlayer[ ] )
{
	new const szTempFileName[ ] = "tempfile.ini";

	new szFormat[ 128 ], szData[ 192 ], szName[ MAX_NAME_LENGTH ], szSteamId[ MAX_AUTHID_LENGTH ], szIP[ MAX_IP_LENGTH ];
	
	new szTempFilePath[ 64 ];
	formatex( szTempFilePath, charsmax( szTempFilePath ), "%s/%s", g_szConfigsDir, szTempFileName );
	
	formatex( szFormat, charsmax( szFormat ), "%s/%s", g_szConfigsDir, g_iConfig[ GAGS_FILE ] );
	new iFilePointer = fopen( szFormat, "rt" );

	if( iFilePointer )
	{
		new iInputFilePointer = fopen( szTempFilePath, "wt" );
		
		if( iInputFilePointer )
		{
			while( fgets( iFilePointer, szData, charsmax( szData ) ) )
			{
				switch( szData[ 0 ] )
				{
				case EOS, '#', ';', '/', '\':
					{
						fprintf( iInputFilePointer, szData ); // write as it was before
					}

				default:
					{			
						parse( szData, szName, charsmax( szName ), szSteamId, charsmax( szSteamId ), szIP, charsmax( szIP ) );
						
						trim( szName );
						trim( szSteamId );
						trim( szIP );
						
						if( equali( szNamePlayer, szName ) && equali( szSteamIdPlayer, szSteamId ) && equali( szIpPlayer, szIP ) )
						{
							new eData[ PlayerGag ];
							for( new i; i < ArraySize( g_aGags ); i++ )
							{
								ArrayGetArray( g_aGags, i, eData );
								
								if( equali( eData[ Player_Name ], szName ) && equali( eData[ Player_SteamId ], szSteamIdPlayer ) && equali( eData[ Player_IP ], szIP ) )
								{
									ArrayDeleteItem( g_aGags, i );
									break;
								}
							}	
						}
						
						else
						{
							fprintf( iInputFilePointer, szData ); // write as it was before
						}
					}
				}
			}
			fclose( iInputFilePointer );
			fclose( iFilePointer );

			delete_file( szFormat );
			rename_file( szTempFilePath, szFormat, 1 );
		}
	}
	return 0;
}

UnbanPlayer2( const szNamePlayer[ ], const szSteamIdPlayer[ ], const szIpPlayer[ ] )
{
	new const szTempFileName[ ] = "tempfile.ini";

	new szFormat[ 128 ], szData[ 192 ], szName[ MAX_NAME_LENGTH ], szSteamId[ MAX_AUTHID_LENGTH ], szIP[ MAX_IP_LENGTH ];
	
	new szTempFilePath[ 64 ];
	formatex( szTempFilePath, charsmax( szTempFilePath ), "%s/%s", g_szConfigsDir, szTempFileName );
	
	formatex( szFormat, charsmax( szFormat ), "%s/%s", g_szConfigsDir, g_iConfig[ BANS_FILE ] );
	new iFilePointer = fopen( szFormat, "rt" );

	if( iFilePointer )
	{
		new iInputFilePointer = fopen( szTempFilePath, "wt" );
		
		if( iInputFilePointer )
		{
			while( fgets( iFilePointer, szData, charsmax( szData ) ) )
			{
				switch( szData[ 0 ] )
				{
				case EOS, '#', ';', '/', '\':
					{
						fprintf( iInputFilePointer, szData ); // write as it was before
					}

				default:
					{			
						parse( szData, szName, charsmax( szName ), szSteamId, charsmax( szSteamId ), szIP, charsmax( szIP ) );
						
						trim( szName );
						trim( szSteamId );
						trim( szIP );
						
						if( equali( szNamePlayer, szName ) && equali( szSteamIdPlayer, szSteamId ) && equali( szIpPlayer, szIP ) )
						{
							new eData[ PlayerBan ];
							for( new i; i < ArraySize( g_aBans ); i++ )
							{
								ArrayGetArray( g_aBans, i, eData );
								
								if( equali( eData[ Player_Name ], szName ) && equali( eData[ Player_SteamId ], szSteamIdPlayer ) && equali( eData[ Player_IP ], szIP ) )
								{
									ArrayDeleteItem( g_aBans, i );
									break;
								}
							}	
						}
						
						else
						{
							fprintf( iInputFilePointer, szData ); // write as it was before
						}
					}
				}
			}
			fclose( iInputFilePointer );
			fclose( iFilePointer );

			delete_file( szFormat );
			rename_file( szTempFilePath, szFormat, 1 );
		}
	}
	return 0;
}

BanPlayer( const szName[ ], const szSteamId[ ], const szIP[ ], const szExpireDate[ ], const szReason[ ], const szBannedBy[ ] )
{
	new szFormat[ 128 ];
	formatex( szFormat, charsmax( szFormat ), "%s/%s", g_szConfigsDir, g_iConfig[ BANS_FILE ] );
	
	new iFilePointer = fopen( szFormat, "r+" );
	
	if( iFilePointer )
	{			
		new szByteVal[ 1 ];
		
		fseek( iFilePointer , -1 , SEEK_END );
		fread_raw( iFilePointer , szByteVal , sizeof( szByteVal ) , BLOCK_BYTE );
		fseek( iFilePointer , 0 , SEEK_END );
		
		fprintf( iFilePointer, "%s^"%s^" ^"%s^" ^"%s^" ^"%s^" ^"%s^" ^"%s^"", ( szByteVal[ 0 ] == 10 ) ? "" : "^n", szName, szSteamId, szIP, szExpireDate, szReason, szBannedBy ); // add him to banlist
		fclose( iFilePointer );
	}
	return 1;
}

GagPlayer( const szName[ ], const szSteamId[ ], const szIP[ ], const szReason[ ], const szFlags[ ], const szExpireDate[ ], const szGaggedBy[ ] )
{
	new szFormat[ 128 ];
	formatex( szFormat, charsmax( szFormat ), "%s/%s", g_szConfigsDir, g_iConfig[ GAGS_FILE ] );
	
	new iFilePointer = fopen( szFormat, "r+" );
	
	if( iFilePointer )
	{			
		new szByteVal[ 1 ];
		
		fseek( iFilePointer , -1 , SEEK_END );
		fread_raw( iFilePointer , szByteVal , sizeof( szByteVal ) , BLOCK_BYTE );
		fseek( iFilePointer , 0 , SEEK_END );
		
		fprintf( iFilePointer, "%s^"%s^" ^"%s^" ^"%s^" ^"%s^" ^"%s^" ^"%s^" ^"%s^"", ( szByteVal[ 0 ] == 10 ) ? "" : "^n", szName, szSteamId, szIP, szReason, szFlags, szExpireDate, szGaggedBy ); // add him to gaglist
		fclose( iFilePointer );
	}
	return 1;
}

AddMinutesToDate( const szDate[ ], const iMinutes, szReturnDate[ ], const iSize )
{
	new const szFormatRule[ ] = "%m/%d/%Y - %H:%M:%S";
	new const iSecondsInMinute = 60;
	
	new iCurrentTimeStamp = parse_time( szDate, szFormatRule );
	iCurrentTimeStamp = iCurrentTimeStamp + ( iMinutes * iSecondsInMinute );
	format_time( szReturnDate, iSize, szFormatRule, iCurrentTimeStamp );
}

AddSecondsToDate( const szDate[ ], const iSeconds, szReturnDate[ ], const iSize )
{
	new const szFormatRule[ ] = "%m/%d/%Y - %H:%M:%S";
	
	new iCurrentTimeStamp = parse_time( szDate, szFormatRule );
	iCurrentTimeStamp = iCurrentTimeStamp + iSeconds;
	format_time( szReturnDate, iSize, szFormatRule, iCurrentTimeStamp );
}

RemoveSecondsFromDate( const szDate[ ], const iSeconds, szReturnDate[ ], const iSize )
{
	new const szFormatRule[ ] = "%m/%d/%Y - %H:%M:%S";
	
	new iCurrentTimeStamp = parse_time( szDate, szFormatRule );
	iCurrentTimeStamp = iCurrentTimeStamp - iSeconds;
	format_time( szReturnDate, iSize, szFormatRule, iCurrentTimeStamp );
}

ReadBans( )
{
	ArrayClear( g_aBans );
	ArrayClear( g_aBanExists );

	static szFile[ 128 ], szData[ 192 ];
	formatex( szFile, charsmax( szFile ), "%s/%s", g_szConfigsDir, g_iConfig[ BANS_FILE ] );
	
	new iFile = fopen( szFile, "rt" );
	
	if( iFile )
	{
		while( fgets( iFile, szData, charsmax( szData ) ) )
		{
			trim( szData );
			
			switch( szData[ 0 ] )
			{
			case EOS, '#', ';', '/', '\':
				{
					continue;
				}

			default:
				{
					new eData[ PlayerBan ];
					if( parse( szData, eData[ Player_Name ], charsmax( eData[ Player_Name ] ), eData[ Player_SteamId ], charsmax( eData[ Player_SteamId ] ), eData[ Player_IP ], charsmax( eData[ Player_IP ] ), 
								eData[ Player_BanExpire ], charsmax( eData[ Player_BanExpire ] ),eData[ Player_BanReason ], charsmax( eData[ Player_BanReason ] ), eData[ Player_BannedBy ], charsmax( eData[ Player_BannedBy ] ) ) < 6 )
					{
						continue;
					}

					ArrayPushArray( g_aBans, eData );
					ArrayPushCell( g_aBanExists, 0 ); // create a new slot
				}
			}
		}
		fclose( iFile );
	}
	return PLUGIN_CONTINUE;
}

ReadGags( )
{
	ArrayClear( g_aGags );
	ArrayClear( g_aGagExists );

	static szFile[ 128 ], szData[ 192 ];
	formatex( szFile, charsmax( szFile ), "%s/%s", g_szConfigsDir, g_iConfig[ GAGS_FILE ] );
	
	new iFile = fopen( szFile, "rt" );
	
	if( iFile )
	{
		while( fgets( iFile, szData, charsmax( szData ) ) )
		{
			trim( szData );
			
			switch( szData[ 0 ] )
			{
			case EOS, '#', ';', '/', '\':
				{
					continue;
				}

			default:
				{
					new eData[ PlayerGag ];
					if( parse( szData, eData[ Player_Name ], charsmax( eData[ Player_Name ] ), eData[ Player_SteamId ], charsmax( eData[ Player_SteamId ] ), eData[ Player_IP ], charsmax( eData[ Player_IP ] ),
								eData[ Player_GagReason ], charsmax( eData[ Player_GagReason ] ), eData[ Player_GagFlags ], charsmax( eData[ Player_GagFlags ] ), eData[ Player_GagExpire ], charsmax( eData[ Player_GagExpire ] ), eData[ Player_GaggedBy ], charsmax( eData[ Player_GaggedBy ] ) ) < 7 )
					{
						continue;
					}

					ArrayPushArray( g_aGags, eData );
					ArrayPushCell( g_aGagExists, 0 ); // create a new slot
				}
			}
		}
		fclose( iFile );
	}
	return PLUGIN_CONTINUE;
}

public KickPlayerOut( id )
{
	if( get_user_flags( id ) & g_iConfig[ IMMUNITY_FLAG ] )
	{
		return PLUGIN_HANDLED;
	}

	else
	{
		new eData[ PlayerBan ], szSteamId[ MAX_AUTHID_LENGTH ], szName[ MAX_NAME_LENGTH ], szIP[ MAX_IP_LENGTH ];
		get_user_authid( id, szSteamId, charsmax( szSteamId ) );
		get_user_name( id, szName, charsmax( szName ) );
		get_user_ip( id, szIP, charsmax( szIP ), 1 );

		for( new i; i < ArraySize( g_aBans ); i++ )
		{
			ArrayGetArray( g_aBans, i, eData );
			
			if( equali( szSteamId, eData[ Player_SteamId ] ) || equali( szName, eData[ Player_Name ] ) || equali( szIP, eData[ Player_IP ] ) )
			{
				if( ! HasDatePassed( eData[ Player_BanExpire ] ) || equali( eData[ Player_BanExpire ], "never" ) )
				{
					if( equali( eData[ Player_BanExpire ], "never" ) )
					{				
						send_message( id, CONSOLE, false, "^n************************************************" );
						send_message( id, CONSOLE, false, "%L", id, "BAN_INFO_BANNED" );
						send_message( id, CONSOLE, false, "%L", id, "BAN_INFO_EXPIRE_NEVER" );
						send_message( id, CONSOLE, false, "%L", id, "BAN_INFO_REASON", eData[ Player_BanReason ] );
						send_message( id, CONSOLE, false, "%L", id, "BAN_INFO_BY", eData[ Player_BannedBy ] );
						send_message( id, CONSOLE, false, "************************************************" );
					}
					
					else
					{
						send_message( id, CONSOLE, false, "^n************************************************" );
						send_message( id, CONSOLE, false, "%L", id, "BAN_INFO_BANNED" );
						send_message( id, CONSOLE, false, "%L", id, "BAN_INFO_EXPIRE", eData[ Player_BanExpire ] );
						send_message( id, CONSOLE, false, "%L", id, "BAN_INFO_REASON", eData[ Player_BanReason ] );
						send_message( id, CONSOLE, false, "%L", id, "BAN_INFO_BY", eData[ Player_BannedBy ] );
						send_message( id, CONSOLE, false, "************************************************" );
					}
					server_cmd( "kick #%d %L", get_user_userid( id ), id, "CHECK_CONSOLE_INFO" );
					break;
				}
			}
		}
	}
	return PLUGIN_CONTINUE;
}

public CheckBanned( id )
{
	if( get_user_flags( id ) & g_iConfig[ IMMUNITY_FLAG ] )
	{
		return PLUGIN_HANDLED;
	}

	else
	{
		new eData[ PlayerBan ], szSteamId[ MAX_AUTHID_LENGTH ], szName[ MAX_NAME_LENGTH ], szIP[ MAX_IP_LENGTH ];
		get_user_authid( id, szSteamId, charsmax( szSteamId ) );
		get_user_name( id, szName, charsmax( szName ) );
		get_user_ip( id, szIP, charsmax( szIP ), 1 );

		for( new i; i < ArraySize( g_aBans ); i++ )
		{
			ArrayGetArray( g_aBans, i, eData );
			
			if( equali( szSteamId, eData[ Player_SteamId ] ) || equali( szName, eData[ Player_Name ] ) || equali( szIP, eData[ Player_IP ] ) )
			{
				if( ! HasDatePassed( eData[ Player_BanExpire ] ) || equali( eData[ Player_BanExpire ], "never" ) )
				{
					if( equali( eData[ Player_BanExpire ], "never" ) )
					{				
						send_message( id, CONSOLE, false, "************************************************" );
						send_message( id, CONSOLE, false, "%L", id, "BAN_INFO_BANNED" );
						send_message( id, CONSOLE, false, "%L", id, "BAN_INFO_EXPIRE_NEVER" );
						send_message( id, CONSOLE, false, "%L", id, "BAN_INFO_REASON", eData[ Player_BanReason ] );
						send_message( id, CONSOLE, false, "%L", id, "BAN_INFO_BY", eData[ Player_BannedBy ] );
						send_message( id, CONSOLE, false, "************************************************" );
					}
					
					else
					{
						send_message( id, CONSOLE, false, "************************************************" );
						send_message( id, CONSOLE, false, "%L", id, "BAN_INFO_BANNED" );
						send_message( id, CONSOLE, false, "%L", id, "BAN_INFO_EXPIRE", eData[ Player_BanExpire ] );
						send_message( id, CONSOLE, false, "%L", id, "BAN_INFO_REASON", eData[ Player_BanReason ] );
						send_message( id, CONSOLE, false, "%L", id, "BAN_INFO_BY", eData[ Player_BannedBy ] );
						send_message( id, CONSOLE, false, "************************************************" );
					}

					switch( g_iConfig[ BANNED_CONNECT_LOG ] )
					{
					case METHOD_NONE: { }
						
					case METHOD_CHAT:
						{
							CC_SendMessage( 0, "%L", id, "BANNED_PLAYER_CONNECTED", eData[ Player_Name ], eData[ Player_SteamId ], eData[ Player_IP ] );
						}
						
					case METHOD_LOG:
						{
							send_message( 0, LOG, false, "%L", LANG_PLAYER, "BANNED_PLAYER_CONNECTED", eData[ Player_Name ], eData[ Player_SteamId ], eData[ Player_IP ] );
						}
						
					case METHOD_BOTH:
						{
							CC_SendMessage( 0, "%L", id, "BANNED_PLAYER_CONNECTED", eData[ Player_Name ], eData[ Player_SteamId ], eData[ Player_IP ] );
							send_message( 0, LOG, false, "%L", LANG_PLAYER, "BANNED_PLAYER_CONNECTED", eData[ Player_Name ], eData[ Player_SteamId ], eData[ Player_IP ] );
						}
					}
					
					server_cmd( "kick #%d %L", get_user_userid( id ), id, "CHECK_CONSOLE_INFO" );
					break;
				}
			}
		}
	}
	return PLUGIN_CONTINUE;
}

CheckGagged( id )
{
	if( get_user_flags( id ) & g_iConfig[ IMMUNITY_FLAG ] )
	{
		return PLUGIN_HANDLED;
	}

	else
	{
		new eData[ PlayerGag ], szSteamId[ MAX_AUTHID_LENGTH ], szName[ MAX_NAME_LENGTH ], szIP[ MAX_IP_LENGTH ];
		get_user_authid( id, szSteamId, charsmax( szSteamId ) );
		get_user_name( id, szName, charsmax( szName ) );
		get_user_ip( id, szIP, charsmax( szIP ), 1 );

		for( new i; i < ArraySize( g_aGags ); i++ )
		{
			ArrayGetArray( g_aGags, i, eData );
			
			if( equali( szSteamId, eData[ Player_SteamId ] ) || equali( szName, eData[ Player_Name ] ) || equali( szIP, eData[ Player_IP ] ) )
			{
				if( ! HasDatePassed( eData[ Player_GagExpire ] ) )
				{
					set_speak( id, SPEAK_MUTED );
					break;
				}
			}
		}
	}
	return PLUGIN_CONTINUE;
}

CheckExpiredBans( ) // check for bans that have expired
{
	new eData[ PlayerBan ];
	for( new i; i < ArraySize( g_aBans ); i++ )
	{
		ArrayGetArray( g_aBans, i, eData );
		
		if( ! equali( eData[ Player_BanExpire ], "never" ) )
		{
			if( HasDatePassed( eData[ Player_BanExpire ] ) )
			{
				RemoveExpiredBan( i );
			}
		}
	}
}

CheckExpiredGags( ) // check for gags that have expired
{
	new eData[ PlayerGag ], iPlayer, j, iPlayers[ 32 ], iNum, iTempId, szName[ MAX_NAME_LENGTH ];
	for( new i; i < ArraySize( g_aGags ); i++ )
	{
		ArrayGetArray( g_aGags, i, eData );
		
		if( ! equali( eData[ Player_GagExpire ], "never" ) )
		{
			if( HasDatePassed( eData[ Player_GagExpire ] ) )
			{
				iPlayer = find_player( "a", eData[ Player_Name ] );
				
				if( iPlayer )
				{
				    get_user_name( iPlayer, szName, charsmax( szName ) );
				
				    get_players( iPlayers, iNum, "ch" );
					
					for( j = 0; j < iNum; j++ )
					{
					    iTempId = iPlayers[ j ];
						
						if( iTempId == iPlayer )
						{
						    // Your gag has expired
						    send_message( iTempId, CHAT, true, "%L" );
						}
						
						// [Elite Admin System] Player %s 's gag has expired
						send_message( iTempId, CHAT, true, "%L", szName );
				    }
				}
				RemoveExpiredGag( i );
			}
		}
	}
}

RemoveExpiredBan( iItem )
{
	new eData[ PlayerBan ];
	ArrayGetArray( g_aBans, iItem, eData );

	new const szTempFileName[ ] = "tempfile.ini";

	new szFormat[ 128 ], szData[ 192 ], szName[ MAX_NAME_LENGTH ], szSteamId[ MAX_AUTHID_LENGTH ], szIP[ MAX_IP_LENGTH ];
	
	new szTempFilePath[ 64 ];
	formatex( szTempFilePath, charsmax( szTempFilePath ), "%s/%s", g_szConfigsDir, szTempFileName );
	
	formatex( szFormat, charsmax( szFormat ), "%s/%s", g_szConfigsDir, g_iConfig[ BANS_FILE ] );
	new iFilePointer = fopen( szFormat, "rt" );

	if( iFilePointer )
	{
		new iInputFilePointer = fopen( szTempFilePath, "wt" );
		
		if( iInputFilePointer )
		{
			while( fgets( iFilePointer, szData, charsmax( szData ) ) )
			{
				switch( szData[ 0 ] )
				{
				case EOS, '#', ';', '/', '\':
					{
						fprintf( iInputFilePointer, szData ); // write as it was before
					}

				default:
					{			
						parse( szData, szName, charsmax( szName ), szSteamId, charsmax( szSteamId ), szIP, charsmax( szIP ) );
						
						trim( szName );
						trim( szSteamId );
						trim( szIP );
						
						if( ! equali( eData[ Player_Name ], szName ) && ! equali( eData[ Player_SteamId ], szSteamId ) && ! equali( eData[ Player_IP ], szIP ) )
						{
							fprintf( iInputFilePointer, szData ); // write as it was before
						}
					}
				}
			}
			fclose( iInputFilePointer );
			fclose( iFilePointer );

			delete_file( szFormat );
			rename_file( szTempFilePath, szFormat, 1 );
		}
	}
	CheckExistingBans( );
	return 0;
}

RemoveExpiredGag( iItem )
{
	new eData[ PlayerGag ];
	ArrayGetArray( g_aGags, iItem, eData );

	new const szTempFileName[ ] = "tempfile.ini";

	new szFormat[ 128 ], szData[ 192 ], szName[ MAX_NAME_LENGTH ], szSteamId[ MAX_AUTHID_LENGTH ], szIP[ MAX_IP_LENGTH ];
	
	new szTempFilePath[ 64 ];
	formatex( szTempFilePath, charsmax( szTempFilePath ), "%s/%s", g_szConfigsDir, szTempFileName );
	
	formatex( szFormat, charsmax( szFormat ), "%s/%s", g_szConfigsDir, g_iConfig[ GAGS_FILE ] );
	new iFilePointer = fopen( szFormat, "rt" );

	if( iFilePointer )
	{
		new iInputFilePointer = fopen( szTempFilePath, "wt" );
		
		if( iInputFilePointer )
		{
			while( fgets( iFilePointer, szData, charsmax( szData ) ) )
			{
				switch( szData[ 0 ] )
				{
				case EOS, '#', ';', '/', '\':
					{
						fprintf( iInputFilePointer, szData ); // write as it was before
					}

				default:
					{			
						parse( szData, szName, charsmax( szName ), szSteamId, charsmax( szSteamId ), szIP, charsmax( szIP ) );
						
						trim( szName );
						trim( szSteamId );
						trim( szIP );
						
						if( ! equali( eData[ Player_Name ], szName ) && ! equali( eData[ Player_SteamId ], szSteamId ) && ! equali( eData[ Player_IP ], szIP ) )
						{
							fprintf( iInputFilePointer, szData ); // write as it was before
						}
					}
				}
			}
			fclose( iInputFilePointer );
			fclose( iFilePointer );

			delete_file( szFormat );
			rename_file( szTempFilePath, szFormat, 1 );
		}
	}
	CheckExistingGags( );
	return 0;
}

CheckExistingBans( ) // check if the bans that are stored inside the array are also stored in the file
{
	static szFile[ 128 ], szData[ 192 ], eData[ PlayerBan ];
	formatex( szFile, charsmax( szFile ), "%s/%s", g_szConfigsDir, g_iConfig[ BANS_FILE ] );
	
	new iFile = fopen( szFile, "rt" );
	
	if( iFile )
	{
		while( fgets( iFile, szData, charsmax( szData ) ) )
		{
			trim( szData );
			
			switch( szData[ 0 ] )
			{
			case EOS, '#', ';', '/', '\':
				{
					continue;
				}

			default:
				{
					for( new i; i < ArraySize( g_aBans ); i++ )
					{
						ArrayGetArray( g_aBans, i, eData );
						
						new szName[ MAX_NAME_LENGTH ], szSteamId[ MAX_AUTHID_LENGTH ], szIP[ MAX_IP_LENGTH ], szExpireDate[ 32 ], szReason[ MAX_REASON_LENGTH ];
						parse( szData, szName, charsmax( szName ), szSteamId, charsmax( szSteamId ), szIP, charsmax( szIP ), szExpireDate, charsmax( szExpireDate ), szReason, charsmax( szReason ) );
						
						if( equali( eData[ Player_Name ], szName ) && equali( eData[ Player_SteamId ], szSteamId ) && equali( eData[ Player_IP ], szIP ) && equali( eData[ Player_BanExpire ], szExpireDate ) && equali( eData[ Player_BanReason ], szReason ) )
						{						
							ArraySetCell( g_aBanExists, i, 1 );
						}
					}
				}
			}
		}
		fclose( iFile );
		
		for( new i; i < ArraySize( g_aBans ); i++ )
		{
			if( ArrayGetCell( g_aBanExists, i ) != 1 )
			{
				ArrayDeleteItem( g_aBans, i );
			}
		}
	}
}

CheckExistingGags( )
{
	static szFile[ 128 ], szData[ 192 ], eData[ PlayerGag ];
	formatex( szFile, charsmax( szFile ), "%s/%s", g_szConfigsDir, g_iConfig[ GAGS_FILE ] );
	
	new iFile = fopen( szFile, "rt" );
	
	if( iFile )
	{
		while( fgets( iFile, szData, charsmax( szData ) ) )
		{
			trim( szData );
			
			switch( szData[ 0 ] )
			{
			case EOS, '#', ';', '/', '\':
				{
					continue;
				}

			default:
				{
					for( new i; i < ArraySize( g_aGags ); i++ )
					{
						ArrayGetArray( g_aGags, i, eData );
						
						new szName[ MAX_NAME_LENGTH ], szSteamId[ MAX_AUTHID_LENGTH ], szIP[ MAX_IP_LENGTH ], szFlags[ 5 ], szExpireDate[ MAX_DATE_LENGTH ], szReason[ MAX_REASON_LENGTH ], szGaggedBy[ MAX_NAME_LENGTH ];
						
						if( parse( szData, szName, charsmax( szName ), szSteamId, charsmax( szSteamId ), szIP, charsmax( szIP ), szReason, charsmax( szReason ), szFlags, charsmax( szFlags ), szExpireDate, charsmax( szExpireDate ), szGaggedBy, charsmax( szGaggedBy ) ) < 7 )
						{
							continue;
						}
						
						if( equali( eData[ Player_Name ], szName ) && equali( eData[ Player_SteamId ], szSteamId ) && equali( eData[ Player_IP ], szIP ) && equali( eData[ Player_GagExpire ], szExpireDate ) && equali( eData[ Player_GagReason ], szReason ) && equali( eData[ Player_GagFlags ], szFlags ) && equali( eData[ Player_GaggedBy ], szGaggedBy ) )
						{						
							ArraySetCell( g_aGagExists, i, 1 );
						}
					}
				}
			}
		}
		fclose( iFile );
		
		for( new i; i < ArraySize( g_aGags ); i++ )
		{
			if( ArrayGetCell( g_aGagExists, i ) != 1 )
			{				
				ArrayDeleteItem( g_aGags, i );
			}
		}
	}
}

ReadUsers( )
{
	ArrayClear( g_aDataBase );

	new eData[ PlayerData ];

	new szFormat[ 64 ], szPlayerData[ 512 ];	
	formatex( szFormat, charsmax( szFormat ), "%s/%s", g_szConfigsDir, g_iConfig[ USERS_FILE ] );
	
	new iFile = fopen( szFormat, "rt" );
	
	if( iFile )
	{
		while( fgets( iFile, szPlayerData, charsmax( szPlayerData ) ) )
		{
			trim( szPlayerData );
			
			switch( szPlayerData[ 0 ] )
			{
			case EOS, '#', '/', '\':
				{
					continue;
				}
				
			default:
				{
				    new szImmunity[ 8 ];
					if( parse( szPlayerData, eData[ Player_ID ], charsmax( eData[ Player_ID ] ), eData[ Player_Password ], charsmax( eData[ Player_Password ] ), eData[ Player_AccessFlags ],
								charsmax( eData[ Player_AccessFlags ] ), eData[ Player_Prefix ], charsmax( eData[ Player_Prefix ] ), eData[ Player_Model_T ], charsmax( eData[ Player_Model_T ] ),
								eData[ Player_Model_CT ], charsmax( eData[ Player_Model_CT ] ), szImmunity, charsmax( szImmunity ), eData[ Player_Expire_Date ], charsmax( eData[ Player_Expire_Date ] ) ) < 8 )
					{
						continue;
					}
					
					
					if( szPlayerData[ 0 ] == ';' )
					{
						replace( eData[ Player_ID ], charsmax( eData[ Player_ID ] ), ";", "" ); // Just remove the ';', no need to suspend, main plugin does it for us
					}
					
					new iImmunity = str_to_num( szImmunity );
					eData[ Player_Immunity ] = ( ! is_str_num( szImmunity ) || iImmunity < 0 ) ? 0 : iImmunity;
					
					ArrayPushArray( g_aDataBase, eData );
				}
			}
		}
		fclose( iFile );
	}
}

ReadMaps( )
{
	ArrayClear( g_aMaps );

	new szData[ MAX_MAP_NAME_LENGTH ];
	
	new iFile = fopen( g_szMapsFile, "rt" );
	
	if( iFile )
	{
		while( fgets( iFile, szData, charsmax( szData ) ) )
		{
			trim( szData );
			
			switch( szData[ 0 ] )
			{
			case EOS, '#', '/', '\':
				{
					continue;
				}
				
			default:
				{
					ArrayPushString( g_aMaps, szData );
				}
			}
		}
		fclose( iFile );
	}
}

bool:HasDatePassed( const szDate[ ] )
{
	return get_systime( ) >= parse_time( szDate, "%m/%d/%Y - %H:%M:%S" );
}

bool:bOnlyRcon( const szName[ ] )
{
	new iPointer = get_cvar_pointer( szName );
	if( iPointer && get_pcvar_flags( iPointer ) & FCVAR_PROTECTED )
	{
		return true;
	}
	return false;
}

ScreenShot( id )
{
	client_cmd( id, "snapshot" );
}

ReadConfig( )
{
	new szFile[ 128 ], szData[ 64 ];
	
	formatex( szFile, charsmax( szFile ), "%s/%s", g_szConfigsDir, g_szConfigFile );
	
	new iFile = fopen( szFile, "rt" );
	
	if( iFile )
	{
		while( fgets( iFile, szData, charsmax( szData ) ) )
		{
			trim( szData );
			
			switch( szData[ 0 ] )
			{
			case EOS, '#', ';', '/', '\':
				{
					continue;
				}

			default:
				{
					new szKey[ 32 ], szValue[ 64 ];
					strtok( szData, szKey, charsmax( szKey ), szValue, charsmax( szValue ), '=' );
					
					trim( szKey );
					trim( szValue );
					
					remove_quotes( szKey );
					remove_quotes( szValue );
					
					if( ! szValue[ 0 ] || ! szKey[ 0 ] )
					{
						continue;
					}
					
					if( equali( szKey, "BANS_FILE" ) )
					{
						copy( g_iConfig[ BANS_FILE ], charsmax( g_iConfig[ BANS_FILE ] ), szValue );
					}
					
					else if( equali( szKey, "GAGS_FILE" ) )
					{
						copy( g_iConfig[ GAGS_FILE ], charsmax( g_iConfig[ GAGS_FILE ] ), szValue );
					}
					
					else if( equali( szKey, "LOGS_FILE" ) )
					{
						copy( g_iConfig[ LOGS_FILE ], charsmax( g_iConfig[ LOGS_FILE ] ), szValue );
					}
					
					else if( equali( szKey, "USERS_FILE" ) )
					{
						copy( g_iConfig[ USERS_FILE ], charsmax( g_iConfig[ USERS_FILE ] ), szValue );
					}
					
					else if( equali( szKey, "SYSTEM_PREFIX" ) )
					{
						copy( g_iConfig[ SYSTEM_PREFIX ], charsmax( g_iConfig[ SYSTEM_PREFIX ] ), szValue );
					}
					
					else if( equali( szKey, "BANNED_CONNECT_LOG" ) )
					{
						g_iConfig[ BANNED_CONNECT_LOG ] = str_to_num( szValue );
					}
					
					else if( equali( szKey, "KICK_FLAG" ) )
					{
						g_iConfig[ KICK_FLAG ] = read_flags( szValue );
					}
					
					else if( equali( szKey, "BAN_FLAG" ) )
					{
						g_iConfig[ BAN_FLAG ] = read_flags( szValue );
					}
					
					else if( equali( szKey, "ADD_BAN_FLAG" ) )
					{
						g_iConfig[ ADD_BAN_FLAG ] = read_flags( szValue );
					}
					
					else if( equali( szKey, "ADD_GAG_FLAG" ) )
					{
						g_iConfig[ ADD_GAG_FLAG ] = read_flags( szValue );
					}
					
					else if( equali( szKey, "GAG_FLAG" ) )
					{
						g_iConfig[ GAG_FLAG ] = read_flags( szValue );
					}
					
					else if( equali( szKey, "UNBAN_FLAG" ) )
					{
						g_iConfig[ UNBAN_FLAG ] = read_flags( szValue );
					}
					
					else if( equali( szKey, "SLAY_FLAG" ) )
					{
						g_iConfig[ SLAY_FLAG ] = read_flags( szValue );
					}
					
					else if( equali( szKey, "SLAP_FLAG" ) )
					{
						g_iConfig[ SLAP_FLAG ] = read_flags( szValue );
					}
					
					else if( equali( szKey, "CVAR_FLAG" ) )
					{
						g_iConfig[ CVAR_FLAG ] = read_flags( szValue );
					}
					
					else if( equali( szKey, "PLUGINS_FLAG" ) )
					{
						g_iConfig[ PLUGINS_FLAG ] = read_flags( szValue );
					}
					
					else if( equali( szKey, "MAP_FLAG" ) )
					{
						g_iConfig[ MAP_FLAG ] = read_flags( szValue );
					}
					
					else if( equali( szKey, "NICK_FLAG" ) )
					{
						g_iConfig[ NICK_FLAG ] = read_flags( szValue );
					}
					
					else if( equali( szKey, "RCON_FLAG" ) )
					{
						g_iConfig[ RCON_FLAG ] = read_flags( szValue );
					}
					
					else if( equali( szKey, "SHOW_RCON_FLAG" ) )
					{
						g_iConfig[ SHOW_RCON_FLAG ] = read_flags( szValue );
					}
					
					else if( equali( szKey, "MODULES_FLAG" ) )
					{
						g_iConfig[ MODULES_FLAG ] = read_flags( szValue );
					}
					
					else if( equali( szKey, "CHAT_FLAG" ) )
					{
						g_iConfig[ CHAT_FLAG ] = read_flags( szValue );
					}
					
					else if( equali( szKey, "FREEZE_FLAG" ) )
					{
						g_iConfig[ FREEZE_FLAG ] = read_flags( szValue );
					}
					
					else if( equali( szKey, "SCREENSHOT_FLAG" ) )
					{
						g_iConfig[ SCREENSHOT_FLAG ] = read_flags( szValue );
					}
					
					else if( equali( szKey, "COMMANDS_MENU_FLAG" ) )
					{
						g_iConfig[ COMMANDS_MENU_FLAG ] = read_flags( szValue );
					}
					
					else if( equali( szKey, "UNGAG_FLAG" ) )
					{
						g_iConfig[ UNGAG_FLAG ] = read_flags( szValue );
					}
					
					else if( equali( szKey, "SAY_FLAG" ) )
					{
						g_iConfig[ SAY_FLAG ] = read_flags( szValue );
					}
					
					else if( equali( szKey, "TEAM_FLAG" ) )
					{
						g_iConfig[ TEAM_FLAG ] = read_flags( szValue );
					}
					
					else if( equali( szKey, "PSAY_FLAG" ) )
					{
						g_iConfig[ PSAY_FLAG ] = read_flags( szValue );
					}
					
					else if( equali( szKey, "LAST_FLAG" ) )
					{
						g_iConfig[ LAST_FLAG ] = read_flags( szValue );
					}
					
					else if( equali( szKey, "NOCLIP_FLAG" ) )
					{
						g_iConfig[ NOCLIP_FLAG ] = read_flags( szValue );
					}
					
					else if( equali( szKey, "WARN_FLAG" ) )
					{
						g_iConfig[ WARN_FLAG ] = read_flags( szValue );
					}
					
					else if( equali( szKey, "GODMODE_FLAG" ) )
					{
						g_iConfig[ GODMODE_FLAG ] = read_flags( szValue );
					}
					
					else if( equali( szKey, "WHO_FLAG" ) )
					{
						g_iConfig[ WHO_FLAG ] = read_flags( szValue );
					}
					
					else if( equali( szKey, "IMMUNITY_FLAG" ) )
					{
						g_iConfig[ IMMUNITY_FLAG ] = read_flags( szValue );
					}
					
					else if( equali( szKey, "FREQUENCY_UPDATE_ALL_FILES" ) )
					{
						g_iConfig[ FREQUENCY_UPDATE_ALL_FILES ] = _:str_to_float( szValue );
					}
					
					else if( equali( szKey, "DISCONNECT_INFO_SECONDS_EXPIRE" ) )
					{
						g_iConfig[ DISCONNECT_INFO_SECONDS_EXPIRE ] = str_to_num( szValue );
					}

					else if( equali( szKey, "RANKS_ENABLED" ) )
					{
						g_iConfig[ RANKS_ENABLED ] = str_to_num( szValue );
					}
					
					else if( equali( szKey, "CMDMENU_COMMANDS" ) )
					{
						while( szValue[ 0 ] != 0 && strtok( szValue, szKey, charsmax( szKey ), szValue, charsmax( szValue ), ',' ) )
						{
							trim( szKey );
							trim( szValue );
							
							register_concmd( szKey, "@CommandsMenu" );
						}
					}
				}
			}
		}
		fclose( iFile );
	}
}

eas_set_user_team( id, iTeam )
{
	if( is_user_alive( id ) )
	{
		ExecuteHamB( Ham_Killed, id, id, false );
	}
	cs_set_user_team( id, iTeam );
}

IsGagged( id )
{
	new eData[ PlayerGag ], szName[ MAX_NAME_LENGTH ], szSteamId[ MAX_AUTHID_LENGTH ], szIP[ MAX_IP_LENGTH ], bool:bIsGagged;
	get_user_name( id, szName, charsmax( szName ) );
	get_user_authid( id, szSteamId, charsmax( szSteamId ) );
	get_user_ip( id, szIP, charsmax( szIP ), 1 );
	
	for( new i; i < ArraySize( g_aGags ); i++ )
	{
		ArrayGetArray( g_aGags, i, eData );
		
		if( equali( szName, eData[ Player_Name ] ) || equali( szSteamId, eData[ Player_SteamId ] ) || equali( szIP, eData[ Player_IP ] ) )
		{
			bIsGagged = true;
			break;
		}
	}
	return bIsGagged;
}

FreezePlayer( id, iValue )
{
	new iFlags = pev( id , pev_flags )

	switch( iValue )
	{
	case 0:
		{
			if( iFlags & FL_FROZEN )
			{
				set_pev( id, pev_flags, iFlags & ~FL_FROZEN );
				
				g_bFrozen[ id ] = false;
				
				if( g_iFwThink )
				{
					unregister_forward( FM_PlayerPreThink , g_iFwThink );
				}
			}
		}

	case 1:
		{
			if( ~iFlags & FL_FROZEN )
			{
				set_pev( id, pev_flags, iFlags | FL_FROZEN );
				g_bFrozen[ id ] = true;
				pev( id, pev_v_angle, fAngles[ id ] );
				
				g_iFwThink = register_forward( FM_PlayerPreThink , "fw_PlayerPreThink" );
			}
		}
	}
}

UpdateGagExpireDate( szName[ ], szExpireDate[ ] )
{
	new const szTempFileName[ ] = "tempfile.ini";

	new szFormat[ 128 ], szData[ 192 ];
	
	new szTempFilePath[ 64 ];
	formatex( szTempFilePath, charsmax( szTempFilePath ), "%s/%s", g_szConfigsDir, szTempFileName );
	
	formatex( szFormat, charsmax( szFormat ), "%s/%s", g_szConfigsDir, g_iConfig[ GAGS_FILE ] );
	new iFilePointer = fopen( szFormat, "rt" );

	if( iFilePointer )
	{
		new iInputFilePointer = fopen( szTempFilePath, "wt" );
		
		if( iInputFilePointer )
		{
			while( fgets( iFilePointer, szData, charsmax( szData ) ) )
			{
				switch( szData[ 0 ] )
				{
				case EOS, '#', ';', '/', '\':
					{
						fprintf( iInputFilePointer, szData ); // write as it was before
					}

				default:
					{			
						new eData[ PlayerGag ];
						if( parse( szData, eData[ Player_Name ], charsmax( eData[ Player_Name ] ), eData[ Player_SteamId ], charsmax( eData[ Player_SteamId ] ), eData[ Player_IP ], charsmax( eData[ Player_IP ] ),
									eData[ Player_GagReason ], charsmax( eData[ Player_GagReason ] ), eData[ Player_GagFlags ], charsmax( eData[ Player_GagFlags ] ), eData[ Player_GagExpire ], charsmax( eData[ Player_GagExpire ] ), eData[ Player_GaggedBy ], charsmax( eData[ Player_GaggedBy ] ) ) < 7 )
						{
							continue;
						}

						if( equali( szName, eData[ Player_Name ] ) )
						{
							format( szData, charsmax( szData ), "^"%s^" ^"%s^" ^"%s^" ^"%s^" ^"%s^" ^"%s^" ^"%s^"", szName, eData[ Player_SteamId ], eData[ Player_IP ], eData[ Player_GagReason ], eData[ Player_GagFlags ], szExpireDate, eData[ Player_GaggedBy ] );
							fprintf( iInputFilePointer, szData );
						}
						
						else
						{
							fprintf( iInputFilePointer, szData ); // write as it was before
						}
					}
				}
			}
			fclose( iInputFilePointer );
			fclose( iFilePointer );

			delete_file( szFormat );
			rename_file( szTempFilePath, szFormat, 1 );
		}
	}
	return 0;
}

send_message( const id, const iWhere, bool:bPrefix, const szInput[ ], any:... )
{
	new szMessage[ 192 ];
	vformat( szMessage, charsmax(szMessage), szInput, 5 );

	CC_RemoveColors( szMessage, charsmax( szMessage ), true );
	
	bPrefix ? format( szMessage, charsmax(szMessage), "%s %s", g_iConfig[ SYSTEM_PREFIX ], szMessage ) : format( szMessage, charsmax(szMessage), "%s", szMessage );
	
	switch( iWhere )
	{
	case CHAT:
		{
			client_print( id, print_chat, szMessage )
		}
		
	case CONSOLE:
		{
			client_print( id, print_console, szMessage )
		}
		
	case LOG:
		{
			log_to_file( g_iConfig[ LOGS_FILE ], szMessage );
		}
	}
}

//////////////////////////////////////////////////////////////////////////// END OF STOCKS AND PRIVATE FUNCTIONS ////////////////////////////////////////////////////////////////////////////////////
I always get ACCESS VIOLATION

I don't f****** know why but when I comment the lines 4325-4328 it doesn't show me access violation, but of course that's not the solution.
__________________

Last edited by edon1337; 10-12-2019 at 11:10.
edon1337 is offline
Send a message via Skype™ to edon1337
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 08:16.


Powered by vBulletin®
Copyright ©2000 - 2019, vBulletin Solutions, Inc.
Theme made by Freecode