Raised This Month: $ Target: $400
 0% 

Why isn't this working?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
NewUser
Member
Join Date: Mar 2006
Location: over there
Old 04-08-2006 , 15:19   Why isn't this working?
Reply With Quote #1

Code:
public gaben(id) {     if(bool1[id])     {         client_print(id,print_chat, "bool1 error");         return PLUGIN_HANDLED;     }     if(bool2[id])     {         client_print(id,print_chat, "bool2 error");         return PLUGIN_HANDLED;     }         new lawl[256];     new key = (1<<0|1<<1|1<<2|1<<3|1<<4|1<<5|1<<6|1<<9)         format(lawl,sizeof(lawl), "menu name^n");         add(lawl,sizeof(lawl), "^n1. gaben");     add(lawl,sizeof(lawl), "^n2. yams");     add(lawl,sizeof(lawl), "^n3. turtle");     add(lawl,sizeof(lawl), "^n4. squirrel");     add(lawl,sizeof(lawl), "^n5. exit game");     add(lawl,sizeof(lawl), "^n6. sandwich");     add(lawl,sizeof(lawl), "^n^n0. Exit");     show_menu(id,key,lawl);         return PLUGIN_CONTINUE; } public gaben_exec(id, key) {     if(key == 0) func1(id);         else if(key == 1) func2(id);         else if(key == 2) func3(id)         else if(key == 3) func4(id);         else if(key == 4) func5(id);         else if(key == 5) func6(id);         else if(key == 9) return PLUGIN_HANDLED;         return PLUGIN_HANDLED; }

No errors what so ever. Nor any warnings. The menu shows up, nothing functions. Yes, the functions do exist. Also the execute is registered in public plugin init.

Code:
    register_menucmd(register_menuid("menu name:"), 1023, "gaben_exec");
__________________
LEWL.
NewUser is offline
wouter
Senior Member
Join Date: Feb 2005
Location: Belgium
Old 04-08-2006 , 15:25  
Reply With Quote #2

musnt it be like this?
Code:
public gaben_exec(id, key)     {     if(key == 0) {         func1(id);     }         else if(key == 1) {         func2(id);     }         else if(key == 2) {         func3(id)     }         else if(key == 3) {         func4(id);     }         else if(key == 4) {         func5(id);     }         else if(key == 5) {         func6(id);     }         else if(key == 9) {         return PLUGIN_HANDLED;     }         return PLUGIN_HANDLED; }
wouter is offline
[ --<-@ ] Black Rose
ANNIHILATED
Join Date: Sep 2005
Location: Stockholm, Sweden.
Old 04-08-2006 , 15:25  
Reply With Quote #3

nope
but even better would be
Code:
public gaben_exec(id, key) {     switch ( key ) {         case 0: func1(id);                 case 1: func2(id);                 case 2: func3(id)                 case 3: func4(id);                 case 4: func5(id);                 case 5: func6(id);                 case 9: return PLUGIN_HANDLED;     }     return PLUGIN_HANDLED; }
[ --<-@ ] Black Rose is offline
NewUser
Member
Join Date: Mar 2006
Location: over there
Old 04-08-2006 , 15:30  
Reply With Quote #4

Quote:
Originally Posted by [ --<-@
Black Rose]nope
but even better would be
Code:
public gaben_exec(id, key) {     switch ( key ) {         case 0: func1(id);                 case 1: func2(id);                 case 2: func3(id)                 case 3: func4(id);                 case 4: func5(id);                 case 5: func6(id);                 case 9: return PLUGIN_HANDLED;     }     return PLUGIN_HANDLED; }
That's basicly the same thing... Am I not right?
__________________
LEWL.
NewUser is offline
[ --<-@ ] Black Rose
ANNIHILATED
Join Date: Sep 2005
Location: Stockholm, Sweden.
Old 04-08-2006 , 15:31  
Reply With Quote #5

faster
but i cant se any errors in your code.
[ --<-@ ] Black Rose is offline
capndurk
Senior Member
Join Date: Feb 2006
Old 04-08-2006 , 15:31  
Reply With Quote #6

Code:
register_menucmd(register_menuid("menuid"), key, "gaben_exec");

Code:
show_menu(id, key, menuBody,_, "menuid");

try that

//edit// fixed, specify the menuid to whatever you want
__________________
I have left these forums because a certain respected member has been acting immaturely lately and has decided that I am not welcome in this community.
capndurk is offline
NewUser
Member
Join Date: Mar 2006
Location: over there
Old 04-08-2006 , 20:28  
Reply With Quote #7

Quote:
Originally Posted by [ --<-@
Black Rose]faster
but i cant se any errors in your code.
Great. I tried your case #: stuff, all it did was make things worse. I tried it on my other menus that worked before.
__________________
LEWL.
NewUser is offline
-Demonsthenes-
Junior Member
Join Date: Mar 2006
Old 04-08-2006 , 21:43  
Reply With Quote #8

Code:
#include <amxmodx> #define Keysmenuname (1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<9) // Keys: 1234560 public plugin_init() {     register_plugin("gaben",".1","amxmodxGabenNoob")     register_menucmd(register_menuid("menuname"), Keysmenuname, "Pressedmenuname")     register_clcmd("gaben","Showmenuname") } public Showmenuname(id) {     new menu_text[255] = "menu name"     format(menu_text,255,"%s^n1. gaben",menu_text)     format(menu_text,255,"%s2. yams^n",menu_text)     format(menu_text,255,"%s3. turtle^n",menu_text)     format(menu_text,255,"%s4. squirrel^n",menu_text)     format(menu_text,255,"%s5. exit game^n",menu_text)     format(menu_text,255,"%s6. sandwhich^n",menu_text)     format(menu_text,255,"%s0. Exit^n",menu_text)     show_menu(id, Keysmenuname, menu_text, -1, "menuname") } public Pressedmenuname(id, key) {     switch (key) {         case 0: func1(id)         case 1: func2(id)           case 2: func3(id)         case 3: func4(id)         case 4: func5(id)         case 5: func6(id)         case 9: return PLUGIN_HANDLED           }     return PLUGIN_HANDLED } public func1(id) {     client_print(id,print_chat,"1") } public func2(id) {     client_print(id,print_chat,"2") } public func3(id) {     client_print(id,print_chat,"3") } public func4(id) {     client_print(id,print_chat,"4") } public func5(id) {     client_print(id,print_chat,"5") } public func6(id) {     client_print(id,print_chat,"6") }
-Demonsthenes- is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 16:35.


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