AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   custom menu (https://forums.alliedmods.net/showthread.php?t=64498)

Maurice 12-17-2007 08:16

custom menu
 
Hello, i wanted to make a custom menu for admin on my server so they only see where they have the acces for but i have 2 things i cant get work and ask therefore for some help here.

The thing i have already is this

Code:

#include <amxmodx>
#include <cstrike>

#define Keysadmin_menu (1<<0)|(1<<1)|(1<<9)

public plugin_init() {
    register_plugin("Admin Menu","1.0","sharpe")

    register_clcmd( "adminmenu","Showadmin_menu", ADMIN_LEVEL_A, "Open menu")

    register_menucmd(register_menuid("admin_menu"), Keysadmin_menu, "Pressedadmin_menu")
}

public Showadmin_menu(id) {
    show_menu(id, Keysadmin_menu, "\yAdmin Menu^n^n\w1. action1^n2. action2^n3. action3^n^n0. Exit^n", -1, "admin_menu")
}

public Pressedadmin_menu(id, key) {

    switch (key) {
        case 0: client_cmd(id,"amx_banmenu")
        case 1: client_cmd(id,"amx_recordmenu")     
    }
    return PLUGIN_HANDLED
}

The 2 problems i have is that every player can open the menu even if they dont have the admin_level_a acces and in the console i getthe message unknown command: adminmenu althought the menu is just working. Have anyone an idea how to fix both problems?

[ --<-@ ] Black Rose 12-17-2007 09:09

Re: custom menu
 
Code:
public Showadmin_menu(id, level, cid) {   if ( ! cmd_access(id, level, cid, 0) )     return PLUGIN_CONTINUE     show_menu(id, Keysadmin_menu, "\yAdmin Menu^n^n\w1. action1^n2. action2^n3. action3^n^n0. Exit^n", -1, "admin_menu") }

ConnorMcLeod 12-17-2007 09:59

Re: custom menu
 
PHP Code:

public Showadmin_menu(idlevelcid) {
    if (!
cmd_access(idlevelcid1))
        return 
PLUGIN_HANDLED

    show_menu
(idKeysadmin_menu"\yAdmin Menu^n^n\w1. action1^n2. action2^n3. action3^n^n0. Exit^n", -1"admin_menu")

    return 
PLUGIN_HANDLED // this fix the unknown cmd message


You need to include amxmisc.inc

Maurice 12-17-2007 10:35

Re: custom menu
 
Thanks both! Althought only connorr's update seems to work.

ConnorMcLeod 12-17-2007 10:44

Re: custom menu
 
Yeah, change a 1 in a 0 and all is messed up :P


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

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