AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Close menu (https://forums.alliedmods.net/showthread.php?t=135550)

marquezs 08-17-2010 11:18

Close menu
 
I think the solution is pretty easy but I'm new to pawn and I have no idea on how to do this.

My problem is the following: I have a menu that is only for terrorist and it shows up automatically when terrorist connect, and when terrorist are AFK the menu remains open and every round the teams change and the guy who was in T team, has the menu open and can use the optins in CT and he shouldnt.

I think I can do this thing closing the menu in an event round end but how do I check for a menu that is open or how do I close it?

Thanks

If you didn't undesrtand my problem say so thatt I will try to explain better

drekes 08-17-2010 11:51

Re: Close menu
 
You can show them an empty menu, or try client_cmd(0, "slot 0"); or whatever the 0 key is binded to.

fysiks 08-17-2010 18:29

Re: Close menu
 
Quote:

Originally Posted by drekes (Post 1273429)
You can show them an empty menu, or try client_cmd(0, "slot 0"); or whatever the 0 key is binded to.

1. Slots are designated with the word "slot" immediately followed by a number. E.g. slot1, slot2
1a. slot0 does not exist.
2. It must be one of the slot# commands. If your zero (0) key is bound to anything other than "slot10" then that key will not work for any menu.

Therefore you can use the command "slot10" to remove the menu.

RedRobster 08-17-2010 18:30

Re: Close menu
 
If you just did menu_destroy(menu) would that do the trick if you created the menu in a global variable?

drekes 08-17-2010 18:32

Re: Close menu
 
Quote:

Originally Posted by fysiks (Post 1273868)
1. Slots are designated with the word "slot" immediately followed by a number. E.g. slot1, slot2
1a. slot0 does not exist.
2. It must be one of the slot# commands. If your zero (0) key is bound to anything other than "slot10" then that key will not work for any menu.

Therefore you can use the command "slot10" to remove the menu.

Thanks for clearing that up. As i said, i wasn't sure what the command was.

Quote:

Originally Posted by RedRobster (Post 1273869)
If you just did menu_destroy(menu) would that do the trick if you created the menu in a global variable?

Yeah, that should work too.

fysiks 08-17-2010 18:33

Re: Close menu
 
Quote:

Originally Posted by RedRobster (Post 1273869)
If you just did menu_destroy(menu) would that do the trick if you created the menu in a global variable?

I don't believe so. I'm sure it's been tried before because this "removing the menu from the screen" issue has come up numerous times. You could always test it though!

drekes 08-17-2010 19:13

Re: Close menu
 
Quote:

Originally Posted by fysiks (Post 1273874)
I don't believe so. I'm sure it's been tried before because this "removing the menu from the screen" issue has come up numerous times. You could always test it though!

Gonna do that, will reply in abou 10-15 minutes

menu_destroy doesn't work like you said. client_cmd(id, "slot10"); works well.

XxAvalanchexX 08-17-2010 19:15

Re: Close menu
 
Also, adding a team check in the actual menu handler itself might not be a bad idea in case the menu manages to stay open somehow!


All times are GMT -4. The time now is 22:01.

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