Raised This Month: $ Target: $400
 0% 

Solved how to use cmd in menu ?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
yas17sin
Veteran Member
Join Date: Oct 2016
Location: Morocco/Sale
Old 02-08-2017 , 18:03   how to use cmd in menu ?
Reply With Quote #1

Hi guys.

i create a menu and i want to exec a commande in the item selected.

i have some guns can get by commande like "get_gs" and i want to exec this cmd like i say in the menu each item have cmd.

PS : be easy on me it's my first menu.

code :
PHP Code:
#include <amxmodx>

#define PLUGIN "First Menu Ever"
#define VERSION "1.0"
#define AUTHOR "yas17sin"

new menu;

public 
plugin_init()
{
    
register_pluginPLUGINVERSIONAUTHOR)
    
register_clcmd"say /pmenu""pro_menu" )
}
public 
pro_menuid )
{
    if(!
is_user_alive(id))
        return;
    
    
menu menu_create"Pro VIP Weapon Menu""menu_handler" );
    
    
menu_additemmenu"Gauss Sniper """ADMIN_KICK )
    
menu_additemmenu"Gilboa-Viper """)
    
menu_additemmenu"Auto-Sniper : VSK""")
    
    
menu_setpropmenuMPROP_EXITMEXIT_ALL );
    
    
menu_displayidmenu);
}
    
public 
menu_handleridmenuitem )
{
    switch( 
item )
    {
        case 
0:
        {
            
client_printidprint_chat"You Have Select Pro Gauss Sniper" );
        }
        case 
1:
        {
            
client_printidprint_chat"You Have Select Pro Gilboa Viper" );
        }
        case 
2:
        {
            
client_printidprint_chat"You Have Auto Sniper : VSK" );
        }
        case 
MENU_EXIT:
        {
            
client_printidprint_chat"Good Luck And Be PRO");
        }
    }
    
menu_destroymenu );
    return 
PLUGIN_HANDLED;

Thanks for help guys.

Last edited by yas17sin; 02-10-2017 at 11:16.
yas17sin is offline
Send a message via ICQ to yas17sin
Natsheh
Veteran Member
Join Date: Sep 2012
Old 02-08-2017 , 19:29   Re: how to use cmd in menu ?
Reply With Quote #2

In case 0 no need for menu destroy and return plugin handled
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
yas17sin
Veteran Member
Join Date: Oct 2016
Location: Morocco/Sale
Old 02-08-2017 , 20:31   Re: how to use cmd in menu ?
Reply With Quote #3

Thanks for advice.
yas17sin is offline
Send a message via ICQ to yas17sin
Natsheh
Veteran Member
Join Date: Sep 2012
Old 02-09-2017 , 05:14   Re: how to use cmd in menu ?
Reply With Quote #4

Also give the menu variable an id by setting
PHP Code:
menu menu_create(......) 
And...
PHP Code:
If(!is_user_alive(id)) return; 
// if isnt user alive ignore the rest

Last edited by Natsheh; 02-09-2017 at 05:19.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
yas17sin
Veteran Member
Join Date: Oct 2016
Location: Morocco/Sale
Old 02-09-2017 , 14:29   Re: how to use cmd in menu ?
Reply With Quote #5

thanks for your explain and advice i apprciate that.
and about the commande what should i do.
yas17sin is offline
Send a message via ICQ to yas17sin
Old 02-09-2017, 15:33
abdobiskra
This message has been deleted by abdobiskra. Reason: ops! i post othere way :3
yas17sin
Veteran Member
Join Date: Oct 2016
Location: Morocco/Sale
Old 02-09-2017 , 15:36   Re: how to use cmd in menu ?
Reply With Quote #6

how that could work ?
yas17sin is offline
Send a message via ICQ to yas17sin
abdobiskra
Veteran Member
Join Date: Jul 2014
Location: Algeria
Old 02-09-2017 , 15:43   Re: how to use cmd in menu ?
Reply With Quote #7

i think you have mistak here try to check it :
PHP Code:
    switch( item )
    { 
to ==>
PHP Code:
    switch( menu )
    { 
__________________
abdobiskra is offline
Send a message via Skype™ to abdobiskra
yas17sin
Veteran Member
Join Date: Oct 2016
Location: Morocco/Sale
Old 02-09-2017 , 17:48   Re: how to use cmd in menu ?
Reply With Quote #8

Thanks for help.
brw how to make if the player choose something he can't open the menu again until the next round.

Last edited by yas17sin; 02-09-2017 at 17:48.
yas17sin is offline
Send a message via ICQ to yas17sin
EFFx
Veteran Member
Join Date: Feb 2016
Location: São Paulo, Brasil
Old 02-09-2017 , 18:32   Re: how to use cmd in menu ?
Reply With Quote #9

Quote:
Originally Posted by abdobiskra View Post
i think you have mistak here try to check it :
PHP Code:
    switch( item )
    { 
to ==>
PHP Code:
    switch( menu )
    { 
No, should be item.

And yas, try client_cmd()?
__________________
• Ranking System • AutoMix 5vs5 System
• Web Ban System • Plugins for free

____________________________________________
For private works:
• Discord: EFFEXo#8850 • Steam: EFFEXo
EFFx is offline
yas17sin
Veteran Member
Join Date: Oct 2016
Location: Morocco/Sale
Old 02-09-2017 , 18:34   Re: how to use cmd in menu ?
Reply With Quote #10

okay i will try it right now since i didn't make any menu before this Thanks.

Last edited by yas17sin; 02-09-2017 at 18:45.
yas17sin is offline
Send a message via ICQ to yas17sin
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 20:41.


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