Raised This Month: $51 Target: $400
 12% 

Keep menu open


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
worminater
Member
Join Date: Jun 2011
Old 06-20-2011 , 15:50   Keep menu open
Reply With Quote #1

Hi,

I've made some menus in the custom menu txt file, but it always returns back to main screen after usage. Is there a way to keep it on the same screen as the selection?

My menu looks like this, if it makes any difference.

"Commands"
{
"SpecialMenu"
{
"MINIGUN"
{
"cmd" "@1"
"admin" ""
"execute" "player"
"1"
{
"1" "Fortspawn_minigun"
"1." "Minigun"
}
}
"Fortspawn 2"
{
"cmd" "@1"
"admin" ""
"execute" "player"
"1"
{
"1" "Fortspawn_rotate 30"
"1." "Item rotate 30 degrees"
"2" "Fortspawn_remove"
"2." "Remove Prop"
"3" "Fortspawn_irondoor"
"3." "Saferoom door"
"4" "Fortspawn_ammostack"
"4." "Ammo stack"
}
}
"Infected Spawn"
{
"cmd" "@1"
"admin" ""
"execute" "player"
"1"
{
"1" "sm_ibspawn boomer auto"
"1." "Spawn Boomer"
"2" "sm_ibspawn hunter auto"
"2." "Spawn Hunter"
"3" "sm_ibspawn smoker auto"
"3." "Spawn Smoker"
"4" "sm_ibspawn charger auto"
"4." "Spawn Charger"
"5" "sm_ibspawn jockey auto"
"5." "Spawn Jockey"
"6" "sm_ibspawn spitter auto"
"6." "Spawn Spitter"
"7" "sm_ibspawn tank auto"
"7." "Spawn Tank"
}
}
}
}
worminater is offline
Polaris117
Member
Join Date: Dec 2009
Location: France
Old 06-20-2011 , 18:23   Re: Keep menu open
Reply With Quote #2

When you set a list of options for a command, you have to set the type of the options.

Here is a little example, that worth many explanation

Code:
"Set password"
        {
            "cmd"        "sv_password #1"
            "admin"        "sm_exec"
            "1"
            {
"type" "list" "title" "Choose a password:"
"1" "Blahblah" "2" "azertyuiop" "3" "abc123" "4" "" "4." "Remove password" } }
The "title" is optionnal, but you have to put the "type" at least.

The differents type are:
- "group", to have a list of the different groups depending on the game (Spectator, Deads, Ts & CTs for CS:S, BLU & RED for TF²...)
- "player", to have a list of the current players on the server
- "groupplayer", to have both in one
- "mapcycle", to have the list of the maps listed in mapcycle.txt
- "onoff", which provides only 2 options: 1 or 0. Useful for cvars.
- and "list", to have a custom list, as you want!

So, this is what your code should look like:
Code:
"Commands"
{
    "SpecialMenu"
    {
        "MINIGUN"
        {
            "cmd" "@1"
            "admin" ""
            "1"
                {
                    "type"    "list"
                    "1" "Fortspawn_minigun"
                    "1." "Minigun"
                }
        }
        
        "Fortspawn 2"
        {
            "cmd" "@1"
            "admin" ""
            "1"
                {
                    "type"    "list"
                    "1" "Fortspawn_rotate 30"
                    "1." "Item rotate 30 degrees"
                    "2" "Fortspawn_remove"
                    "2." "Remove Prop"
                    "3" "Fortspawn_irondoor"
                    "3." "Saferoom door"
                    "4" "Fortspawn_ammostack"
                    "4." "Ammo stack"
                }
        }
        
        "Infected Spawn"
        {        
            "cmd" "@1"
            "admin" ""
            "1"
                {
                    "type"    "list"
                    "1" "sm_ibspawn boomer auto"
                    "1." "Spawn Boomer"
                    "2" "sm_ibspawn hunter auto"
                    "2." "Spawn Hunter"
                    "3" "sm_ibspawn smoker auto"
                    "3." "Spawn Smoker"
                    "4" "sm_ibspawn charger auto"
                    "4." "Spawn Charger"
                    "5" "sm_ibspawn jockey auto"
                    "5." "Spawn Jockey"
                    "6" "sm_ibspawn spitter auto"
                    "6." "Spawn Spitter"
                    "7" "sm_ibspawn tank auto"
                    "7." "Spawn Tank"
                }
        }
    }
}
I also remove all the "execute" "player", because by default, "execute" is set to "player", so no need to add it one more time.
Polaris117 is offline
worminater
Member
Join Date: Jun 2011
Old 06-20-2011 , 19:20   Re: Keep menu open
Reply With Quote #3

Works much nicer now, still goes back to the special menu selection screen rather than staying in the infected spawn menu, but it doesnt go all the way out now.

Thanks
worminater is offline
Polaris117
Member
Join Date: Dec 2009
Location: France
Old 06-21-2011 , 05:22   Re: Keep menu open
Reply With Quote #4

