AlliedModders

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

AAleaderNik 11-08-2006 22:29

menu help
 
i wanna know what i should use if i wanted to make a menu so you can buy weapons because ive looked on a few plugins and have seen different ways of doing menus

sub 11-08-2006 23:05

Re: menu help
 
Heres a couple kinds

New Way (Kinda Confusing But Its good)
Code:
#include <amxmodx> #include <amxmisc> #define PLUGIN "New Menu System" #define VERSION "1.0" #define AUTHOR "ChrisK" #define Keysmymenu (1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<6)|(1<<7)|(1<<8)|(1<<9) // Keys: 1234567890 new mMyMenuTitle // Menu new mcbMyMenuTitle // Menu Callback public plugin_init() {     /* Menu My Menu Title */     /* Use menu_display(id, mMyMenuTitle, 0) to show the menu to an user. */     mMyMenuTitle = menu_create("My Menu Title", "mh_MyMenuTitle")     mcbMyMenuTitle = menu_makecallback("mcb_MyMenuTitle")     menu_additem(mMyMenuTitle, "1. My First Item Name", "ma_MyMenuTitle", ADMIN_ALL, mcbMyMenuTitle)     menu_additem(mMyMenuTitle, "2. My Second Item Name ", "ma_MyMenuTitle", ADMIN_ALL, mcbMyMenuTitle)     menu_additem(mMyMenuTitle, "3. My Third Item Name", "ma_MyMenuTitle", ADMIN_ALL, mcbMyMenuTitle)     menu_additem(mMyMenuTitle, "4. My Fourth Item Name", "ma_MyMenuTitle", ADMIN_ALL, mcbMyMenuTitle)     menu_additem(mMyMenuTitle, "5. My Fifth Item Name", "ma_MyMenuTitle", ADMIN_ALL, mcbMyMenuTitle)     menu_additem(mMyMenuTitle, "6. My Sixth Item Name", "ma_MyMenuTitle", ADMIN_ALL, mcbMyMenuTitle)     menu_additem(mMyMenuTitle, "7. My Seventh Item Name", "ma_MyMenuTitle", ADMIN_ALL, mcbMyMenuTitle)     menu_additem(mMyMenuTitle, "8. My Eighth Item Name", "ma_MyMenuTitle", ADMIN_ALL, mcbMyMenuTitle)     menu_additem(mMyMenuTitle, "9. My Ninth Item Name", "ma_MyMenuTitle", ADMIN_ALL, mcbMyMenuTitle)     menu_additem(mMyMenuTitle, "0. Quit", "ma_MyMenuTitle", ADMIN_ALL, mcbMyMenuTitle)     /* Menu End */     register_plugin(PLUGIN, VERSION, AUTHOR)     } /* Menu My Menu Title */ public mh_MyMenuTitle(id, menu, item) {     /* This event is called when someone presses a key on this menu */ } public ma_MyMenuTitle(id) {     /* This event is called when an item was selected */ } public mcb_MyMenuTitle(id, menu, item) {     /* This is the callback-event, here you can set items enabled or disabled. */     /* If you want to enable an item, use: return ITEM_ENABLED */     /* If you want to disable an item, use: return ITEM_DISABLED */ }

or the wa yI like
Code:
#include <amxmodx> #include <amxmisc> #define PLUGIN "Simple Menu System" #define VERSION "1.0" #define AUTHOR "ChrisK" #define Keysmymenu (1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<6)|(1<<7)|(1<<8)|(1<<9) // Keys: 1234567890 public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)         register_menucmd(register_menuid("mymenu"), Keysmymenu, "Pressedmymenu") } public Showmymenu(id) {     show_menu(id, Keysmymenu, "My Menu2^n1. My First Item^n2. My Second Item^n3. My Third Item^n4. My Fourth Item^n5. My Fifth Item^n6. My Sixth Item^n7. My Seventh Item^n8. My Ninth Item^n9. My Ninth Item^n0. Quit^n", -1, "mymenu") // Display menu } public Pressedmymenu(id, key) {     switch (key) {         case 0: { // 1                     }         case 1: { // 2                     }         case 2: { // 3                     }         case 3: { // 4                     }         case 4: { // 5                     }         case 5: { // 6                     }         case 6: { // 7                     }         case 7: { // 8                     }         case 8: { // 9                     }         case 9: { // 0                     }     } }

AAleaderNik 11-09-2006 00:32

Re: menu help
 
thanks very much for that code it really helps but i did this before i checked this forum again and i was wondering why it doesnt work

Code:

#include <amxmodx>
#include <amxmisc>


