2004-02-21 19:36:35 +00:00
|
|
|
/* AMX Mod X
|
|
|
|
* Menus Front-End Plugin
|
2004-01-31 20:56:22 +00:00
|
|
|
*
|
2004-02-21 19:36:35 +00:00
|
|
|
* by the AMX Mod X Development Team
|
|
|
|
* originally developed by OLO
|
2004-01-31 20:56:22 +00:00
|
|
|
*
|
2004-02-21 19:36:35 +00:00
|
|
|
* This file is part of AMX Mod X.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify it
|
|
|
|
* under the terms of the GNU General Public License as published by the
|
|
|
|
* Free Software Foundation; either version 2 of the License, or (at
|
|
|
|
* your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful, but
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software Foundation,
|
|
|
|
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
*
|
|
|
|
* In addition, as a special exception, the author gives permission to
|
|
|
|
* link the code of this program with the Half-Life Game Engine ("HL
|
|
|
|
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
|
|
|
|
* L.L.C ("Valve"). You must obey the GNU General Public License in all
|
|
|
|
* respects for all of the code used other than the HL Engine and MODs
|
|
|
|
* from Valve. If you modify this file, you may extend this exception
|
|
|
|
* to your version of the file, but you are not obligated to do so. If
|
|
|
|
* you do not wish to do so, delete this exception statement from your
|
|
|
|
* version.
|
2004-01-31 20:56:22 +00:00
|
|
|
*/
|
|
|
|
|
2004-03-05 19:35:38 +00:00
|
|
|
#include <amxmodx>
|
2004-03-07 14:30:53 +00:00
|
|
|
#include <amxmisc>
|
2004-01-31 20:56:22 +00:00
|
|
|
|
|
|
|
new g_menuPosition[33]
|
|
|
|
|
2004-08-05 11:09:16 +00:00
|
|
|
#define MENUS_NUMBER 16
|
2004-01-31 20:56:22 +00:00
|
|
|
|
|
|
|
new g_menuBody[MENUS_NUMBER][] = {
|
2004-08-05 11:09:16 +00:00
|
|
|
"KICK_PLAYER",
|
|
|
|
"BAN_PLAYER",
|
|
|
|
"SLAP_SLAY",
|
|
|
|
"TEAM_PLAYER",
|
2004-01-31 20:56:22 +00:00
|
|
|
|
2004-08-05 11:09:16 +00:00
|
|
|
"CHANGEL",
|
|
|
|
"VOTE_MAPS",
|
2004-01-31 20:56:22 +00:00
|
|
|
|
2004-08-05 11:09:16 +00:00
|
|
|
"SPECH_STUFF",
|
|
|
|
"CLIENT_COM",
|
2004-01-31 20:56:22 +00:00
|
|
|
|
2004-08-05 11:09:16 +00:00
|
|
|
// Next Page
|
2004-01-31 20:56:22 +00:00
|
|
|
|
2004-08-05 11:09:16 +00:00
|
|
|
"SERVER_COM",
|
|
|
|
"CVARS_SET",
|
|
|
|
"CONFIG",
|
|
|
|
"LANG_SET",
|
|
|
|
"STATS_SET",
|
2004-01-31 20:56:22 +00:00
|
|
|
|
2004-08-05 11:09:16 +00:00
|
|
|
"PAUSE_PLUG",
|
|
|
|
"RES_WEAP",
|
2004-01-31 20:56:22 +00:00
|
|
|
|
2004-08-05 11:09:16 +00:00
|
|
|
"TELE_PLAYER" /* Last is Teleport menu - if you want to move it
|
|
|
|
change also code in displayMenu (look for fun module check) */
|
2004-01-31 20:56:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
new g_menuCmd[MENUS_NUMBER][] = {
|
2004-08-05 11:09:16 +00:00
|
|
|
"amx_kickmenu",
|
|
|
|
"amx_banmenu",
|
|
|
|
"amx_slapmenu",
|
|
|
|
"amx_teammenu",
|
2004-01-31 20:56:22 +00:00
|
|
|
|
2004-08-05 11:09:16 +00:00
|
|
|
"amx_mapmenu",
|
|
|
|
"amx_votemapmenu",
|
2004-01-31 20:56:22 +00:00
|
|
|
|
2004-08-05 11:09:16 +00:00
|
|
|
"amx_speechmenu",
|
|
|
|
"amx_clcmdmenu",
|
2004-01-31 20:56:22 +00:00
|
|
|
|
2004-08-05 11:09:16 +00:00
|
|
|
// Next Page
|
2004-01-31 20:56:22 +00:00
|
|
|
|
2004-08-05 11:09:16 +00:00
|
|
|
"amx_cmdmenu",
|
|
|
|
"amx_cvarmenu",
|
|
|
|
"amx_cfgmenu",
|
2004-08-19 22:21:11 +00:00
|
|
|
"amx_langmenu",
|
2004-08-05 11:09:16 +00:00
|
|
|
"amx_statscfgmenu",
|
2004-01-31 20:56:22 +00:00
|
|
|
|
2004-08-05 11:09:16 +00:00
|
|
|
"amx_pausecfgmenu",
|
|
|
|
"amx_restmenu",
|
2004-01-31 20:56:22 +00:00
|
|
|
|
2004-08-05 11:09:16 +00:00
|
|
|
"amx_teleportmenu"
|
2004-01-31 20:56:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Second value sets if menu is only for CS...
|
|
|
|
new g_menuAccess[MENUS_NUMBER][2] = {
|
|
|
|
{ADMIN_KICK,0},
|
|
|
|
{ADMIN_BAN,0},
|
|
|
|
{ADMIN_SLAY,0},
|
|
|
|
{ADMIN_LEVEL_A,1},
|
|
|
|
|
|
|
|
{ADMIN_MAP,0},
|
|
|
|
{ADMIN_MAP,0},
|
|
|
|
|
|
|
|
{ADMIN_MENU,0},
|
|
|
|
{ADMIN_LEVEL_A,0},
|
|
|
|
|
2004-08-05 11:09:16 +00:00
|
|
|
// Next Page
|
2004-01-31 20:56:22 +00:00
|
|
|
|
|
|
|
{ADMIN_MENU,0},
|
|
|
|
{ADMIN_CVAR,0},
|
|
|
|
{ADMIN_MENU,0},
|
2004-08-05 11:09:16 +00:00
|
|
|
{ADMIN_CFG,0},
|
2004-01-31 20:56:22 +00:00
|
|
|
{ADMIN_CFG,1},
|
|
|
|
|
|
|
|
{ADMIN_CFG,0},
|
|
|
|
{ADMIN_CFG,1},
|
|
|
|
|
|
|
|
{ADMIN_LEVEL_A,0}
|
|
|
|
}
|
|
|
|
|
2004-07-26 15:48:12 +00:00
|
|
|
new g_coloredMenus
|
2004-01-31 20:56:22 +00:00
|
|
|
new g_cstrikeRunning
|
|
|
|
new g_funModule
|
|
|
|
|
2004-08-05 11:09:16 +00:00
|
|
|
public plugin_init() {
|
2004-07-30 23:39:39 +00:00
|
|
|
register_plugin("Menus Front-End",AMXX_VERSION_STR,"AMXX Dev Team")
|
2004-01-31 20:56:22 +00:00
|
|
|
|
2004-08-05 11:09:16 +00:00
|
|
|
register_dictionary("menufront.txt")
|
|
|
|
register_dictionary("common.txt")
|
|
|
|
|
2004-03-04 20:16:45 +00:00
|
|
|
register_menucmd(register_menuid("AMX Mod X Menu"),1023,"actionMenu")
|
2004-01-31 20:56:22 +00:00
|
|
|
register_clcmd("amxmodmenu","cmdMenu",ADMIN_MENU,"- displays menus")
|
2004-02-15 00:31:45 +00:00
|
|
|
|
2004-07-26 15:48:12 +00:00
|
|
|
g_coloredMenus = colored_menus()
|
2004-07-27 16:45:00 +00:00
|
|
|
g_cstrikeRunning = cstrike_running()
|
2004-03-04 20:16:45 +00:00
|
|
|
g_funModule = is_module_loaded("Fun")
|
2004-01-31 20:56:22 +00:00
|
|
|
}
|
|
|
|
|
2004-08-05 11:09:16 +00:00
|
|
|
public actionMenu(id,key) {
|
|
|
|
switch (key) {
|
2004-03-04 20:16:45 +00:00
|
|
|
case 8: displayMenu(id,++g_menuPosition[id])
|
|
|
|
case 9: displayMenu(id,--g_menuPosition[id])
|
|
|
|
default: client_cmd(id, g_menuCmd[ g_menuPosition[id] * 8 + key ] )
|
2004-01-31 20:56:22 +00:00
|
|
|
}
|
|
|
|
return PLUGIN_HANDLED
|
|
|
|
}
|
|
|
|
|
2004-08-05 11:09:16 +00:00
|
|
|
displayMenu(id,pos) {
|
2004-01-31 20:56:22 +00:00
|
|
|
if (pos < 0) return
|
|
|
|
|
|
|
|
new menuBody[512]
|
|
|
|
new b = 0
|
|
|
|
new start = pos * 8
|
|
|
|
|
|
|
|
if ( start >= MENUS_NUMBER )
|
|
|
|
start = pos = g_menuPosition[id] = 0
|
|
|
|
|
|
|
|
new len = format(menuBody,511,
|
2004-07-26 15:48:12 +00:00
|
|
|
g_coloredMenus ? "\yAMX Mod X Menu\R%d/%d^n\w^n" : "AMX Mod X Menu %d/%d^n^n" , pos+1, 2 )
|
2004-01-31 20:56:22 +00:00
|
|
|
|
|
|
|
new end = start + 8
|
2004-07-29 10:58:54 +00:00
|
|
|
new keys = MENU_KEY_0
|
2004-01-31 20:56:22 +00:00
|
|
|
|
|
|
|
if (end > MENUS_NUMBER )
|
|
|
|
end = MENUS_NUMBER
|
|
|
|
|
|
|
|
new flags = get_user_flags(id)
|
|
|
|
|
2004-08-05 11:09:16 +00:00
|
|
|
for (new a = start; a < end; ++a) {
|
2004-01-31 20:56:22 +00:00
|
|
|
if ( a == MENUS_NUMBER - 1 && !g_funModule )
|
|
|
|
continue // checks if there is fun module for teleport menu
|
|
|
|
|
2004-08-05 11:09:16 +00:00
|
|
|
if ( (flags & g_menuAccess[a][0]) && ( g_menuAccess[a][1] ? g_cstrikeRunning : 1 ) ) {
|
2004-01-31 20:56:22 +00:00
|
|
|
keys |= (1<<b)
|
2004-08-05 11:09:16 +00:00
|
|
|
len += format(menuBody[len],511-len,"%d. %L^n",++b, id, g_menuBody[ a ] )
|
2004-01-31 20:56:22 +00:00
|
|
|
}
|
2004-08-05 11:09:16 +00:00
|
|
|
else {
|
2004-01-31 20:56:22 +00:00
|
|
|
++b
|
2004-07-26 15:48:12 +00:00
|
|
|
if ( g_coloredMenus )
|
2004-08-05 11:09:16 +00:00
|
|
|
len += format(menuBody[len],511-len, "\d%d. %L^n\w",b, id, g_menuBody[ a ] )
|
2004-01-31 20:56:22 +00:00
|
|
|
else
|
2004-08-05 11:09:16 +00:00
|
|
|
len += format(menuBody[len],511-len, "#. %L^n", id, g_menuBody[ a ] )
|
2004-01-31 20:56:22 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-08-05 11:09:16 +00:00
|
|
|
if (end != MENUS_NUMBER ) {
|
2004-08-19 22:21:11 +00:00
|
|
|
format(menuBody[len],511-len,"^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT")
|
2004-07-29 10:58:54 +00:00
|
|
|
keys |= MENU_KEY_9
|
2004-01-31 20:56:22 +00:00
|
|
|
}
|
2004-08-19 22:21:11 +00:00
|
|
|
else format(menuBody[len],511-len,"^n0. %L", id, pos ? "BACK" : "EXIT")
|
2004-01-31 20:56:22 +00:00
|
|
|
|
|
|
|
show_menu(id,keys,menuBody)
|
|
|
|
}
|
|
|
|
|
2004-08-05 11:09:16 +00:00
|
|
|
public cmdMenu(id,level,cid) {
|
2004-01-31 20:56:22 +00:00
|
|
|
if (cmd_access(id,level,cid,1))
|
|
|
|
displayMenu(id,g_menuPosition[id] = 0)
|
|
|
|
return PLUGIN_HANDLED
|
|
|
|
}
|