2014-08-04 16:12:15 +04:00
// vim: set ts=4 sw=4 tw=99 noet:
//
// AMX Mod X, based on AMX Mod by Aleksander Naszko ("OLO").
// Copyright (C) The AMX Mod X Development Team.
//
// This software is licensed under the GNU General Public License, version 3 or higher.
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
// https://alliedmods.net/amxmodx-license
//
// Players Menu Plugin
//
2004-01-31 23:56:22 +03:00
2004-03-07 17:30:53 +03:00
# include <amxmodx>
# include <amxmisc>
2006-06-06 02:33:22 +04:00
/** skip autoloading since it's optional */
# define AMXMODX_NOAUTOLOAD
2005-08-24 10:39:52 +04:00
# include <cstrike>
2013-08-24 02:55:21 +04:00
# include <fakemeta>
2005-08-24 10:39:52 +04:00
2015-02-01 21:20:55 +03:00
new g_menuPosition [ MAX_PLAYERS + 1 ] ;
2015-02-01 23:45:16 +03:00
new g_menuPlayers [ MAX_PLAYERS + 1 ] [ MAX_PLAYERS ] ;
2015-02-01 21:20:55 +03:00
new g_menuPlayersNum [ MAX_PLAYERS + 1 ] ;
new g_menuOption [ MAX_PLAYERS + 1 ] ;
new g_menuSettings [ MAX_PLAYERS + 1 ] ;
2015-01-30 02:57:45 +03:00
2015-02-01 21:20:55 +03:00
new g_menuSelect [ MAX_PLAYERS + 1 ] [ 64 ] ;
new g_menuSelectNum [ MAX_PLAYERS + 1 ] ;
2004-01-31 23:56:22 +03:00
2004-02-01 21:45:44 +03:00
# define MAX_CLCMDS 24
2004-01-31 23:56:22 +03:00
2015-01-30 02:57:45 +03:00
new g_clcmdName [ MAX_CLCMDS ] [ 32 ] ;
new g_clcmdCmd [ MAX_CLCMDS ] [ 64 ] ;
new g_clcmdMisc [ MAX_CLCMDS ] [ 2 ] ;
new g_clcmdNum ;
2004-01-31 23:56:22 +03:00
2015-01-30 02:57:45 +03:00
new g_coloredMenus ;
2015-03-21 18:14:14 +03:00
new bool : g_cstrike = false ;
new bool : g_fakemeta = false , m_iMenu , m_bTeamChanged , Menu_ChooseAppearance ;
2005-09-11 08:31:13 +04:00
2007-08-01 10:03:51 +04:00
new Array : g_bantimes ;
new Array : g_slapsettings ;
2015-03-21 18:14:14 +03:00
new const g_CSTeamNames [ 3 ] [ ] = {
2007-08-08 06:32:53 +04:00
" TERRORIST " ,
" CT " ,
" SPECTATOR "
2015-01-30 02:57:45 +03:00
} ;
2015-03-21 18:14:14 +03:00
new const g_CSTeamNumbers [ 3 ] [ ] = {
2007-08-08 06:32:53 +04:00
" 1 " ,
" 2 " ,
" 6 "
2015-01-30 02:57:45 +03:00
} ;
2015-03-21 18:14:14 +03:00
new const g_CSTeamiNumbers [ 3 ] = {
2007-08-08 06:32:53 +04:00
1 ,
2 ,
2013-08-24 02:55:21 +04:00
3
2015-01-30 02:57:45 +03:00
} ;
2007-08-08 06:32:53 +04:00
2015-03-26 23:17:46 +03:00
new g_CSPlayerCanSwitchFromSpec [ MAX_PLAYERS + 1 ] ;
2015-01-30 02:57:45 +03:00
new g_transferingAdmin ;
2013-08-24 02:55:21 +04:00
2015-01-30 02:57:45 +03:00
new allow_spectators , mp_limitteams ;
2013-08-24 02:55:21 +04:00
2013-08-16 20:49:55 +04:00
new p_amx_tempban_maxtime ;
new Trie : g_tempBans ;
2007-08-01 10:03:51 +04:00
2015-03-26 23:17:46 +03:00
new g_silent [ MAX_PLAYERS + 1 ] ;
2014-08-11 16:46:30 +04:00
2005-09-11 08:31:13 +04:00
public plugin_natives ( )
{
2015-01-30 02:57:45 +03:00
set_module_filter ( " module_filter " ) ;
set_native_filter ( " native_filter " ) ;
2005-09-11 08:31:13 +04:00
}
2004-01-31 23:56:22 +03:00
2005-09-13 01:06:24 +04:00
public plugin_init ( )
{
2015-01-30 02:57:45 +03:00
register_plugin ( " Players Menu " , AMXX_VERSION_STR , " AMXX Dev Team " ) ;
register_dictionary ( " common.txt " ) ;
register_dictionary ( " admincmd.txt " ) ;
register_dictionary ( " plmenu.txt " ) ;
register_clcmd ( " amx_kickmenu " , " cmdKickMenu " , ADMIN_KICK , " - displays kick menu " ) ;
register_clcmd ( " amx_banmenu " , " cmdBanMenu " , ADMIN_BAN | ADMIN_BAN_TEMP , " - displays ban menu " ) ;
register_clcmd ( " amx_slapmenu " , " cmdSlapMenu " , ADMIN_SLAY , " - displays slap/slay menu " ) ;
register_clcmd ( " amx_teammenu " , " cmdTeamMenu " , ADMIN_LEVEL_A , " - displays team menu " ) ;
register_clcmd ( " amx_clcmdmenu " , " cmdClcmdMenu " , ADMIN_LEVEL_A , " - displays client cmds menu " ) ;
register_menucmd ( register_menuid ( " Ban Menu " ) , 1023 , " actionBanMenu " ) ;
register_menucmd ( register_menuid ( " Kick Menu " ) , 1023 , " actionKickMenu " ) ;
register_menucmd ( register_menuid ( " Slap/Slay Menu " ) , 1023 , " actionSlapMenu " ) ;
register_menucmd ( register_menuid ( " Team Menu " ) , 1023 , " actionTeamMenu " ) ;
register_menucmd ( register_menuid ( " Client Cmds Menu " ) , 1023 , " actionClcmdMenu " ) ;
2007-08-01 10:03:51 +04:00
g_bantimes = ArrayCreate ( ) ;
// Load up the old default values
ArrayPushCell ( g_bantimes , 0 ) ;
ArrayPushCell ( g_bantimes , 5 ) ;
ArrayPushCell ( g_bantimes , 10 ) ;
ArrayPushCell ( g_bantimes , 15 ) ;
ArrayPushCell ( g_bantimes , 30 ) ;
ArrayPushCell ( g_bantimes , 45 ) ;
ArrayPushCell ( g_bantimes , 60 ) ;
2015-01-30 02:57:45 +03:00
2007-08-01 10:03:51 +04:00
g_slapsettings = ArrayCreate ( ) ;
// Old default values
2008-03-31 01:26:31 +04:00
ArrayPushCell ( g_slapsettings , 0 ) ; // slap 0 damage
2007-08-01 10:03:51 +04:00
ArrayPushCell ( g_slapsettings , 1 ) ;
ArrayPushCell ( g_slapsettings , 5 ) ;
2013-08-24 03:14:54 +04:00
ArrayPushCell ( g_slapsettings , 0 ) ; // Last option is ignored - it is slay
2015-01-30 02:57:45 +03:00
2007-08-01 10:03:51 +04:00
register_srvcmd ( " amx_plmenu_bantimes " , " plmenu_setbantimes " ) ;
register_srvcmd ( " amx_plmenu_slapdmg " , " plmenu_setslapdmg " ) ;
2005-09-13 01:06:24 +04:00
2015-01-30 02:57:45 +03:00
g_coloredMenus = colored_menus ( ) ;
2005-09-13 01:06:24 +04:00
2015-01-30 02:57:45 +03:00
new clcmds_ini_file [ 64 ] ;
get_configsdir ( clcmds_ini_file , charsmax ( clcmds_ini_file ) ) ;
format ( clcmds_ini_file , charsmax ( clcmds_ini_file ) , " %s/clcmds.ini " , clcmds_ini_file ) ;
load_settings ( clcmds_ini_file ) ;
2005-09-13 01:06:24 +04:00
2013-08-24 02:55:21 +04:00
if ( LibraryExists ( " cstrike " , LibType_Library ) )
2015-03-21 15:54:39 +03:00
{
2015-03-21 18:14:14 +03:00
g_cstrike = true ;
2015-03-21 15:54:39 +03:00
}
2013-08-24 02:55:21 +04:00
if ( LibraryExists ( " fakemeta " , LibType_Library ) )
{
2015-03-21 18:14:14 +03:00
g_fakemeta = true ;
2015-01-30 02:57:45 +03:00
m_iMenu = 205 ;
m_bTeamChanged = 501 ;
Menu_ChooseAppearance = 3 ;
2013-08-24 02:55:21 +04:00
}
2015-01-30 02:57:45 +03:00
new modname [ 9 ] ;
get_modname ( modname , charsmax ( modname ) ) ;
2015-03-21 15:54:39 +03:00
if ( equal ( modname , " cstrike " ) | | equal ( modname , " czero " ) )
2013-08-24 02:55:21 +04:00
{
2015-01-30 02:57:45 +03:00
register_event ( " TeamInfo " , " Event_TeamInfo " , " a " , " 2=TERRORIST " , " 2=CT " ) ;
register_event ( " TextMsg " , " Event_TextMsg " , " b " , " 1=4 " , " 2=#Only_1_Team_Change " ) ;
2013-08-24 02:55:21 +04:00
}
2015-01-30 02:57:45 +03:00
allow_spectators = get_cvar_pointer ( " allow_spectators " ) ;
mp_limitteams = get_cvar_pointer ( " mp_limitteams " ) ;
2005-09-11 08:31:13 +04:00
}
2013-08-16 20:49:55 +04:00
public plugin_cfg ( )
{
2015-01-30 02:57:45 +03:00
new x = get_xvar_id ( " g_tempBans " ) ;
2015-03-21 15:54:39 +03:00
if ( x )
2013-08-16 20:49:55 +04:00
{
2015-01-30 02:57:45 +03:00
g_tempBans = Trie : get_xvar_num ( x ) ;
2013-08-16 20:49:55 +04:00
}
new amx_tempban_maxtime [ ] = " amx_tempban_maxtime " ;
p_amx_tempban_maxtime = get_cvar_pointer ( amx_tempban_maxtime ) ;
2015-03-21 15:54:39 +03:00
if ( ! p_amx_tempban_maxtime )
2013-08-16 20:49:55 +04:00
{
2014-07-29 01:33:08 +04:00
p_amx_tempban_maxtime = register_cvar ( amx_tempban_maxtime , " 4320 " , FCVAR_PROTECTED ) ;
2013-08-16 20:49:55 +04:00
server_cmd ( " amx_cvar add %s " , amx_tempban_maxtime ) ;
}
}
2007-08-01 10:03:51 +04:00
public plmenu_setbantimes ( )
{
new buff [ 32 ] ;
new args = read_argc ( ) ;
2015-01-30 02:57:45 +03:00
2007-08-01 10:03:51 +04:00
if ( args < = 1 )
{
server_print ( " usage: amx_plmenu_bantimes <time1> [time2] [time3] ... " ) ;
server_print ( " use time of 0 for permanent. " ) ;
2015-01-30 02:57:45 +03:00
2007-08-01 10:03:51 +04:00
return ;
}
2015-01-30 02:57:45 +03:00
2007-08-01 10:03:51 +04:00
ArrayClear ( g_bantimes ) ;
2015-01-30 02:57:45 +03:00
2007-08-01 10:03:51 +04:00
for ( new i = 1 ; i < args ; i + + )
{
read_argv ( i , buff , charsmax ( buff ) ) ;
2015-01-30 02:57:45 +03:00
2007-08-01 10:03:51 +04:00
ArrayPushCell ( g_bantimes , str_to_num ( buff ) ) ;
}
}
2015-01-30 02:57:45 +03:00
2007-08-01 10:03:51 +04:00
public plmenu_setslapdmg ( )
{
new buff [ 32 ] ;
new args = read_argc ( ) ;
2015-01-30 02:57:45 +03:00
2007-08-01 10:03:51 +04:00
if ( args < = 1 )
{
server_print ( " usage: amx_plmenu_slapdmg <dmg1> [dmg2] [dmg3] ... " ) ;
2013-08-24 03:14:54 +04:00
server_print ( " slay is automatically set for the last value. " ) ;
2015-01-30 02:57:45 +03:00
2007-08-01 10:03:51 +04:00
return ;
}
2015-01-30 02:57:45 +03:00
2007-08-01 10:03:51 +04:00
ArrayClear ( g_slapsettings ) ;
2015-01-30 02:57:45 +03:00
2007-08-01 10:03:51 +04:00
for ( new i = 1 ; i < args ; i + + )
{
read_argv ( i , buff , charsmax ( buff ) ) ;
2015-01-30 02:57:45 +03:00
2007-08-01 10:03:51 +04:00
ArrayPushCell ( g_slapsettings , str_to_num ( buff ) ) ;
}
2013-08-24 03:14:54 +04:00
ArrayPushCell ( g_slapsettings , 0 ) ; // compensate for slay
2007-08-01 10:03:51 +04:00
}
2015-01-30 02:57:45 +03:00
2005-09-11 08:31:13 +04:00
public module_filter ( const module [ ] )
{
2013-08-24 02:55:21 +04:00
if ( equali ( module , " cstrike " ) | | equali ( module , " fakemeta " ) )
2015-03-21 15:54:39 +03:00
{
2015-01-30 02:57:45 +03:00
return PLUGIN_HANDLED ;
2015-03-21 15:54:39 +03:00
}
2015-01-30 02:57:45 +03:00
return PLUGIN_CONTINUE ;
2004-01-31 23:56:22 +03:00
}
2005-09-11 08:32:40 +04:00
public native_filter ( const name [ ] , index , trap )
{
if ( ! trap )
2015-03-21 15:54:39 +03:00
{
2015-01-30 02:57:45 +03:00
return PLUGIN_HANDLED ;
2015-03-21 15:54:39 +03:00
}
2015-01-30 02:57:45 +03:00
return PLUGIN_CONTINUE ;
2005-09-11 08:32:40 +04:00
}
2004-01-31 23:56:22 +03:00
/* Ban menu */
2005-09-13 01:06:24 +04:00
public actionBanMenu ( id , key )
{
switch ( key )
{
case 7 :
{
/* BEGIN OF CHANGES BY MISTAGEE ADDED A FEW MORE OPTIONS */
2015-01-30 02:57:45 +03:00
+ + g_menuOption [ id ] ;
2007-08-01 10:03:51 +04:00
g_menuOption [ id ] % = ArraySize ( g_bantimes ) ;
2005-09-13 01:06:24 +04:00
2007-08-01 10:03:51 +04:00
g_menuSettings [ id ] = ArrayGetCell ( g_bantimes , g_menuOption [ id ] ) ;
2005-09-13 01:06:24 +04:00
2015-01-30 02:57:45 +03:00
displayBanMenu ( id , g_menuPosition [ id ] ) ;
2005-09-13 01:06:24 +04:00
}
2015-03-21 15:54:39 +03:00
case 8 :
{
displayBanMenu ( id , + + g_menuPosition [ id ] ) ;
}
case 9 :
{
displayBanMenu ( id , - - g_menuPosition [ id ] ) ;
}
2005-09-13 01:06:24 +04:00
default :
{
2015-01-30 02:57:45 +03:00
new banTime = g_menuSettings [ id ] ;
2015-03-21 15:54:39 +03:00
if ( ~ get_user_flags ( id ) & ( ADMIN_BAN | ADMIN_RCON ) & & ( banTime < = 0 | | banTime > get_pcvar_num ( p_amx_tempban_maxtime ) ) )
2013-08-16 20:49:55 +04:00
{
console_print ( id , " %L " , id , " NO_ACC_COM " ) ;
2015-01-30 02:57:45 +03:00
displayBanMenu ( id , g_menuPosition [ id ] ) ;
return PLUGIN_HANDLED ;
2013-08-16 20:49:55 +04:00
}
2015-01-30 02:57:45 +03:00
new player = g_menuPlayers [ id ] [ g_menuPosition [ id ] * 7 + key ] ;
new name [ MAX_NAME_LENGTH ] , name2 [ MAX_NAME_LENGTH ] , authid [ 32 ] , authid2 [ 32 ] ;
get_user_name ( player , name2 , charsmax ( name2 ) ) ;
get_user_authid ( id , authid , charsmax ( authid ) ) ;
get_user_authid ( player , authid2 , charsmax ( authid2 ) ) ;
get_user_name ( id , name , charsmax ( name ) ) ;
new userid2 = get_user_userid ( player ) ;
log_amx ( " Ban: ^ " % s < % d > < % s > < > ^ " ban and kick ^ " % s < % d > < % s > < > ^ " (minutes ^ " % d ^ " ) " , name , get_user_userid ( id ) , authid , name2 , userid2 , authid2 , banTime ) ;
2005-09-13 01:06:24 +04:00
2015-03-21 15:54:39 +03:00
if ( ! banTime ) // permanent
2005-09-13 01:06:24 +04:00
{
2014-07-20 14:27:02 +04:00
for ( new i = 1 ; i < = MaxClients ; i + + )
2007-03-09 06:04:40 +03:00
{
2007-05-24 21:11:11 +04:00
show_activity_id ( i , id , name , " %L %s %L " , i , " BAN " , name2 , i , " PERM " ) ;
2007-03-09 06:04:40 +03:00
}
2007-05-24 21:11:11 +04:00
}
else
{
new tempTime [ 32 ] ;
2015-01-30 02:57:45 +03:00
num_to_str ( banTime , tempTime , charsmax ( tempTime ) ) ;
2014-07-20 14:27:02 +04:00
for ( new i = 1 ; i < = MaxClients ; i + + )
2007-03-09 06:04:40 +03:00
{
2007-05-24 21:11:11 +04:00
show_activity_id ( i , id , name , " %L %s %L " , i , " BAN " , name2 , i , " FOR_MIN " , tempTime ) ;
2007-03-09 06:04:40 +03:00
}
2005-09-13 01:06:24 +04:00
}
/ * - - - - - - - - - - check for Steam ID added by MistaGee - - - - - - - - - - - - - - - - - - - -
IF AUTHID = = 4294967295 OR VALVE_ID_LAN OR HLTV , BAN PER IP TO NOT BAN EVERYONE * /
2015-01-30 02:57:45 +03:00
2006-02-28 13:03:13 +03:00
if ( equal ( " 4294967295 " , authid2 )
| | equal ( " HLTV " , authid2 )
| | equal ( " STEAM_ID_LAN " , authid2 )
| | equali ( " VALVE_ID_LAN " , authid2 ) )
2005-09-13 01:06:24 +04:00
{
/* END OF MODIFICATIONS BY MISTAGEE */
2015-01-30 02:57:45 +03:00
new ipa [ 32 ] ;
get_user_ip ( player , ipa , charsmax ( ipa ) , 1 ) ;
server_cmd ( " addip %d %s;writeip " , banTime , ipa ) ;
2015-03-21 15:54:39 +03:00
if ( g_tempBans )
2013-08-16 20:49:55 +04:00
{
2015-01-30 02:57:45 +03:00
TrieSetString ( g_tempBans , ipa , authid ) ;
2013-08-16 20:49:55 +04:00
}
2005-09-13 01:06:24 +04:00
}
else
2007-03-09 06:04:40 +03:00
{
2015-01-30 02:57:45 +03:00
server_cmd ( " banid %d #%d kick;writeid " , banTime , userid2 ) ;
2015-03-21 15:54:39 +03:00
if ( g_tempBans )
2013-08-16 20:49:55 +04:00
{
2015-01-30 02:57:45 +03:00
TrieSetString ( g_tempBans , authid2 , authid ) ;
2013-08-16 20:49:55 +04:00
}
2007-03-09 06:04:40 +03:00
}
2005-09-13 01:06:24 +04:00
2015-01-30 02:57:45 +03:00
server_exec ( ) ;
2005-09-13 01:06:24 +04:00
2015-01-30 02:57:45 +03:00
displayBanMenu ( id , g_menuPosition [ id ] ) ;
2005-09-13 01:06:24 +04:00
}
}
2015-01-30 02:57:45 +03:00
return PLUGIN_HANDLED ;
2004-01-31 23:56:22 +03:00
}
2005-09-13 01:06:24 +04:00
displayBanMenu ( id , pos )
{
if ( pos < 0 )
2015-03-21 15:54:39 +03:00
{
2015-01-30 02:57:45 +03:00
return ;
2015-03-21 15:54:39 +03:00
}
2005-09-13 01:06:24 +04:00
2015-01-30 02:57:45 +03:00
get_players ( g_menuPlayers [ id ] , g_menuPlayersNum [ id ] ) ;
2005-09-13 01:06:24 +04:00
2015-01-30 02:57:45 +03:00
new menuBody [ 512 ] ;
new b = 0 ;
new i ;
new name [ MAX_NAME_LENGTH ] ;
new start = pos * 7 ;
2005-09-13 01:06:24 +04:00
if ( start > = g_menuPlayersNum [ id ] )
2015-03-21 15:54:39 +03:00
{
2015-01-30 02:57:45 +03:00
start = pos = g_menuPosition [ id ] = 0 ;
2015-03-21 15:54:39 +03:00
}
2005-09-13 01:06:24 +04:00
2015-01-30 02:57:45 +03:00
new len = formatex ( menuBody , charsmax ( menuBody ) , g_coloredMenus ? " \ y%L \ R%d/%d^n \ w^n " : " %L %d/%d^n^n " , id , " BAN_MENU " , pos + 1 , ( g_menuPlayersNum [ id ] / 7 + ( ( g_menuPlayersNum [ id ] % 7 ) ? 1 : 0 ) ) ) ;
new end = start + 7 ;
new keys = MENU_KEY_0 | MENU_KEY_8 ;
2005-09-13 01:06:24 +04:00
if ( end > g_menuPlayersNum [ id ] )
2015-03-21 15:54:39 +03:00
{
2015-01-30 02:57:45 +03:00
end = g_menuPlayersNum [ id ] ;
2015-03-21 15:54:39 +03:00
}
2005-09-13 01:06:24 +04:00
for ( new a = start ; a < end ; + + a )
{
2015-01-30 02:57:45 +03:00
i = g_menuPlayers [ id ] [ a ] ;
get_user_name ( i , name , charsmax ( name ) ) ;
2005-09-13 01:06:24 +04:00
2008-03-31 01:26:31 +04:00
if ( is_user_bot ( i ) | | ( access ( i , ADMIN_IMMUNITY ) & & i ! = id ) )
2005-09-13 01:06:24 +04:00
{
2015-01-30 02:57:45 +03:00
+ + b ;
2005-09-13 01:06:24 +04:00
if ( g_coloredMenus )
2015-03-21 15:54:39 +03:00
{
2015-01-30 02:57:45 +03:00
len + = formatex ( menuBody [ len ] , charsmax ( menuBody ) - len , " \ d%d. %s^n \ w " , b , name ) ;
2015-03-21 15:54:39 +03:00
}
2005-09-13 01:06:24 +04:00
else
2015-03-21 15:54:39 +03:00
{
2015-01-30 02:57:45 +03:00
len + = formatex ( menuBody [ len ] , charsmax ( menuBody ) - len , " #. %s^n " , name ) ;
2015-03-21 15:54:39 +03:00
}
}
else
{
2015-01-30 02:57:45 +03:00
keys | = ( 1 < < b ) ;
2006-06-06 02:32:00 +04:00
if ( is_user_admin ( i ) )
2015-03-21 15:54:39 +03:00
{
2015-01-30 02:57:45 +03:00
len + = formatex ( menuBody [ len ] , charsmax ( menuBody ) - len , g_coloredMenus ? " %d. %s \r *^n \ w " : " %d. %s *^n " , + + b , name ) ;
2015-03-21 15:54:39 +03:00
}
2006-06-06 02:32:00 +04:00
else
2015-03-21 15:54:39 +03:00
{
2015-01-30 02:57:45 +03:00
len + = formatex ( menuBody [ len ] , charsmax ( menuBody ) - len , " %d. %s^n " , + + b , name ) ;
2015-03-21 15:54:39 +03:00
}
2005-09-13 01:06:24 +04:00
}
}
if ( g_menuSettings [ id ] )
2015-03-21 15:54:39 +03:00
{
2015-01-30 02:57:45 +03:00
len + = formatex ( menuBody [ len ] , charsmax ( menuBody ) - len , " ^n8. %L^n " , id , " BAN_FOR_MIN " , g_menuSettings [ id ] ) ;
2015-03-21 15:54:39 +03:00
}
2005-09-13 01:06:24 +04:00
else
2015-03-21 15:54:39 +03:00
{
2015-01-30 02:57:45 +03:00
len + = formatex ( menuBody [ len ] , charsmax ( menuBody ) - len , " ^n8. %L^n " , id , " BAN_PERM " ) ;
2015-03-21 15:54:39 +03:00
}
2005-09-13 01:06:24 +04:00
if ( end ! = g_menuPlayersNum [ id ] )
{
2015-01-30 02:57:45 +03:00
formatex ( menuBody [ len ] , charsmax ( menuBody ) - len , " ^n9. %L...^n0. %L " , id , " MORE " , id , pos ? " BACK " : " EXIT " ) ;
keys | = MENU_KEY_9 ;
2005-09-13 01:06:24 +04:00
}
else
2015-03-21 15:54:39 +03:00
{
2015-01-30 02:57:45 +03:00
formatex ( menuBody [ len ] , charsmax ( menuBody ) - len , " ^n0. %L " , id , pos ? " BACK " : " EXIT " ) ;
2015-03-21 15:54:39 +03:00
}
2005-09-13 01:06:24 +04:00
2015-01-30 02:57:45 +03:00
show_menu ( id , keys , menuBody , - 1 , " Ban Menu " ) ;
2004-01-31 23:56:22 +03:00
}
2005-09-13 01:06:24 +04:00
public cmdBanMenu ( id , level , cid )
{
if ( ! cmd_access ( id , level , cid , 1 ) )
2015-03-21 15:54:39 +03:00
{
2015-01-30 02:57:45 +03:00
return PLUGIN_HANDLED ;
2015-03-21 15:54:39 +03:00
}
2015-01-30 02:57:45 +03:00
g_menuOption [ id ] = 0 ;
2004-08-06 22:40:41 +04:00
2007-08-01 10:03:51 +04:00
if ( ArraySize ( g_bantimes ) > 0 )
{
g_menuSettings [ id ] = ArrayGetCell ( g_bantimes , g_menuOption [ id ] ) ;
}
else
{
// should never happen, but failsafe
2015-01-30 02:57:45 +03:00
g_menuSettings [ id ] = 0 ;
2007-08-01 10:03:51 +04:00
}
2015-01-30 02:57:45 +03:00
displayBanMenu ( id , g_menuPosition [ id ] = 0 ) ;
2004-08-06 22:40:41 +04:00
2015-01-30 02:57:45 +03:00
return PLUGIN_HANDLED ;
2004-01-31 23:56:22 +03:00
}
/* Slap/Slay */
2005-09-13 01:06:24 +04:00
public actionSlapMenu ( id , key )
{
switch ( key )
{
case 7 :
{
2015-01-30 02:57:45 +03:00
+ + g_menuOption [ id ] ;
2007-08-01 10:03:51 +04:00
g_menuOption [ id ] % = ArraySize ( g_slapsettings ) ;
2015-01-30 02:57:45 +03:00
2007-08-01 10:03:51 +04:00
g_menuSettings [ id ] = ArrayGetCell ( g_slapsettings , g_menuOption [ id ] ) ;
2015-01-30 02:57:45 +03:00
2007-08-01 10:03:51 +04:00
displaySlapMenu ( id , g_menuPosition [ id ] ) ;
2005-09-13 01:06:24 +04:00
}
2015-03-21 15:54:39 +03:00
case 8 :
{
displaySlapMenu ( id , + + g_menuPosition [ id ] ) ;
}
case 9 :
{
displaySlapMenu ( id , - - g_menuPosition [ id ] ) ;
}
2005-09-13 01:06:24 +04:00
default :
{
2015-01-30 02:57:45 +03:00
new player = g_menuPlayers [ id ] [ g_menuPosition [ id ] * 7 + key ] ;
new name2 [ MAX_NAME_LENGTH ] ;
get_user_name ( player , name2 , charsmax ( name2 ) ) ;
2005-09-13 01:06:24 +04:00
if ( ! is_user_alive ( player ) )
{
2015-01-30 02:57:45 +03:00
client_print ( id , print_chat , " %L " , id , " CANT_PERF_DEAD " , name2 ) ;
displaySlapMenu ( id , g_menuPosition [ id ] ) ;
return PLUGIN_HANDLED ;
2005-09-13 01:06:24 +04:00
}
2015-01-30 02:57:45 +03:00
new authid [ 32 ] , authid2 [ 32 ] , name [ MAX_NAME_LENGTH ] ;
2005-09-13 01:06:24 +04:00
2015-01-30 02:57:45 +03:00
get_user_authid ( id , authid , charsmax ( authid ) ) ;
get_user_authid ( player , authid2 , charsmax ( authid2 ) ) ;
get_user_name ( id , name , charsmax ( name ) ) ;
2005-09-13 01:06:24 +04:00
2013-08-24 03:14:54 +04:00
new aSize = ArraySize ( g_slapsettings ) ;
if ( aSize > 1 & & g_menuOption [ id ] < aSize - 1 )
2005-09-13 01:06:24 +04:00
{
2015-01-30 02:57:45 +03:00
log_amx ( " Cmd: ^ " % s < % d > < % s > < > ^ " slap with %d damage ^ " % s < % d > < % s > < > ^ " " , name , get_user_userid ( id ) , authid , g_menuSettings [ id ] , name2 , get_user_userid ( player ) , authid2 ) ;
2007-05-24 21:11:11 +04:00
show_activity_key ( " ADMIN_SLAP_1 " , " ADMIN_SLAP_2 " , name , name2 , g_menuSettings [ id ] ) ;
2015-01-30 02:57:45 +03:00
user_slap ( player , ( get_user_health ( player ) > g_menuSettings [ id ] ) ? g_menuSettings [ id ] : 0 ) ;
2015-03-21 15:54:39 +03:00
}
else // aSize == 1 or g_menuOption[id] == aSize - 1 // last option
{
2015-01-30 02:57:45 +03:00
log_amx ( " Cmd: ^ " % s < % d > < % s > < > ^ " slay ^ " % s < % d > < % s > < > ^ " " , name , get_user_userid ( id ) , authid , name2 , get_user_userid ( player ) , authid2 ) ;
2007-05-24 21:11:11 +04:00
show_activity_key ( " ADMIN_SLAY_1 " , " ADMIN_SLAY_2 " , name , name2 ) ;
2015-01-30 02:57:45 +03:00
user_kill ( player ) ;
2013-08-24 03:14:54 +04:00
}
2005-09-13 01:06:24 +04:00
2015-01-30 02:57:45 +03:00
displaySlapMenu ( id , g_menuPosition [ id ] ) ;
2005-09-13 01:06:24 +04:00
}
}
2015-01-30 02:57:45 +03:00
return PLUGIN_HANDLED ;
2004-01-31 23:56:22 +03:00
}
2005-09-13 01:06:24 +04:00
displaySlapMenu ( id , pos )
{
if ( pos < 0 )
2015-03-21 15:54:39 +03:00
{
2015-01-30 02:57:45 +03:00
return ;
2015-03-21 15:54:39 +03:00
}
2005-09-13 01:06:24 +04:00
2015-01-30 02:57:45 +03:00
get_players ( g_menuPlayers [ id ] , g_menuPlayersNum [ id ] ) ;
2005-09-13 01:06:24 +04:00
2015-01-30 02:57:45 +03:00
new menuBody [ 512 ] ;
new b = 0 ;
new i ;
new name [ MAX_NAME_LENGTH ] , team [ 4 ] ;
new start = pos * 7 ;
2005-09-13 01:06:24 +04:00
if ( start > = g_menuPlayersNum [ id ] )
2015-03-21 15:54:39 +03:00
{
2015-01-30 02:57:45 +03:00
start = pos = g_menuPosition [ id ] = 0 ;
2015-03-21 15:54:39 +03:00
}
2004-01-31 23:56:22 +03:00
2015-01-30 02:57:45 +03:00
new len = formatex ( menuBody , charsmax ( menuBody ) , g_coloredMenus ? " \ y%L \ R%d/%d^n \ w^n " : " %L %d/%d^n^n " , id , " SLAP_SLAY_MENU " , pos + 1 , ( g_menuPlayersNum [ id ] / 7 + ( ( g_menuPlayersNum [ id ] % 7 ) ? 1 : 0 ) ) ) ;
new end = start + 7 ;
new keys = MENU_KEY_0 | MENU_KEY_8 ;
2005-09-13 01:06:24 +04:00
if ( end > g_menuPlayersNum [ id ] )
2015-03-21 15:54:39 +03:00
{
2015-01-30 02:57:45 +03:00
end = g_menuPlayersNum [ id ] ;
2015-03-21 15:54:39 +03:00
}
2005-09-13 01:06:24 +04:00
for ( new a = start ; a < end ; + + a )
{
2015-01-30 02:57:45 +03:00
i = g_menuPlayers [ id ] [ a ] ;
get_user_name ( i , name , charsmax ( name ) ) ;
2005-09-13 01:06:24 +04:00
if ( g_cstrike )
{
if ( cs_get_user_team ( i ) = = CS_TEAM_T )
{
2015-01-30 02:57:45 +03:00
copy ( team , charsmax ( team ) , " TE " ) ;
2005-09-13 01:06:24 +04:00
}
else if ( cs_get_user_team ( i ) = = CS_TEAM_CT )
{
2015-01-30 02:57:45 +03:00
copy ( team , charsmax ( team ) , " CT " ) ;
2015-03-21 15:54:39 +03:00
}
else
{
2015-01-30 02:57:45 +03:00
get_user_team ( i , team , charsmax ( team ) ) ;
2005-09-13 01:06:24 +04:00
}
2015-03-21 15:54:39 +03:00
}
else
{
2015-01-30 02:57:45 +03:00
get_user_team ( i , team , charsmax ( team ) ) ;
2005-09-13 01:06:24 +04:00
}
2008-03-31 01:26:31 +04:00
if ( ! is_user_alive ( i ) | | ( access ( i , ADMIN_IMMUNITY ) & & i ! = id ) )
2005-09-13 01:06:24 +04:00
{
2015-01-30 02:57:45 +03:00
+ + b ;
2005-09-13 01:06:24 +04:00
if ( g_coloredMenus )
2015-03-21 15:54:39 +03:00
{
2015-01-30 02:57:45 +03:00
len + = formatex ( menuBody [ len ] , charsmax ( menuBody ) - len , " \ d%d. %s \ R%s^n \ w " , b , name , team ) ;
2015-03-21 15:54:39 +03:00
}
2005-09-13 01:06:24 +04:00
else
2015-03-21 15:54:39 +03:00
{
2015-01-30 02:57:45 +03:00
len + = formatex ( menuBody [ len ] , charsmax ( menuBody ) - len , " #. %s %s^n " , name , team ) ;
2015-03-21 15:54:39 +03:00
}
}
else
{
2015-01-30 02:57:45 +03:00
keys | = ( 1 < < b ) ;
2006-06-06 02:32:00 +04:00
if ( is_user_admin ( i ) )
2015-03-21 15:54:39 +03:00
{
2015-01-30 02:57:45 +03:00
len + = formatex ( menuBody [ len ] , charsmax ( menuBody ) - len , g_coloredMenus ? " %d. %s \r * \ y \ R%s^n \ w " : " %d. %s * %s^n " , + + b , name , team ) ;
2015-03-21 15:54:39 +03:00
}
2006-06-06 02:32:00 +04:00
else
2015-03-21 15:54:39 +03:00
{
2015-01-30 02:57:45 +03:00
len + = formatex ( menuBody [ len ] , charsmax ( menuBody ) - len , g_coloredMenus ? " %d. %s \ y \ R%s^n \ w " : " %d. %s %s^n " , + + b , name , team ) ;
2015-03-21 15:54:39 +03:00
}
2005-09-13 01:06:24 +04:00
}
}
2013-08-24 03:14:54 +04:00
if ( g_menuOption [ id ] = = ArraySize ( g_slapsettings ) - 1 )
2015-03-21 15:54:39 +03:00
{
2015-01-30 02:57:45 +03:00
len + = formatex ( menuBody [ len ] , charsmax ( menuBody ) - len , " ^n8. %L^n " , id , " SLAY " ) ;
2015-03-21 15:54:39 +03:00
}
2013-08-24 03:14:54 +04:00
else
2015-03-21 15:54:39 +03:00
{
2015-01-30 02:57:45 +03:00
len + = formatex ( menuBody [ len ] , charsmax ( menuBody ) - len , " ^n8. %L^n " , id , " SLAP_WITH_DMG " , g_menuSettings [ id ] ) ;
2015-03-21 15:54:39 +03:00
}
2005-09-13 01:06:24 +04:00
if ( end ! = g_menuPlayersNum [ id ] )
{
2015-01-30 02:57:45 +03:00
formatex ( menuBody [ len ] , charsmax ( menuBody ) - len , " ^n9. %L...^n0. %L " , id , " MORE " , id , pos ? " BACK " : " EXIT " ) ;
keys | = MENU_KEY_9 ;
2005-09-13 01:06:24 +04:00
}
else
2015-03-21 15:54:39 +03:00
{
2015-01-30 02:57:45 +03:00
formatex ( menuBody [ len ] , charsmax ( menuBody ) - len , " ^n0. %L " , id , pos ? " BACK " : " EXIT " ) ;
2015-03-21 15:54:39 +03:00
}
2005-09-13 01:06:24 +04:00
2015-01-30 02:57:45 +03:00
show_menu ( id , keys , menuBody , - 1 , " Slap/Slay Menu " ) ;
2004-01-31 23:56:22 +03:00
}
2005-09-13 01:06:24 +04:00
public cmdSlapMenu ( id , level , cid )
2004-01-31 23:56:22 +03:00
{
2005-09-13 01:06:24 +04:00
if ( ! cmd_access ( id , level , cid , 1 ) )
2015-03-21 15:54:39 +03:00
{
2015-01-30 02:57:45 +03:00
return PLUGIN_HANDLED ;
2015-03-21 15:54:39 +03:00
}
2004-08-06 22:40:41 +04:00
2015-01-30 02:57:45 +03:00
g_menuOption [ id ] = 0 ;
2007-08-01 10:03:51 +04:00
if ( ArraySize ( g_slapsettings ) > 0 )
{
g_menuSettings [ id ] = ArrayGetCell ( g_slapsettings , g_menuOption [ id ] ) ;
}
else
{
// should never happen, but failsafe
2015-01-30 02:57:45 +03:00
g_menuSettings [ id ] = 0 ;
2007-08-01 10:03:51 +04:00
}
2004-08-06 22:40:41 +04:00
2015-01-30 02:57:45 +03:00
displaySlapMenu ( id , g_menuPosition [ id ] = 0 ) ;
2004-08-06 22:40:41 +04:00
2015-01-30 02:57:45 +03:00
return PLUGIN_HANDLED ;
2004-01-31 23:56:22 +03:00
}
/* Kick */
2005-09-13 01:06:24 +04:00
public actionKickMenu ( id , key )
2004-01-31 23:56:22 +03:00
{
2005-09-13 01:06:24 +04:00
switch ( key )
{
2015-03-21 15:54:39 +03:00
case 8 :
{
displayKickMenu ( id , + + g_menuPosition [ id ] ) ;
}
case 9 :
{
displayKickMenu ( id , - - g_menuPosition [ id ] ) ;
}
2005-09-13 01:06:24 +04:00
default :
{
2015-01-30 02:57:45 +03:00
new player = g_menuPlayers [ id ] [ g_menuPosition [ id ] * 8 + key ] ;
new authid [ 32 ] , authid2 [ 32 ] , name [ MAX_NAME_LENGTH ] , name2 [ MAX_NAME_LENGTH ] ;
get_user_authid ( id , authid , charsmax ( authid ) ) ;
get_user_authid ( player , authid2 , charsmax ( authid2 ) ) ;
get_user_name ( id , name , charsmax ( name ) ) ;
get_user_name ( player , name2 , charsmax ( name2 ) ) ;
new userid2 = get_user_userid ( player ) ;
log_amx ( " Kick: ^ " % s < % d > < % s > < > ^ " kick ^ " % s < % d > < % s > < > ^ " " , name , get_user_userid ( id ) , authid , name2 , userid2 , authid2 ) ;
2005-09-13 01:06:24 +04:00
2007-05-24 21:11:11 +04:00
show_activity_key ( " ADMIN_KICK_1 " , " ADMIN_KICK_2 " , name , name2 ) ;
2005-09-13 01:06:24 +04:00
2015-01-30 02:57:45 +03:00
server_cmd ( " kick #%d " , userid2 ) ;
server_exec ( ) ;
2005-09-13 01:06:24 +04:00
2015-01-30 02:57:45 +03:00
displayKickMenu ( id , g_menuPosition [ id ] ) ;
2005-09-13 01:06:24 +04:00
}
}
2015-01-30 02:57:45 +03:00
return PLUGIN_HANDLED ;
2004-01-31 23:56:22 +03:00
}
2005-09-13 01:06:24 +04:00
displayKickMenu ( id , pos )
{
if ( pos < 0 )
2015-03-21 15:54:39 +03:00
{
2015-01-30 02:57:45 +03:00
return ;
2015-03-21 15:54:39 +03:00
}
2004-08-06 22:40:41 +04:00
2015-01-30 02:57:45 +03:00
get_players ( g_menuPlayers [ id ] , g_menuPlayersNum [ id ] ) ;
2004-08-06 22:40:41 +04:00
2015-01-30 02:57:45 +03:00
new menuBody [ 512 ] ;
new b = 0 ;
new i ;
new name [ MAX_NAME_LENGTH ] ;
new start = pos * 8 ;
2004-08-06 22:40:41 +04:00
2005-09-13 01:06:24 +04:00
if ( start > = g_menuPlayersNum [ id ] )
2015-03-21 15:54:39 +03:00
{
2015-01-30 02:57:45 +03:00
start = pos = g_menuPosition [ id ] = 0 ;
2015-03-21 15:54:39 +03:00
}
2004-08-06 22:40:41 +04:00
2015-01-30 02:57:45 +03:00
new len = formatex ( menuBody , charsmax ( menuBody ) , g_coloredMenus ? " \ y%L \ R%d/%d^n \ w^n " : " %L %d/%d^n^n " , id , " KICK_MENU " , pos + 1 , ( g_menuPlayersNum [ id ] / 8 + ( ( g_menuPlayersNum [ id ] % 8 ) ? 1 : 0 ) ) ) ;
new end = start + 8 ;
new keys = MENU_KEY_0 ;
2004-08-06 22:40:41 +04:00
2005-09-13 01:06:24 +04:00
if ( end > g_menuPlayersNum [ id ] )
2015-03-21 15:54:39 +03:00
{
2015-01-30 02:57:45 +03:00
end = g_menuPlayersNum [ id ] ;
2015-03-21 15:54:39 +03:00
}
2004-08-06 22:40:41 +04:00
2005-09-13 01:06:24 +04:00
for ( new a = start ; a < end ; + + a )
{
2015-01-30 02:57:45 +03:00
i = g_menuPlayers [ id ] [ a ] ;
get_user_name ( i , name , charsmax ( name ) ) ;
2004-08-06 22:40:41 +04:00
2008-03-31 01:26:31 +04:00
if ( access ( i , ADMIN_IMMUNITY ) & & i ! = id )
2005-09-13 01:06:24 +04:00
{
2015-01-30 02:57:45 +03:00
+ + b ;
2005-09-13 01:06:24 +04:00
if ( g_coloredMenus )
2015-03-21 15:54:39 +03:00
{
2015-01-30 02:57:45 +03:00
len + = formatex ( menuBody [ len ] , charsmax ( menuBody ) - len , " \ d%d. %s^n \ w " , b , name ) ;
2015-03-21 15:54:39 +03:00
}
2005-09-13 01:06:24 +04:00
else
2015-03-21 15:54:39 +03:00
{
2015-01-30 02:57:45 +03:00
len + = formatex ( menuBody [ len ] , charsmax ( menuBody ) - len , " #. %s^n " , name ) ;
2015-03-21 15:54:39 +03:00
}
}
else
{
2015-01-30 02:57:45 +03:00
keys | = ( 1 < < b ) ;
2006-06-06 02:32:00 +04:00
if ( is_user_admin ( i ) )
2015-03-21 15:54:39 +03:00
{
2015-01-30 02:57:45 +03:00
len + = formatex ( menuBody [ len ] , charsmax ( menuBody ) - len , g_coloredMenus ? " %d. %s \r *^n \ w " : " %d. %s *^n " , + + b , name ) ;
2015-03-21 15:54:39 +03:00
}
2006-06-06 02:32:00 +04:00
else
2015-03-21 15:54:39 +03:00
{
2015-01-30 02:57:45 +03:00
len + = formatex ( menuBody [ len ] , charsmax ( menuBody ) - len , " %d. %s^n " , + + b , name ) ;
2015-03-21 15:54:39 +03:00
}
2005-09-13 01:06:24 +04:00
}
}
if ( end ! = g_menuPlayersNum [ id ] )
{
2015-01-30 02:57:45 +03:00
formatex ( menuBody [ len ] , charsmax ( menuBody ) - len , " ^n9. %L...^n0. %L " , id , " MORE " , id , pos ? " BACK " : " EXIT " ) ;
keys | = MENU_KEY_9 ;
2005-09-13 01:06:24 +04:00
}
else
2015-03-21 15:54:39 +03:00
{
2015-01-30 02:57:45 +03:00
formatex ( menuBody [ len ] , charsmax ( menuBody ) - len , " ^n0. %L " , id , pos ? " BACK " : " EXIT " ) ;
2015-03-21 15:54:39 +03:00
}
2005-09-13 01:06:24 +04:00
2015-01-30 02:57:45 +03:00
show_menu ( id , keys , menuBody , - 1 , " Kick Menu " ) ;
2005-09-13 01:06:24 +04:00
}
2005-08-22 12:01:01 +04:00
2005-09-13 01:06:24 +04:00
public cmdKickMenu ( id , level , cid )
{
if ( cmd_access ( id , level , cid , 1 ) )
2015-03-21 15:54:39 +03:00
{
2015-01-30 02:57:45 +03:00
displayKickMenu ( id , g_menuPosition [ id ] = 0 ) ;
2015-03-21 15:54:39 +03:00
}
2004-01-31 23:56:22 +03:00
2015-01-30 02:57:45 +03:00
return PLUGIN_HANDLED ;
2005-09-13 01:06:24 +04:00
}
2004-08-06 22:40:41 +04:00
2005-09-13 01:06:24 +04:00
/* Team menu */
2004-08-06 22:40:41 +04:00
2013-08-24 02:55:21 +04:00
public client_putinserver ( id )
{
2015-03-26 23:17:46 +03:00
g_CSPlayerCanSwitchFromSpec [ id ] = false ;
g_silent [ id ] = false ;
2013-08-24 02:55:21 +04:00
}
public Event_TeamInfo ( )
{
2015-01-30 02:57:45 +03:00
new id = read_data ( 1 ) ;
2015-03-21 15:54:39 +03:00
if ( is_user_connected ( id ) )
2013-08-24 02:55:21 +04:00
{
2015-03-26 23:17:46 +03:00
g_CSPlayerCanSwitchFromSpec [ id ] = true ;
2013-08-24 02:55:21 +04:00
}
}
2015-03-21 15:54:39 +03:00
public Event_TextMsg ( id ) // #Only_1_Team_Change
2013-08-24 02:55:21 +04:00
{
2015-03-21 15:54:39 +03:00
if ( g_transferingAdmin & & is_user_connected ( id ) & & ( id = = g_transferingAdmin | | is_user_connected ( g_transferingAdmin ) ) )
2013-08-24 02:55:21 +04:00
{
2015-01-30 02:57:45 +03:00
new name [ MAX_NAME_LENGTH ] ;
get_user_name ( id , name , charsmax ( name ) ) ;
2014-06-22 13:59:21 +04:00
client_print ( g_transferingAdmin , print_chat , " %L " , g_transferingAdmin , " CANT_PERF_PLAYER " , name ) ;
2013-08-24 02:55:21 +04:00
}
}
2005-09-13 01:06:24 +04:00
public actionTeamMenu ( id , key )
{
switch ( key )
{
2014-08-11 16:46:30 +04:00
case 6 :
{
2015-03-26 23:17:46 +03:00
g_silent [ id ] = ! g_silent [ id ] ;
2015-01-30 02:57:45 +03:00
displayTeamMenu ( id , g_menuPosition [ id ] ) ;
2014-08-11 16:46:30 +04:00
}
2005-09-13 01:06:24 +04:00
case 7 :
{
2013-08-24 02:55:21 +04:00
g_menuOption [ id ] = ( g_menuOption [ id ] + 1 ) % 3 ;
2015-01-30 02:57:45 +03:00
displayTeamMenu ( id , g_menuPosition [ id ] ) ;
2005-09-13 01:06:24 +04:00
}
2015-03-21 15:54:39 +03:00
case 8 :
{
displayTeamMenu ( id , + + g_menuPosition [ id ] ) ;
}
case 9 :
{
displayTeamMenu ( id , - - g_menuPosition [ id ] ) ;
}
2005-09-13 01:06:24 +04:00
default :
{
2015-01-30 02:57:45 +03:00
new player = g_menuPlayers [ id ] [ g_menuPosition [ id ] * 6 + key ] ;
2015-03-21 15:54:39 +03:00
if ( ! is_user_connected ( player ) ) // dunno why this check hasn't be implemented in the past
2013-08-24 02:55:21 +04:00
{
2015-01-30 02:57:45 +03:00
displayTeamMenu ( id , g_menuPosition [ id ] ) ;
return PLUGIN_HANDLED ;
2013-08-24 02:55:21 +04:00
}
2015-01-30 02:57:45 +03:00
g_transferingAdmin = id ;
2013-08-24 02:55:21 +04:00
2015-01-30 02:57:45 +03:00
new authid [ 32 ] , authid2 [ 32 ] , name [ MAX_NAME_LENGTH ] , name2 [ MAX_NAME_LENGTH ] ;
2005-09-13 01:06:24 +04:00
2015-01-30 02:57:45 +03:00
get_user_name ( player , name2 , charsmax ( name2 ) ) ;
get_user_authid ( id , authid , charsmax ( authid ) ) ;
get_user_authid ( player , authid2 , charsmax ( authid2 ) ) ;
get_user_name ( id , name , charsmax ( name ) ) ;
2005-09-13 01:06:24 +04:00
2013-08-24 02:55:21 +04:00
// This modulo math just aligns the option to the CsTeams-corresponding number
2015-01-30 02:57:45 +03:00
new destTeamSlot = ( g_menuOption [ id ] % 3 ) ;
log_amx ( " Cmd: ^ " % s < % d > < % s > < > ^ " transfer ^ " % s < % d > < % s > < > ^ " (team ^ " % s ^ " ) " , name , get_user_userid ( id ) , authid , name2 , get_user_userid ( player ) , authid2 , g_CSTeamNames [ destTeamSlot ] ) ;
2013-08-24 02:55:21 +04:00
show_activity_key ( " ADMIN_TRANSF_1 " , " ADMIN_TRANSF_2 " , name , name2 , g_CSTeamNames [ destTeamSlot ] ) ;
2015-01-30 02:57:45 +03:00
2015-03-21 15:54:39 +03:00
if ( destTeamSlot = = 2 )
2013-08-24 02:55:21 +04:00
{
2015-03-21 15:54:39 +03:00
if ( g_fakemeta )
2013-08-24 02:55:21 +04:00
{
2015-03-21 15:54:39 +03:00
if ( get_pdata_int ( player , m_iMenu ) = = Menu_ChooseAppearance )
2013-08-24 02:55:21 +04:00
{
// works for both vgui and old style menus, and send menuselect could close other menus (and since get_user_menu fails to return VGUI and old style classes menus...)
engclient_cmd ( player , " joinclass " , " 6 " ) ;
}
}
else // force
{
engclient_cmd ( player , " joinclass " , " 6 " ) ;
}
}
2005-09-13 01:06:24 +04:00
2015-03-26 23:17:46 +03:00
if ( g_CSPlayerCanSwitchFromSpec [ player ] & & g_cstrike & & ( CS_TEAM_T < = cs_get_user_team ( player ) < = CS_TEAM_CT ) )
2005-09-13 01:06:24 +04:00
{
2015-03-26 23:17:46 +03:00
if ( is_user_alive ( player ) & & ( ! g_silent [ id ] | | destTeamSlot = = 2 ) )
2006-03-15 19:14:32 +03:00
{
2015-01-30 02:57:45 +03:00
new deaths = cs_get_user_deaths ( player ) ;
user_kill ( player , 1 ) ;
cs_set_user_deaths ( player , deaths ) ;
2006-03-15 19:14:32 +03:00
}
2015-01-30 02:57:45 +03:00
cs_set_user_team ( player , destTeamSlot + 1 ) ;
2013-08-24 02:55:21 +04:00
2015-03-21 15:54:39 +03:00
}
else
{
2015-03-26 23:17:46 +03:00
if ( is_user_alive ( player ) & & ( ! g_silent [ id ] | | destTeamSlot = = 2 ) )
2013-08-24 02:55:21 +04:00
{
2015-01-30 02:57:45 +03:00
user_kill ( player , 1 ) ;
2013-08-24 02:55:21 +04:00
}
2015-03-21 15:54:39 +03:00
if ( g_fakemeta )
2013-08-24 02:55:21 +04:00
{
set_pdata_bool ( player , m_bTeamChanged , true ) ;
}
2015-01-30 02:57:45 +03:00
new limit_setting ;
2015-03-21 15:54:39 +03:00
if ( mp_limitteams )
2013-08-24 02:55:21 +04:00
{
2015-01-30 02:57:45 +03:00
limit_setting = get_pcvar_num ( mp_limitteams ) ;
set_pcvar_num ( mp_limitteams , 0 ) ;
2013-08-24 02:55:21 +04:00
}
2015-03-21 15:54:39 +03:00
if ( destTeamSlot = = 2 )
2013-08-24 02:55:21 +04:00
{
2015-01-30 02:57:45 +03:00
new Float : allow_spectators_setting ;
2015-03-21 15:54:39 +03:00
if ( allow_spectators )
2013-08-24 02:55:21 +04:00
{
2015-01-30 02:57:45 +03:00
allow_spectators_setting = get_pcvar_float ( allow_spectators ) ;
2015-03-21 15:54:39 +03:00
if ( allow_spectators_setting ! = 1.0 )
{
2015-01-30 02:57:45 +03:00
set_pcvar_float ( allow_spectators , 1.0 ) ;
2015-03-21 15:54:39 +03:00
}
2013-08-24 02:55:21 +04:00
}
2015-01-30 02:57:45 +03:00
engclient_cmd ( player , " jointeam " , g_CSTeamNumbers [ destTeamSlot ] ) ;
2015-03-21 15:54:39 +03:00
if ( allow_spectators & & allow_spectators_setting ! = 1.0 )
{
2015-01-30 02:57:45 +03:00
set_pcvar_float ( allow_spectators , allow_spectators_setting ) ;
2015-03-21 15:54:39 +03:00
}
2013-08-24 02:55:21 +04:00
}
else
{
2015-01-30 02:57:45 +03:00
engclient_cmd ( player , " jointeam " , g_CSTeamNumbers [ destTeamSlot ] ) ;
engclient_cmd ( player , " joinclass " , " 1 " ) ;
2013-08-24 02:55:21 +04:00
}
2015-03-21 15:54:39 +03:00
if ( mp_limitteams & & limit_setting ! = 0 )
2013-08-24 02:55:21 +04:00
{
2015-01-30 02:57:45 +03:00
set_pcvar_num ( mp_limitteams , limit_setting ) ;
2013-08-24 02:55:21 +04:00
}
}
2015-03-21 15:54:39 +03:00
if ( g_cstrike )
2013-08-24 02:55:21 +04:00
{
2015-01-30 02:57:45 +03:00
cs_reset_user_model ( player ) ;
2013-08-24 02:55:21 +04:00
}
2015-03-21 15:54:39 +03:00
if ( g_fakemeta )
2013-08-24 02:55:21 +04:00
{
set_pdata_bool ( player , m_bTeamChanged , true ) ;
2005-09-13 01:06:24 +04:00
}
2015-01-30 02:57:45 +03:00
g_transferingAdmin = 0 ;
displayTeamMenu ( id , g_menuPosition [ id ] ) ;
2005-09-13 01:06:24 +04:00
}
}
2015-01-30 02:57:45 +03:00
return PLUGIN_HANDLED ;
2004-01-31 23:56:22 +03:00
}
2005-09-13 01:06:24 +04:00
displayTeamMenu ( id , pos )
{
if ( pos < 0 )
2015-03-21 15:54:39 +03:00
{
2015-01-30 02:57:45 +03:00
return ;
2015-03-21 15:54:39 +03:00
}
2004-08-06 22:40:41 +04:00
2015-01-30 02:57:45 +03:00
get_players ( g_menuPlayers [ id ] , g_menuPlayersNum [ id ] ) ;
2004-01-31 23:56:22 +03:00
2015-01-30 02:57:45 +03:00
new menuBody [ 512 ] ;
new b = 0 ;
new i , iteam ;
new name [ MAX_NAME_LENGTH ] , team [ 4 ] ;
new start = pos * 6 ;
2004-01-31 23:56:22 +03:00
2005-09-13 01:06:24 +04:00
if ( start > = g_menuPlayersNum [ id ] )
2015-03-21 15:54:39 +03:00
{
2015-01-30 02:57:45 +03:00
start = pos = g_menuPosition [ id ] = 0 ;
2015-03-21 15:54:39 +03:00
}
2005-09-13 01:06:24 +04:00
2015-01-30 02:57:45 +03:00
new len = formatex ( menuBody , charsmax ( menuBody ) , g_coloredMenus ? " \ y%L \ R%d/%d^n \ w^n " : " %L %d/%d^n^n " , id , " TEAM_MENU " , pos + 1 , ( g_menuPlayersNum [ id ] / 6 + ( ( g_menuPlayersNum [ id ] % 6 ) ? 1 : 0 ) ) ) ;
new end = start + 6 ;
new keys = MENU_KEY_0 | MENU_KEY_7 | MENU_KEY_8 ;
2004-01-31 23:56:22 +03:00
2005-09-13 01:06:24 +04:00
if ( end > g_menuPlayersNum [ id ] )
2015-03-21 15:54:39 +03:00
{
2015-01-30 02:57:45 +03:00
end = g_menuPlayersNum [ id ] ;
2015-03-21 15:54:39 +03:00
}
2004-01-31 23:56:22 +03:00
2005-09-13 01:06:24 +04:00
for ( new a = start ; a < end ; + + a )
{
2015-01-30 02:57:45 +03:00
i = g_menuPlayers [ id ] [ a ] ;
get_user_name ( i , name , charsmax ( name ) ) ;
2005-09-13 01:06:24 +04:00
if ( g_cstrike )
{
2015-01-30 02:57:45 +03:00
iteam = _ : cs_get_user_team ( i ) ;
2005-09-13 01:06:24 +04:00
if ( iteam = = 1 )
{
2015-01-30 02:57:45 +03:00
copy ( team , charsmax ( team ) , " TE " ) ;
2005-09-13 01:06:24 +04:00
}
else if ( iteam = = 2 )
{
2015-01-30 02:57:45 +03:00
copy ( team , charsmax ( team ) , " CT " ) ;
2007-08-08 06:32:53 +04:00
}
else if ( iteam = = 3 )
{
2014-07-29 18:32:32 +04:00
copy ( team , charsmax ( team ) , " SPE " ) ;
2013-08-24 02:55:21 +04:00
// iteam = 6; // oO WTF is this ?? fixed g_CSTeamiNumbers.
2015-03-21 15:54:39 +03:00
}
else
{
2015-01-30 02:57:45 +03:00
iteam = get_user_team ( i , team , charsmax ( team ) ) ;
2005-09-13 01:06:24 +04:00
}
2015-03-21 15:54:39 +03:00
}
else
{
2015-01-30 02:57:45 +03:00
iteam = get_user_team ( i , team , charsmax ( team ) ) ;
2005-09-13 01:06:24 +04:00
}
2015-03-21 15:54:39 +03:00
if ( ! iteam )
2013-08-24 02:55:21 +04:00
{
2015-01-30 02:57:45 +03:00
iteam = 3 ; // fix get_user_team returning 0 on spectators
2013-08-24 02:55:21 +04:00
}
2005-09-13 01:06:24 +04:00
2013-08-24 02:55:21 +04:00
if ( ( iteam = = g_CSTeamiNumbers [ g_menuOption [ id ] % 3 ] ) | | ( access ( i , ADMIN_IMMUNITY ) & & i ! = id ) )
2005-09-13 01:06:24 +04:00
{
2015-01-30 02:57:45 +03:00
+ + b ;
2005-09-13 01:06:24 +04:00
if ( g_coloredMenus )
2015-03-21 15:54:39 +03:00
{
2015-01-30 02:57:45 +03:00
len + = formatex ( menuBody [ len ] , charsmax ( menuBody ) - len , " \ d%d. %s \ R%s^n \ w " , b , name , team ) ;
2015-03-21 15:54:39 +03:00
}
2005-09-13 01:06:24 +04:00
else
2015-03-21 15:54:39 +03:00
{
2015-01-30 02:57:45 +03:00
len + = formatex ( menuBody [ len ] , charsmax ( menuBody ) - len , " #. %s %s^n " , name , team ) ;
2015-03-21 15:54:39 +03:00
}
}
else
{
2015-01-30 02:57:45 +03:00
keys | = ( 1 < < b ) ;
2006-06-06 02:32:00 +04:00
if ( is_user_admin ( i ) )
2015-03-21 15:54:39 +03:00
{
2015-01-30 02:57:45 +03:00
len + = formatex ( menuBody [ len ] , charsmax ( menuBody ) - len , g_coloredMenus ? " %d. %s \r * \ y \ R%s^n \ w " : " %d. %s * %s^n " , + + b , name , team ) ;
2015-03-21 15:54:39 +03:00
}
2006-06-06 02:32:00 +04:00
else
2015-03-21 15:54:39 +03:00
{
2015-01-30 02:57:45 +03:00
len + = formatex ( menuBody [ len ] , charsmax ( menuBody ) - len , g_coloredMenus ? " %d. %s \ y \ R%s^n \ w " : " %d. %s %s^n " , + + b , name , team ) ;
2015-03-21 15:54:39 +03:00
}
2005-09-13 01:06:24 +04:00
}
}
2015-01-30 02:57:45 +03:00
2015-03-26 23:17:46 +03:00
len + = formatex ( menuBody [ len ] , charsmax ( menuBody ) - len , " ^n7. %L: %L " , id , " TRANSF_SILENT " , id , g_silent [ id ] ? " YES " : " NO " ) ;
2015-01-30 02:57:45 +03:00
len + = formatex ( menuBody [ len ] , charsmax ( menuBody ) - len , " ^n8. %L^n " , id , " TRANSF_TO " , g_CSTeamNames [ g_menuOption [ id ] % 3 ] ) ;
2005-09-13 01:06:24 +04:00
if ( end ! = g_menuPlayersNum [ id ] )
{
2015-01-30 02:57:45 +03:00
formatex ( menuBody [ len ] , charsmax ( menuBody ) - len , " ^n9. %L...^n0. %L " , id , " MORE " , id , pos ? " BACK " : " EXIT " ) ;
keys | = MENU_KEY_9 ;
2005-09-13 01:06:24 +04:00
}
else
2015-03-21 15:54:39 +03:00
{
2015-01-30 02:57:45 +03:00
formatex ( menuBody [ len ] , charsmax ( menuBody ) - len , " ^n0. %L " , id , pos ? " BACK " : " EXIT " ) ;
2015-03-21 15:54:39 +03:00
}
2005-09-13 01:06:24 +04:00
2015-01-30 02:57:45 +03:00
show_menu ( id , keys , menuBody , - 1 , " Team Menu " ) ;
2004-01-31 23:56:22 +03:00
}
2005-09-13 01:06:24 +04:00
public cmdTeamMenu ( id , level , cid )
{
if ( ! cmd_access ( id , level , cid , 1 ) )
2015-03-21 15:54:39 +03:00
{
2015-01-30 02:57:45 +03:00
return PLUGIN_HANDLED ;
2015-03-21 15:54:39 +03:00
}
2004-08-06 22:40:41 +04:00
2015-01-30 02:57:45 +03:00
g_menuOption [ id ] = 0 ;
2004-01-31 23:56:22 +03:00
2015-01-30 02:57:45 +03:00
displayTeamMenu ( id , g_menuPosition [ id ] = 0 ) ;
2004-08-06 22:40:41 +04:00
2015-01-30 02:57:45 +03:00
return PLUGIN_HANDLED ;
2004-01-31 23:56:22 +03:00
}
/* Client cmds menu */
2005-09-13 01:06:24 +04:00
public actionClcmdMenu ( id , key )
{
switch ( key )
{
case 7 :
{
2015-01-30 02:57:45 +03:00
+ + g_menuOption [ id ] ;
g_menuOption [ id ] % = g_menuSelectNum [ id ] ;
displayClcmdMenu ( id , g_menuPosition [ id ] ) ;
2005-09-13 01:06:24 +04:00
}
2015-03-21 15:54:39 +03:00
case 8 :
{
displayClcmdMenu ( id , + + g_menuPosition [ id ] ) ;
}
case 9 :
{
displayClcmdMenu ( id , - - g_menuPosition [ id ] ) ;
}
2005-09-13 01:06:24 +04:00
default :
{
2015-01-30 02:57:45 +03:00
new player = g_menuPlayers [ id ] [ g_menuPosition [ id ] * 7 + key ] ;
new flags = g_clcmdMisc [ g_menuSelect [ id ] [ g_menuOption [ id ] ] ] [ 1 ] ;
2005-09-13 01:06:24 +04:00
if ( is_user_connected ( player ) )
{
2017-01-22 06:58:03 +03:00
new command [ 512 ] , authid [ 32 ] , userid [ 32 ] ;
2015-01-30 02:57:45 +03:00
copy ( command , charsmax ( command ) , g_clcmdCmd [ g_menuSelect [ id ] [ g_menuOption [ id ] ] ] ) ;
get_user_authid ( player , authid , charsmax ( authid ) ) ;
num_to_str ( get_user_userid ( player ) , userid , charsmax ( userid ) ) ;
replace ( command , charsmax ( command ) , " %userid% " , userid ) ;
replace ( command , charsmax ( command ) , " %authid% " , authid ) ;
2005-09-13 01:06:24 +04:00
if ( flags & 1 )
{
2015-01-30 02:57:45 +03:00
server_cmd ( " %s " , command ) ;
server_exec ( ) ;
2015-03-21 15:54:39 +03:00
}
else if ( flags & 2 )
{
2015-01-30 02:57:45 +03:00
client_cmd ( id , " %s " , command ) ;
2015-03-21 15:54:39 +03:00
}
2005-09-13 01:06:24 +04:00
else if ( flags & 4 )
2015-03-21 15:54:39 +03:00
{
2015-01-30 02:57:45 +03:00
client_cmd ( player , " %s " , command ) ;
2015-03-21 15:54:39 +03:00
}
2005-09-13 01:06:24 +04:00
}
2015-01-30 02:57:45 +03:00
2005-09-13 01:06:24 +04:00
if ( flags & 8 )
2015-03-21 15:54:39 +03:00
{
2015-01-30 02:57:45 +03:00
displayClcmdMenu ( id , g_menuPosition [ id ] ) ;
2015-03-21 15:54:39 +03:00
}
2005-09-13 01:06:24 +04:00
}
}
2015-01-30 02:57:45 +03:00
return PLUGIN_HANDLED ;
2004-01-31 23:56:22 +03:00
}
2005-09-13 01:06:24 +04:00
displayClcmdMenu ( id , pos )
{
if ( pos < 0 )
2015-03-21 15:54:39 +03:00
{
2015-01-30 02:57:45 +03:00
return ;
2015-03-21 15:54:39 +03:00
}
2005-09-13 01:06:24 +04:00
2015-01-30 02:57:45 +03:00
get_players ( g_menuPlayers [ id ] , g_menuPlayersNum [ id ] ) ;
2005-09-13 01:06:24 +04:00
2015-01-30 02:57:45 +03:00
new menuBody [ 512 ] ;
new b = 0 ;
new i ;
new name [ MAX_NAME_LENGTH ] ;
new start = pos * 7 ;
2005-09-13 01:06:24 +04:00
if ( start > = g_menuPlayersNum [ id ] )
2015-03-21 15:54:39 +03:00
{
2015-01-30 02:57:45 +03:00
start = pos = g_menuPosition [ id ] = 0 ;
2015-03-21 15:54:39 +03:00
}
2005-09-13 01:06:24 +04:00
2015-01-30 02:57:45 +03:00
new len = formatex ( menuBody , charsmax ( menuBody ) , g_coloredMenus ? " \ y%L \ R%d/%d^n \ w^n " : " %L %d/%d^n^n " , id , " CL_CMD_MENU " , pos + 1 , ( g_menuPlayersNum [ id ] / 7 + ( ( g_menuPlayersNum [ id ] % 7 ) ? 1 : 0 ) ) ) ;
new end = start + 7 ;
new keys = MENU_KEY_0 | MENU_KEY_8 ;
2005-09-13 01:06:24 +04:00
if ( end > g_menuPlayersNum [ id ] )
2015-03-21 15:54:39 +03:00
{
2015-01-30 02:57:45 +03:00
end = g_menuPlayersNum [ id ] ;
2015-03-21 15:54:39 +03:00
}
2005-09-13 01:06:24 +04:00
for ( new a = start ; a < end ; + + a )
{
2015-01-30 02:57:45 +03:00
i = g_menuPlayers [ id ] [ a ] ;
get_user_name ( i , name , charsmax ( name ) ) ;
2005-09-13 01:06:24 +04:00
2008-03-31 01:26:31 +04:00
if ( ! g_menuSelectNum [ id ] | | ( access ( i , ADMIN_IMMUNITY ) & & i ! = id ) )
2005-09-13 01:06:24 +04:00
{
2015-01-30 02:57:45 +03:00
+ + b ;
2005-09-13 01:06:24 +04:00
if ( g_coloredMenus )
2015-03-21 15:54:39 +03:00
{
2015-01-30 02:57:45 +03:00
len + = formatex ( menuBody [ len ] , charsmax ( menuBody ) - len , " \ d%d. %s^n \ w " , b , name ) ;
2015-03-21 15:54:39 +03:00
}
2005-09-13 01:06:24 +04:00
else
2015-03-21 15:54:39 +03:00
{
2015-01-30 02:57:45 +03:00
len + = formatex ( menuBody [ len ] , charsmax ( menuBody ) - len , " #. %s^n " , name ) ;
2015-03-21 15:54:39 +03:00
}
}
else
{
2015-01-30 02:57:45 +03:00
keys | = ( 1 < < b ) ;
2006-06-06 02:32:00 +04:00
if ( is_user_admin ( i ) )
2015-03-21 15:54:39 +03:00
{
2015-01-30 02:57:45 +03:00
len + = formatex ( menuBody [ len ] , charsmax ( menuBody ) - len , g_coloredMenus ? " %d. %s \r *^n \ w " : " %d. %s *^n " , + + b , name ) ;
2015-03-21 15:54:39 +03:00
}
2006-06-06 02:32:00 +04:00
else
2015-03-21 15:54:39 +03:00
{
2015-01-30 02:57:45 +03:00
len + = formatex ( menuBody [ len ] , charsmax ( menuBody ) - len , " %d. %s^n " , + + b , name ) ;
2015-03-21 15:54:39 +03:00
}
2005-09-13 01:06:24 +04:00
}
}
if ( g_menuSelectNum [ id ] )
2015-03-21 15:54:39 +03:00
{
2015-01-30 02:57:45 +03:00
len + = formatex ( menuBody [ len ] , charsmax ( menuBody ) - len , " ^n8. %s^n " , g_clcmdName [ g_menuSelect [ id ] [ g_menuOption [ id ] ] ] ) ;
2015-03-21 15:54:39 +03:00
}
2005-09-13 01:06:24 +04:00
else
2015-03-21 15:54:39 +03:00
{
2015-01-30 02:57:45 +03:00
len + = formatex ( menuBody [ len ] , charsmax ( menuBody ) - len , " ^n8. %L^n " , id , " NO_CMDS " ) ;
2015-03-21 15:54:39 +03:00
}
2005-09-13 01:06:24 +04:00
if ( end ! = g_menuPlayersNum [ id ] )
{
2015-01-30 02:57:45 +03:00
formatex ( menuBody [ len ] , charsmax ( menuBody ) - len , " ^n9. %L...^n0. %L " , id , " MORE " , id , pos ? " BACK " : " EXIT " ) ;
keys | = MENU_KEY_9 ;
2005-09-13 01:06:24 +04:00
}
else
2015-03-21 15:54:39 +03:00
{
2015-01-30 02:57:45 +03:00
formatex ( menuBody [ len ] , charsmax ( menuBody ) - len , " ^n0. %L " , id , pos ? " BACK " : " EXIT " ) ;
2015-03-21 15:54:39 +03:00
}
2005-09-13 01:06:24 +04:00
2015-01-30 02:57:45 +03:00
show_menu ( id , keys , menuBody , - 1 , " Client Cmds Menu " ) ;
2004-01-31 23:56:22 +03:00
}
2005-09-13 01:06:24 +04:00
public cmdClcmdMenu ( id , level , cid )
{
if ( ! cmd_access ( id , level , cid , 1 ) )
2015-03-21 15:54:39 +03:00
{
2015-01-30 02:57:45 +03:00
return PLUGIN_HANDLED ;
2015-03-21 15:54:39 +03:00
}
2004-08-06 22:40:41 +04:00
2015-01-30 02:57:45 +03:00
g_menuSelectNum [ id ] = 0 ;
2004-08-06 22:40:41 +04:00
2005-09-13 01:06:24 +04:00
for ( new a = 0 ; a < g_clcmdNum ; + + a )
2015-03-21 15:54:39 +03:00
{
2007-06-22 21:47:32 +04:00
if ( access ( id , g_clcmdMisc [ a ] [ 0 ] ) )
2015-03-21 15:54:39 +03:00
{
2015-01-30 02:57:45 +03:00
g_menuSelect [ id ] [ g_menuSelectNum [ id ] + + ] = a ;
2015-03-21 15:54:39 +03:00
}
}
2004-08-06 22:40:41 +04:00
2015-01-30 02:57:45 +03:00
g_menuOption [ id ] = 0 ;
2004-08-06 22:40:41 +04:00
2015-01-30 02:57:45 +03:00
displayClcmdMenu ( id , g_menuPosition [ id ] = 0 ) ;
2004-08-06 22:40:41 +04:00
2015-01-30 02:57:45 +03:00
return PLUGIN_HANDLED ;
2004-01-31 23:56:22 +03:00
}
2005-09-13 01:06:24 +04:00
load_settings ( szFilename [ ] )
{
if ( ! file_exists ( szFilename ) )
2015-03-21 15:54:39 +03:00
{
2015-01-30 02:57:45 +03:00
return 0 ;
2015-03-21 15:54:39 +03:00
}
2005-09-13 01:06:24 +04:00
2015-01-30 02:57:45 +03:00
new text [ 256 ] , szFlags [ 32 ] , szAccess [ 32 ] ;
new a , pos = 0 ;
2005-09-13 01:06:24 +04:00
2014-07-29 18:32:32 +04:00
while ( g_clcmdNum < MAX_CLCMDS & & read_file ( szFilename , pos + + , text , charsmax ( text ) , a ) )
2005-09-13 01:06:24 +04:00
{
2015-03-21 15:54:39 +03:00
if ( text [ 0 ] = = ';' )
{
continue ;
}
2005-09-13 01:06:24 +04:00
2014-07-29 18:32:32 +04:00
if ( parse ( text , g_clcmdName [ g_clcmdNum ] , charsmax ( g_clcmdName [ ] ) , g_clcmdCmd [ g_clcmdNum ] , charsmax ( g_clcmdCmd [ ] ) , szFlags , charsmax ( szFlags ) , szAccess , charsmax ( szAccess ) ) > 3 )
2005-09-13 01:06:24 +04:00
{
2014-07-29 18:32:32 +04:00
while ( replace ( g_clcmdCmd [ g_clcmdNum ] , charsmax ( g_clcmdCmd [ ] ) , " \' " , " ^ " " ))
2005-09-13 01:06:24 +04:00
{
// do nothing
}
2015-01-30 02:57:45 +03:00
g_clcmdMisc [ g_clcmdNum ] [ 1 ] = read_flags ( szFlags ) ;
g_clcmdMisc [ g_clcmdNum ] [ 0 ] = read_flags ( szAccess ) ;
g_clcmdNum + + ;
2005-09-13 01:06:24 +04:00
}
}
2015-01-30 02:57:45 +03:00
return 1 ;
2004-08-22 08:25:55 +04:00
}
2015-07-11 00:39:34 +03:00
public plugin_end ( )
{
ArrayDestroy ( g_bantimes ) ;
ArrayDestroy ( g_slapsettings ) ;
}