public plugin_init()
{
 register_plugin("amx_sounds","1.0","Nik")
 register_menucmd(register_menuid("Sounds"),1023,"actionMenu")
 register_clcmd("amx_sounds","showMenu",ADMIN_PASSWORD,"shows sound menu")
}

public actionMenu(id,key)
{
 switch(key){
 case 0:{
client_cmd(0,"spk sound/kill.wav")
 }
 }

 return PLUGIN_HANDLED
}

public showMenu(id,level,cid)
{
 if (!cmd_access(id,level,cid,1)) return PLUGIN_HANDLED

 new menuBody[512]
 new len = format(menuBody,511, "\ySounds\R^n^n\w", "Sounds^n^n")
 len += format(menuBody[len],511-len,"1. kill^n^n0. exit")
 show_menu(id, 1023 ,menuBody)

 return PLUGIN_HANDLED
}
public plugin_precache() {
    precache_sound("kill.wav")
   
    return PLUGIN_CONTINUE
 }


The Specialist 11-09-2006 00:56

Re: menu help
 
here try this :up:
Code:
#include <amxmodx> #include <amxmisc> new keys = MENU_KEY_0 |  MENU_KEY_1 | MENU_KEY_2 | MENU_KEY_3 | MENU_KEY_4 | MENU_KEY_5 | MENU_KEY_6 | MENU_KEY_7 | MENU_KEY_8 | MENU_KEY_9; new menu[192] public plugin_init() {     register_plugin("amx_sounds","1.0","Nik");     register_menu("menu_show",1023,"menu_choose");     register_clcmd("amx_sounds","show_menu",ADMIN_PASSWORD,"shows sound menu"); } public menu_choose(id,key) {     switch(key)     {         case 0:client_cmd(0,"spk sound/kill.wav");     }     return PLUGIN_HANDLED; } public menu_show(id,level,cid) {     if (!cmd_access(id,level,cid,1))     {         return PLUGIN_HANDLED;      }else{                 format(menu,191,"1. kill^n^n0. exit");         show_menu(id, keys ,menu,-1,"menu_choose");             return PLUGIN_HANDLED     }     return PLUGIN_HANDLED; } public plugin_precache()  {     precache_sound("misc/kill.wav"); }

AAleaderNik 11-09-2006 02:51

Re: menu help
 
when i tryed typing in amx_sounds and it said unknown: amx_sounds its under plugins.ini and everything is good i cant see anything wrong with the code

The Specialist 11-09-2006 03:13

Re: menu help
 
1 Attachment(s)
oops sorry man i forgot to link the cliet command to the menu function . here it is this one should work . if you want to add more stuff to the menu just follwo my examples here. :up:

AAleaderNik 11-09-2006 14:35

Re: menu help
 
it says debug not enabled

The Specialist 11-09-2006 18:52

Re: menu help
 
enable debuging by puting debug behins the name of the plugin in your plugins.ini file. it will debug it and give you th run time erors.

AAleaderNik 11-09-2006 19:40

Re: menu help
 
L 11/09/2006 - 16:53:30: Function "show_menu" was not found
L 11/09/2006 - 16:53:30: [AMXX] Displaying debug trace (plugin "amx_sound.amxx")
L 11/09/2006 - 16:53:30: [AMXX] Run time error 19: function not found
L 11/09/2006 - 16:53:30: [AMXX] [0] amx_sound.sma::plugin_init (line 11)

The Specialist 11-09-2006 19:45

Re: menu help
 
Code:
#include <amxmodx> #include <amxmisc> new keys = MENU_KEY_0 |  MENU_KEY_1 | MENU_KEY_2 | MENU_KEY_3 | MENU_KEY_4 | MENU_KEY_5 | MENU_KEY_6 | MENU_KEY_7 | MENU_KEY_8 | MENU_KEY_9; new menu[192] public plugin_init() {  register_plugin("amx_sounds","1.0","Nik");  register_menu("menu_show",1023,"menu_choose");  register_clcmd("amx_sounds","menu_show",ADMIN_PASSWORD,"shows sound menu"); } public menu_choose(id,key) {  switch(key)  {   case 0:client_cmd(0,"spk sound/kill.wav");  }  return PLUGIN_HANDLED; } public menu_show(id,level,cid) {  if (!cmd_access(id,level,cid,1))  {   return PLUGIN_HANDLED;  }else{     format(menu,191,"1. kill^n^n0. exit");   show_menu(id, keys ,menu,-1,"menu_show");     return PLUGIN_HANDLED  }  return PLUGIN_HANDLED; } public plugin_precache()  {  precache_sound("misc/kill.wav"); }
:up:


All times are GMT -4. The time now is 06:50.

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