Close last menu if key is pressed again while menu is still open.

master
Icedream 2015-04-23 22:10:04 +02:00
parent 9b7b38c8f7
commit 202840a12d
1 changed files with 4 additions and 0 deletions

View File

@ -1,5 +1,6 @@
-- Sent by the server to let us know about available taunts -- Sent by the server to let us know about available taunts
local sortedTaunts = {} local sortedTaunts = {}
local lastMenu = nil
net.Receive("TauntList_Update", function() net.Receive("TauntList_Update", function()
@ -101,6 +102,9 @@ end
hook.Add( "PlayerBindPress", "PlayerBindPressFKeyMenus", function(pl, bind, pressed) hook.Add( "PlayerBindPress", "PlayerBindPressFKeyMenus", function(pl, bind, pressed)
if bind == "gm_showspare2" and pressed then if bind == "gm_showspare2" and pressed then
if lastMenu ~= nil then
lastMenu:Close()
end
local menu = CreateMenu() local menu = CreateMenu()
if menu ~= nil then if menu ~= nil then
menu:Open() menu:Open()