Raised This Month: $ Target: $400
 0% 

[MENU] Take argument


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Ex3cuTioN
Member
Join Date: May 2010
Old 07-07-2010 , 02:25   [MENU] Take argument
Reply With Quote #1

This is an example. What i want to do is to make a menu line to be like a console command.

When i press 1 i must write the tag of T's and when i press 2 i must write the tag of CT's.

I cand make it with

hns_tag <T's tag> <CT's tag>

This workd, but it's in the console and i want to know if it can be possibile to make it from the menu...

PHP Code:
#include <amxmodx>
#include <amxmisc>

#define PLUGIN "Plugin Nou"
#define VERSION "0.1"
#define AUTHOR "Ex3cuTioN"


public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_clcmd("say /hns","cmdHNS");
    
register_clcmd("say /war","cmdHNS");
}

public 
cmdHNS(id)
{
    if(!
is_user_admin(id))
        return 
PLUGIN_HANDLED;

    else
    {
        new 
menu menu_create("\yHNS Menu:""settings");
   
        
menu_additem(menu"\wTerrorist TAG""1"0);
        
menu_additem(menu"\wCoutner TAG""2"0);
   
        
menu_setprop(menuMPROP_EXITMEXIT_ALL);
 
        
menu_display(idmenu0);
    }
    
    return 
PLUGIN_HANDLED;
}

public 
settings(idmenuitem)
{
    if (
item == MENU_EXIT)
    {
        
menu_destroy(menu);
        return 
PLUGIN_HANDLED;
    }
   
    new 
data[6], iName[64];
    new 
accesscallback;
   
    
menu_item_getinfo(menuitemaccessdata,5iName63callback);

    new 
key str_to_num(data);
    
    switch(
key)
    {
        case 
1:
        {
            
//code
        
}
        case 
2:
        {
            
//code2
        
}
    }
    
    
menu_destroy(menu);
    return 
PLUGIN_HANDLED;

Ex3cuTioN is offline
wrecked_
Veteran Member
Join Date: Jan 2010
Location: New York (GMT-5)
Old 07-07-2010 , 07:53   Re: [MENU] Take argument
Reply With Quote #2

Use the method that I use in this plugin: https://forums.alliedmods.net/showpo...34&postcount=2
__________________
[ Paid Requests ]
DO NOT PM ME ABOUT BLOCKMAKER
NO PRIVATE SUPPORT
wrecked_ is offline
Ex3cuTioN
Member
Join Date: May 2010
Old 07-09-2010 , 02:11   Re: [MENU] Take argument
Reply With Quote #3

I really don't understand..
Ex3cuTioN is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 07-09-2010 , 02:18   Re: [MENU] Take argument
Reply With Quote #4

I'm not entirely sure what you are asking but I'll assume. You need to make string vars to hold the two tags. Then use messagemode (for the client) to be able to have them input text and save that text into the corresponding variable. Then, you would need like a "Submit" button to then pass those two tags to the hns_tag command.

For an example of using messagemode you can look at Dorin's AMX SSBan plugin.
__________________
fysiks 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 07:11.


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