It appears that "admin" requires a string command. You can't let it empty to set the command public.

To do so, you'll have to override a command, then add it to the "admin" flag.

Step 1:
Open admin_overrides.cfg in <moddir>/addons/sourcemod/configs. You can totally create a new command that will be used only for "admin" in your menu. Then, let an empty flag to make the command public. So, by example, add this:
Code:
"publiccommand"        ""
Step 2:
Go back to your menu, and now add "publiccommand" in all of your "admin" flag, just like that:
Code:
"Commands"
{
    "SpecialMenu"
    {
        "MINIGUN"
        {
            "cmd" "@1"
            "admin" "publiccommand"
            "1"
                {
                    "type"    "list"
                    "1" "Fortspawn_minigun"
                    "1." "Minigun"
                }
        }
        
        "Fortspawn 2"
        {
            "cmd" "@1"
            "admin" "publiccommand"
            "1"
                {
                    "type"    "list"
                    "1" "Fortspawn_rotate 30"
                    "1." "Item rotate 30 degrees"
                    "2" "Fortspawn_remove"
                    "2." "Remove Prop"
                    "3" "Fortspawn_irondoor"
                    "3." "Saferoom door"
                    "4" "Fortspawn_ammostack"
                    "4." "Ammo stack"
                }
        }
        
        "Infected Spawn"
        {        
            "cmd" "@1"
            "admin" "publiccommand"
            "1"
                {
                    "type"    "list"
                    "1" "sm_ibspawn boomer auto"
                    "1." "Spawn Boomer"
                    "2" "sm_ibspawn hunter auto"
                    "2." "Spawn Hunter"
                    "3" "sm_ibspawn smoker auto"
                    "3." "Spawn Smoker"
                    "4" "sm_ibspawn charger auto"
                    "4." "Spawn Charger"
                    "5" "sm_ibspawn jockey auto"
                    "5." "Spawn Jockey"
                    "6" "sm_ibspawn spitter auto"
                    "6." "Spawn Spitter"
                    "7" "sm_ibspawn tank auto"
                    "7." "Spawn Tank"
                }
        }
    }
}
Try this now, it should be better.
Polaris117 is offline
worminater
Member
Join Date: Jun 2011
Old 06-21-2011 , 08:43   Re: Keep menu open
Reply With Quote #5

Quick question before I make the changes, where you say 'public command' do you mean so that public players will be able to use it? As that isn't what I want to happen.

Just wanting to make sure that isn't the case before I go ahead with this one
worminater is offline
Polaris117
Member
Join Date: Dec 2009
Location: France
Old 06-21-2011 , 09:14   Re: Keep menu open
Reply With Quote #6

Yes, a public ommand is a command that can be used by everyone, even non-admins players. I thought it was what you wanted because you left your "admin" flag empty.
Polaris117 is offline
worminater
Member
Join Date: Jun 2011
Old 06-21-2011 , 09:55   Re: Keep menu open
Reply With Quote #7

No just admins. I took the config that someone made for the fortspawn mod on l4d2 then added my own stuff to it.

On another mod, All4Dead, the menu stays open where it was (except it always returns to page 1), whereas on this menu, it goes back to the menu selection, rather than staying inside the selected area.

For instance, I go into the menu and get the list of infected to spawn, i'd like to spam button 1 for boomers, but instead I press:

1 - boomer
3 - spawn menu
1 - boomer
3 - spawn menu

I'd like to just be able to keep spamming 1 :p
worminater is offline
Tylerst
Veteran Member
Join Date: Oct 2010
Old 06-21-2011 , 10:01   Re: Keep menu open
Reply With Quote #8

I'm afraid that's a result of the way the adminmenu's dynamic menu is coded.

Theres no way to change it asside from directly editing the adminmenu/dynamicmenu.sp file(which of course would cause that effect to happen on all the custom menu entries).

Would probably be better and easier to just add a menu to the source of whatever plugin you're using to spawn them.
Tylerst is offline
Polaris117
Member
Join Date: Dec 2009
Location: France
Old 06-21-2011 , 10:28   Re: Keep menu open
Reply With Quote #9

Ok, I got your problem. And Tylerst is right, there's no way to change this, except by editing the source file and compile as another plugin, sorry. And in this domain I can't help you, because I'm really bad in coding.
Polaris117 is offline
worminater
Member
Join Date: Jun 2011
Old 06-21-2011 , 10:55   Re: Keep menu open
Reply With Quote #10

I have no idea on coding myself either. The plugin itself doesnt come with a menu, so I added it to the custom menu so I didn't need to bind a button for the commands.

What Tylerst has said would actually be ideal, if the custom menu options all stayed on the same screen once a selection has been made. In fact, if all menu's did this, it wouldn't really be an issue, would make things alot easier actually, in terms of what options we actually use.
worminater 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 02:59.


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