mirror of
https://github.com/alliedmodders/amxmodx.git
synced 2024-12-24 13:55:36 +03:00
better detection for available menus
This commit is contained in:
parent
293486ff12
commit
160f52ec39
@ -62,8 +62,7 @@ new g_menuBody[MENUS_NUMBER][] = {
|
|||||||
"PAUSE_PLUG",
|
"PAUSE_PLUG",
|
||||||
"RES_WEAP",
|
"RES_WEAP",
|
||||||
|
|
||||||
"TELE_PLAYER" /* Last is Teleport menu - if you want to move it
|
"TELE_PLAYER"
|
||||||
change also code in displayMenu (look for fun module check) */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
new g_menuCmd[MENUS_NUMBER][] = {
|
new g_menuCmd[MENUS_NUMBER][] = {
|
||||||
@ -92,49 +91,70 @@ new g_menuCmd[MENUS_NUMBER][] = {
|
|||||||
"amx_teleportmenu"
|
"amx_teleportmenu"
|
||||||
}
|
}
|
||||||
|
|
||||||
// Second value sets if menu is only for CS...
|
new g_menuAccess[MENUS_NUMBER] = {
|
||||||
new g_menuAccess[MENUS_NUMBER][2] = {
|
ADMIN_KICK,
|
||||||
{ADMIN_KICK,0},
|
ADMIN_BAN,
|
||||||
{ADMIN_BAN,0},
|
ADMIN_SLAY,
|
||||||
{ADMIN_SLAY,0},
|
ADMIN_LEVEL_A,
|
||||||
{ADMIN_LEVEL_A,1},
|
|
||||||
|
|
||||||
{ADMIN_MAP,0},
|
ADMIN_MAP,
|
||||||
{ADMIN_MAP,0},
|
ADMIN_MAP,
|
||||||
|
|
||||||
{ADMIN_MENU,0},
|
ADMIN_MENU,
|
||||||
{ADMIN_LEVEL_A,0},
|
ADMIN_LEVEL_A,
|
||||||
|
|
||||||
// Next Page
|
// Next Page
|
||||||
|
|
||||||
{ADMIN_MENU,0},
|
ADMIN_MENU,
|
||||||
{ADMIN_CVAR,0},
|
ADMIN_CVAR,
|
||||||
{ADMIN_MENU,0},
|
ADMIN_MENU,
|
||||||
{ADMIN_CFG,0},
|
ADMIN_CFG,
|
||||||
{ADMIN_CFG,1},
|
ADMIN_CFG,
|
||||||
|
|
||||||
{ADMIN_CFG,0},
|
ADMIN_CFG,
|
||||||
{ADMIN_CFG,1},
|
ADMIN_CFG,
|
||||||
|
|
||||||
{ADMIN_LEVEL_A,0}
|
ADMIN_LEVEL_A
|
||||||
|
}
|
||||||
|
|
||||||
|
new g_menuPlugin[MENUS_NUMBER][] = {
|
||||||
|
"Players Menu",
|
||||||
|
"Players Menu",
|
||||||
|
"Players Menu",
|
||||||
|
"Players Menu",
|
||||||
|
|
||||||
|
"Maps Menu",
|
||||||
|
"Maps Menu",
|
||||||
|
|
||||||
|
"Commands Menu",
|
||||||
|
"Players Menu",
|
||||||
|
|
||||||
|
// Next Page
|
||||||
|
|
||||||
|
"Commands Menu",
|
||||||
|
"Commands Menu",
|
||||||
|
"Commands Menu",
|
||||||
|
"Multi-Lingual System",
|
||||||
|
"Stats Configuration",
|
||||||
|
|
||||||
|
"Pause Plugins",
|
||||||
|
"Restrict Weapons",
|
||||||
|
|
||||||
|
"Teleport Menu"
|
||||||
}
|
}
|
||||||
|
|
||||||
new g_coloredMenus
|
new g_coloredMenus
|
||||||
new g_cstrikeRunning
|
|
||||||
new g_funModule
|
|
||||||
|
|
||||||
public plugin_init() {
|
public plugin_init() {
|
||||||
register_plugin("Menus Front-End",AMXX_VERSION_STR,"AMXX Dev Team")
|
register_plugin("Menus Front-End",AMXX_VERSION_STR,"AMXX Dev Team")
|
||||||
|
|
||||||
register_dictionary("menufront.txt")
|
register_dictionary("menufront.txt")
|
||||||
register_dictionary("common.txt")
|
register_dictionary("common.txt")
|
||||||
|
|
||||||
register_menucmd(register_menuid("AMX Mod X Menu"),1023,"actionMenu")
|
register_menucmd(register_menuid("AMX Mod X Menu"),1023,"actionMenu")
|
||||||
register_clcmd("amxmodmenu","cmdMenu",ADMIN_MENU,"- displays menus")
|
register_clcmd("amxmodmenu","cmdMenu",ADMIN_MENU,"- displays menus")
|
||||||
|
|
||||||
g_coloredMenus = colored_menus()
|
g_coloredMenus = colored_menus()
|
||||||
g_cstrikeRunning = cstrike_running()
|
|
||||||
g_funModule = is_module_loaded("Fun")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public actionMenu(id,key) {
|
public actionMenu(id,key) {
|
||||||
@ -168,21 +188,17 @@ displayMenu(id,pos) {
|
|||||||
new flags = get_user_flags(id)
|
new flags = get_user_flags(id)
|
||||||
|
|
||||||
for (new a = start; a < end; ++a) {
|
for (new a = start; a < end; ++a) {
|
||||||
if ( a == MENUS_NUMBER - 1 && !g_funModule )
|
if ( (flags & g_menuAccess[a]) && ( is_plugin_loaded(g_menuPlugin[a])!=-1 ) ) {
|
||||||
continue // checks if there is fun module for teleport menu
|
keys |= (1<<b)
|
||||||
|
len += format(menuBody[len],511-len,"%d. %L^n",++b, id, g_menuBody[ a ] )
|
||||||
if ( (flags & g_menuAccess[a][0]) && ( g_menuAccess[a][1] ? g_cstrikeRunning : 1 ) ) {
|
}
|
||||||
keys |= (1<<b)
|
else {
|
||||||
len += format(menuBody[len],511-len,"%d. %L^n",++b, id, g_menuBody[ a ] )
|
++b
|
||||||
}
|
if ( g_coloredMenus )
|
||||||
else {
|
len += format(menuBody[len],511-len, "\d%d. %L^n\w",b, id, g_menuBody[ a ] )
|
||||||
++b
|
else
|
||||||
if ( g_coloredMenus )
|
len += format(menuBody[len],511-len, "#. %L^n", id, g_menuBody[ a ] )
|
||||||
len += format(menuBody[len],511-len, "\d%d. %L^n\w",b, id, g_menuBody[ a ] )
|
}
|
||||||
else
|
|
||||||
len += format(menuBody[len],511-len, "#. %L^n", id, g_menuBody[ a ] )
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (end != MENUS_NUMBER ) {
|
if (end != MENUS_NUMBER ) {
|
||||||
@ -197,5 +213,6 @@ displayMenu(id,pos) {
|
|||||||
public cmdMenu(id,level,cid) {
|
public cmdMenu(id,level,cid) {
|
||||||
if (cmd_access(id,level,cid,1))
|
if (cmd_access(id,level,cid,1))
|
||||||
displayMenu(id,g_menuPosition[id] = 0)
|
displayMenu(id,g_menuPosition[id] = 0)
|
||||||
|
|
||||||
return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user