Raised This Month: $ Target: $400
 0% 

Problems with a menu


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
dutchmeat
Senior Member
Join Date: Sep 2006
Old 12-07-2006 , 09:23   Problems with a menu
Reply With Quote #1

This function works:
Code:
<font size="2"> register_menucmd( register_menuid("Do you want to execute command: ?"), 1023, "Confirm" ) public Askmenu(id){ new szMenuBody[256] new keys format( szMenuBody, 255, "Do you want to execute command: ? ^n1. Yes!^n2 No!^n3. Exit") keys = (1<<0|1<<1|1<<2) show_menu( id, keys, szMenuBody, -1 ) return PLUGIN_HANDLED } public Confirm( id , key ) { switch( key ) { case 0: { client_print(id,print_chat,"Yes") log_amx("YES") } case 1: { client_print(id,print_chat,"No") log_amx("YES") } default: { client_print(id,print_chat,"DEBUG!") } } return PLUGIN_HANDLED } </font>


But this doesn't work (i use this function inside another function),both players are recognised but 'yes' or 'no' does not work, i get the original botmenu (ESF).

Code:
<font size="2"> register_menucmd( register_menuid("Do you want to do things with: ?"), 1023, "Confirm" ) public FusionAskmenu(id,id2){ new szMenuBody[256] new keys new szUserName[32] get_user_name( id2, szUserName, 31 ) format( szMenuBody, 255, "Do you want to do things with: %s? ^n1. Yes!^n2 No!^n3. Exit",szUserName) keys = (1<<0|1<<1|1<<2) show_menu( id, keys, szMenuBody, -1 ) return PLUGIN_HANDLED } public Confirm( id , key ) { switch( key ) { case 0: { client_print(id,print_chat,"Yes") log_amx("YES") } case 1: { client_print(id,print_chat,"No") log_amx("YES") } default: { client_print(id,print_chat,"DEBUG!") } } return PLUGIN_HANDLED } </font>

Does this problem has to do with implenting the name in the 'Ask menu'?
Thanks in advance
__________________
before you criticize someone, you should walk a mile in their shoes. that way, when you criticize them, you're a mile away and you have their shoes.

Last edited by dutchmeat; 12-07-2006 at 09:27.
dutchmeat is offline
VEN
Veteran Member
Join Date: Jan 2005
Old 12-07-2006 , 11:03   Re: Problems with a menu
Reply With Quote #2

Yes, and please indent next time.
VEN is offline
dutchmeat
Senior Member
Join Date: Sep 2006
Old 12-07-2006 , 11:23   Re: Problems with a menu
Reply With Quote #3

yes, so how can i fix this? I can't implent a '%s' in registermenu right ?
or can i use:
^"%s^"
__________________
before you criticize someone, you should walk a mile in their shoes. that way, when you criticize them, you're a mile away and you have their shoes.
dutchmeat is offline
VEN
Veteran Member
Join Date: Jan 2005
Old 12-07-2006 , 12:02   Re: Problems with a menu
Reply With Quote #4

The only way would be register_menuid("Do you want to execute command:")
VEN is offline
dutchmeat
Senior Member
Join Date: Sep 2006
Old 12-07-2006 , 14:50   Re: Problems with a menu
Reply With Quote #5

So i can't set a variable in a menu command like:

register_menuid("Do you want to execute command: %s",name)
__________________
before you criticize someone, you should walk a mile in their shoes. that way, when you criticize them, you're a mile away and you have their shoes.
dutchmeat is offline
jim_yang
Veteran Member
Join Date: Aug 2006
Old 12-08-2006 , 01:32   Re: Problems with a menu
Reply With Quote #6

Code:
#include <amxmodx> #include <amxmisc> #define KEY (1<<0)|(1<<1) public plugin_init() {         register_menucmd(register_menuid("Test"), KEY, "key_pressed")         register_clcmd("test","test") } public test(id) {         showmenu(id, 1)         return PLUGIN_HANDLED } public showmenu(id1, id2) {         new name[32], menubody[48]         get_user_name(id2, name, 31)         format(menubody, 47, "Hello %s^n1. Yes^n2. No", name)         show_menu(id1, KEY, menubody, -1, "Test") } public key_pressed(id, key) {         client_print(id, print_chat, "pressed key: %d", key)         return PLUGIN_HANDLED }
__________________
Project : CSDM all in one - 99%
<team balancer#no round end#entity remover#quake sounds#fake full#maps management menu#players punishment menu#no team flash#colored flashbang#grenade trails#HE effect#spawn protection#weapon arena#weapon upgrade#auto join#no weapon drop#one name>
jim_yang is offline
VEN
Veteran Member
Join Date: Jan 2005
Old 12-08-2006 , 04:09   Re: Problems with a menu
Reply With Quote #7

Quote:
So i can't set a variable in a menu command like
You can but it will not take the effect as you expecting. register_menuid doesn't confirm format routines. If your name are constant you can explicitly specify it or format yourself. If it unconstant then you can register the different menuids for every name. In other case just register all that menus by a common phrase as i showed above.

Last edited by VEN; 12-08-2006 at 04:16.
VEN is offline
dutchmeat
Senior Member
Join Date: Sep 2006
Old 12-08-2006 , 04:43   Re: Problems with a menu
Reply With Quote #8

I wanted my output like this:

"Do you want to do things with: dutchmeat?"
"yes"
"no"

but instead i've used this:

"Do you want to do things with:"
"dutchmeat"
"no"
__________________
before you criticize someone, you should walk a mile in their shoes. that way, when you criticize them, you're a mile away and you have their shoes.
dutchmeat is offline
Reply



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 06:54.


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