Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <amxmodx>
- #define PLUGIN "PUG MENU"
- #define VERSION "1.0"
- #define AUTHOR ""
- new menu
- new call
- native pug_get_state()
- stock is_user_admin(id)
- {
- new __flags=get_user_flags(id);
- return (__flags>0 && !(__flags&ADMIN_USER));
- }
- public plugin_init()
- {
- register_plugin(PLUGIN, VERSION, AUTHOR)
- menu = menu_create("\yPug Menu", "mh_pug_menu")
- call = menu_makecallback("check_admin")
- menu_additem(menu, "Ready", "1", 0, call)
- menu_additem(menu, "UnReady", "2", 0, call)
- menu_additem(menu, "DMG", "3", 0, call)
- menu_additem(menu, "Score", "6", 0, call)
- menu_additem(menu, "Force Ready", "4", 0, call)
- menu_additem(menu, "Cancel Pug", "5", 0, call)
- menu_setprop(menu, MPROP_EXIT, MEXIT_ALL)
- register_clcmd("nightvision", "pfn_pug_menu")
- }
- public check_admin(id, menu, item)
- {
- new info[4], a
- menu_item_getinfo(menu, item, a, info, charsmax(info), "", 0, a)
- new item_id = str_to_num(info)
- if(pug_get_state() == 0)
- {
- switch(item_id)
- {
- case 1: return ITEM_ENABLED
- case 2: return ITEM_ENABLED
- case 3: return ITEM_DISABLED
- case 4:
- {
- if(!is_user_admin(id))
- {
- return ITEM_DISABLED
- }
- return ITEM_ENABLED
- }
- case 5: return ITEM_DISABLED
- case 6: return ITEM_DISABLED
- }
- }
- else
- {
- switch(item_id)
- {
- case 1 : return ITEM_DISABLED
- case 2 : return ITEM_DISABLED
- case 3 : return ITEM_ENABLED
- case 4 : return ITEM_DISABLED
- case 5 :
- {
- if(!is_user_admin(id))
- {
- return ITEM_DISABLED
- }
- return ITEM_ENABLED
- }
- case 6: return ITEM_ENABLED
- }
- }
- return ITEM_ENABLED
- }
- public mh_pug_menu(id, menu, item)
- {
- if(item == MENU_EXIT)
- {
- return
- }
- new info[4], a
- menu_item_getinfo(menu, item, a, info, charsmax(info), "", 0, a)
- new item_id = str_to_num(info)
- switch(item_id)
- {
- case 1 : client_cmd2(id, "say .ready")
- case 2 : client_cmd2(id, "say .unready")
- case 3 : client_cmd2(id, "say .dmg")
- case 4 : client_cmd2(id, "say .forceready")
- case 5 : client_cmd2(id, "say .cancel")
- case 6 : client_cmd2(id, "say .score")
- }
- }
- public pfn_pug_menu(id)
- {
- menu_display(id, menu)
- }
- stock client_cmd2(id, cmd[])
- {
- message_begin(MSG_ONE, SVC_DIRECTOR, _, id)
- write_byte(strlen(cmd) + 2)
- write_byte(10)
- write_string(cmd)
- message_end()
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement