Raised This Month: $ Target: $400
 0% 

Menu Command Scripting


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
deadman909
Veteran Member
Join Date: Oct 2008
Old 08-01-2011 , 04:44   Menu Command Scripting
Reply With Quote #1

Okay what I need help is int getting a same command to work in both teams but to open different menus.

register_clcmd( "say /buy", "shopCT");
register_clcmd( "say /buy", "shopT");

I have this to commands register and plugin compiles. But for some reason the command only works for CT and not T.

How would i set it up so the command works for both teams?
__________________

deadman909 is offline
Send a message via MSN to deadman909 Send a message via Yahoo to deadman909
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 08-01-2011 , 04:55   Re: Menu Command Scripting
Reply With Quote #2

register it to 1 function & build/show the menu depending on the team.
__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.
drekes is offline
Send a message via MSN to drekes
deadman909
Veteran Member
Join Date: Oct 2008
Old 08-01-2011 , 05:03   Re: Menu Command Scripting
Reply With Quote #3

Hmm do you think you can please give me an example of what you mean register it to one fuction?
__________________

deadman909 is offline
Send a message via MSN to deadman909 Send a message via Yahoo to deadman909
HBxander
Senior Member
Join Date: Jan 2011
Location: Behind you!
Old 08-01-2011 , 05:04   Re: Menu Command Scripting
Reply With Quote #4

PHP Code:
register_clcmd "say /buy""shopChooseTeam" );

public 
shopChooseTeam id )
{
       if ( 
cs_get_user_team id ) == CS_TEAM_T )
       {
               
//code for menu for T team
       
}
       else if ( 
cs_get_user_team id ) == CS_TEAM_CT )
       {
               
//code for menu for CT team
       
}

__________________
Selling:

- PointMod for Hide And Seek - $20
- Private BlockMaker with Weapon Block And More - $50
- Achievements ( FFA GamePlay ) - $25

PM Me about Private Work!
HBxander is offline
deadman909
Veteran Member
Join Date: Oct 2008
Old 08-01-2011 , 05:11   Re: Menu Command Scripting
Reply With Quote #5

EDIT: Alright Thanks it Worked =)
__________________


Last edited by deadman909; 08-01-2011 at 05:18.
deadman909 is offline
Send a message via MSN to deadman909 Send a message via Yahoo to deadman909
HBxander
Senior Member
Join Date: Jan 2011
Location: Behind you!
Old 08-01-2011 , 05:28   Re: Menu Command Scripting
Reply With Quote #6

Quote:
Originally Posted by deadman909 View Post
EDIT: Alright Thanks it Worked =)
No problem.
__________________
Selling:

- PointMod for Hide And Seek - $20
- Private BlockMaker with Weapon Block And More - $50
- Achievements ( FFA GamePlay ) - $25

PM Me about Private Work!
HBxander is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 08-01-2011 , 08:01   Re: Menu Command Scripting
Reply With Quote #7

PHP Code:
    switch( cs_get_user_team(id) ) // optimization
    
{
        case 
CS_TEAM_T:
        {
            
shopT(id// readability
        
}
        case 
CS_TEAM_CT:
        {
            
shopCT(id// readability
        
}
    } 
__________________
fysiks is offline
deadman909
Veteran Member
Join Date: Oct 2008
Old 08-02-2011 , 05:27   Re: Menu Command Scripting
Reply With Quote #8

Thanks everybody. One more question now. How would I set it so when they buy something they get it the next round and not the current round already started. I want all affects to happen on next round.

Also another question on the menu, what part of it do I need to remove so players don't get the ZERO key that lets them exit the menu. I want them to have to get something if they open it.
PHP Code:
public ShopT(id)
{
    new 
menu menu_create("\yWhat well you buy?""submenu_handler")

    
menu_additem(menu"\wExtra 25 HP for ($5000)""1"0);
    
menu_additem(menu"\wExtra 50 HP for ($10000)""2"0);

    
menu_setprop(menuMPROP_EXITMEXIT_ALL);
    
menu_display(idmenu0);
}

public 
submenu_handler(idmenuitem)
{
    if( 
item == MENU_EXIT )
    {
        
menu_destroy(menu);
        return 
PLUGIN_HANDLED;
    }

    new 
data[6], szName[64];
    new 
accesscallback;
    
menu_item_getinfo(menuitemaccessdata,charsmax(data), szName,charsmax(szName), callback);

    new 
key str_to_num(data);

    switch(
key)
    {
        case 
1:
        {
           if(
cs_get_user_moneyid ) < 5000
           {
               
client_print(idprint_chat"You do not have enough money.")
               return 
PLUGIN_CONTINUE
           
}
           
cs_set_user_money(idcs_get_user_money(id) - 5000)
           
set_user_health(idget_user_health(id) + 25)
        }
        case 
2:
        {
           if(
cs_get_user_moneyid ) < 10000
           {
               
client_print(idprint_chat"You do not have enough money.")
               return 
PLUGIN_CONTINUE
           
}
           
cs_set_user_money(idcs_get_user_money(id) - 10000)
           
set_user_health(idget_user_health(id) + 50)
        }

    }
    return 
PLUGIN_HANDLED;

__________________

deadman909 is offline
Send a message via MSN to deadman909 Send a message via Yahoo to deadman909
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 08-02-2011 , 08:13   Re: Menu Command Scripting
Reply With Quote #9

1. You would need to store their selection in a variable and use it to create the action on the new round.

2. MEXIT_ALL MEXIT_NEVER
__________________
fysiks is offline
deadman909
Veteran Member
Join Date: Oct 2008
Old 08-02-2011 , 23:17   Re: Menu Command Scripting
Reply With Quote #10

Quote:
Originally Posted by fysiks View Post
1. You would need to store their selection in a variable and use it to create the action on the new round.

2. MEXIT_ALL MEXIT_NEVER
Hmm I am still learning on how to code. Anybody want to give me an example of how one would do that. With one example is enough I well create all the rest from that one.
__________________

deadman909 is offline
Send a message via MSN to deadman909 Send a message via Yahoo to deadman909
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 03:25.


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