How would i make it so that if my dpanel is open from hitting F1 i cant open more of that dpanel with F1?
So you're asking how can you close it if it is already opened by hitting F1 again?
[QUOTE=Jewno;45540709]So you're asking how can you close it if it is already opened by hitting F1 again?[/QUOTE]
no just simply disallowing the panel to be opened again until i close the panel thats open already
Can you post the code please? It technically shouldn't be created multiple times if you press it again.
Keep a reference to your panel and only create it once.
[lua]
--MyPanel is defined as local here so the functions below can keep track of it
local MyPanel = nil
local function MakePanel()
--Make your panel
MyPanel = vgui.Create( ....yourstuff.... )
end
local function ShowPanel()
--Check if the panel exists, if it doesn't then we will make it
if not IsValid(MyPanel) then
MakePanel()
end
--Make it show (if it's already showing, this won't do anything bad)
MyPanel:MakePopup()
end
--concommand or whatever you use to open it
concommand.Add("showmypanel", ShowPanel)[/lua]
[QUOTE=wh1t3rabbit;45540770]Keep a reference to your panel and only create it once.
[lua]
--MyPanel is defined as local here so the functions below can keep track of it
local MyPanel = nil
local function MakePanel()
--Make your panel
MyPanel = vgui.Create( ....yourstuff.... )
end
local function ShowPanel()
--Check if the panel exists, if it doesn't then we will make it
if not IsValid(MyPanel) then
MakePanel()
end
--Make it show (if it's already showing, this won't do anything bad)
MyPanel:MakePopup()
end
--concommand or whatever you use to open it
concommand.Add("showmypanel", ShowPanel)[/lua][/QUOTE]
thanks man worked perfectly
Sorry, you need to Log In to post a reply to this thread.