AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Menu keys? (https://forums.alliedmods.net/showthread.php?t=25309)

Werewolf 03-11-2006 15:20

Menu keys?
 
How can I make the keys react to the menu?
I've tried in the switch and this way. I can't make it work :(
NOTE this is only a test plugin for menus.
Code:
#include <amxmodx> #include <amxmisc> #include <fun> public plugin_init() {     register_plugin("test", "1.00", "Werewolf")             register_clcmd("say menu", "test")     register_clcmd("say_team menu", "test")     register_clcmd("say /menu", "test")     register_clcmd("say_team /menu", "test")             register_menucmd(register_menuid("test"),1023,"testkeys") } public test(id) {     new menu[1024]     format(menu, 1023, "Select power^n^n1. Godmode!^n2. Noclip!^n^n0. Exit")     new key = MENU_KEY_0|MENU_KEY_1     show_menu(id, key, menu)     return PLUGIN_CONTINUE } public testkeys(id, key) {     if(key == 0)     {         if(!(get_user_flags(id)&ADMIN_IMMUNITY))         {         client_print(id, print_chat, "You do not have access to that power.")         return PLUGIN_HANDLED         }             set_user_godmode(id)             return PLUGIN_CONTINUE     }     if(key == 1)     {         if(!(get_user_flags(id)&ADMIN_IMMUNITY))         {         client_print(id, print_chat, "You do not have access to that power.")         return PLUGIN_HANDLED         }                     set_user_noclip(id)             return PLUGIN_CONTINUE     }     return PLUGIN_CONTINUE }

Xanimos 03-11-2006 16:17

For your menu use this register_menucmd()
Code:
register_menucmd(register_menuid("Select power"),1023,"testkeys")


All times are GMT -4. The time now is 20:21.

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