Jump to content

DxPanel


TheSmart

Recommended Posts

Hello Guys!

today i was creating Dx Help Panel but it have problem that is when i press f1 dxpanel show up but when i press f1 again it wont remove :o Tell me why there is any problem in this code?

function open() 
if (guiGetVisible (buttons) == false) then 
guiSetVisible(buttons, true) 
addEventHandler("onClientRender", root, dxPanel) 
showCursor(true) 
elseif (guiGetVisible (buttons) == true) then 
guiSetVisible(buttons, false) 
removeEventHandler("onClientRender", root, dxPanel) 
showCursor(false) 
end 
end 
bindKey ("F1", "down", open) 

Link to comment
function open() 
if (guiGetVisible (buttons) == false) then 
guiSetVisible(buttons, true) 
addEventHandler("onClientRender", root, dxPanel) 
showCursor(true) 
else 
guiSetVisible(buttons, false) 
removeEventHandler("onClientRender", root, dxPanel) 
showCursor(false) 
end 
end 
bindKey ("F1", "down", open) 

Link to comment
function open() 
if (guiGetVisible (buttons) == false) then 
guiSetVisible(buttons, true) 
addEventHandler("onClientRender", root, dxPanel) 
showCursor(true) 
else 
guiSetVisible(buttons, false) 
removeEventHandler("onClientRender", root, dxPanel) 
showCursor(false) 
  end 
end 
bindKey ("F1", "down", open) 

Link to comment

hmmm

try this

windowstate = true 
  
bindKey("F1","down", 
function () 
    if windowstate == true then 
        guiSetVisible(buttons, true) 
        addEventHandler("onClientRender", root, dxPanel) 
        showCursor(true) 
        windowstate = false 
            else 
        guiSetVisible(buttons, false) 
        removeEventHandler("onClientRender", root, dxPanel) 
        showCursor(false) 
        windowstate = true 
    end 
end ) 

Link to comment
function open() 
if (guiGetVisible (buttons) == false) then 
guiSetVisible(buttons, true) 
addEventHandler("onClientRender", root, dxPanel) 
showCursor(true) 
else 
guiSetVisible(buttons, false) 
removeEventHandler("onClientRender", root, dxPanel) 
showCursor(false) 
  end 
end 
bindKey ("F1", "down", open) 

what you change?...Nothing, Not working D:

Link to comment
hmmm

try this

windowstate = true 
  
bindKey("F1","down", 
function () 
    if windowstate == true then 
        guiSetVisible(buttons, true) 
        addEventHandler("onClientRender", root, dxPanel) 
        showCursor(true) 
        windowstate = false 
            else 
        guiSetVisible(buttons, false) 
        removeEventHandler("onClientRender", root, dxPanel) 
        showCursor(false) 
        windowstate = true 
    end 
end ) 

Thank you @Don its working now

Edited by Guest
Link to comment

Another cool way of doing that is this:

bindKey ("F1", "down", 
    function () 
        windowstate = not windowstate 
         
        if windowstate then 
            guiSetVisible (buttons, true) 
            addEventHandler ("onClientRender", root, dxPanel) 
            showCursor (true) 
        else     
            guiSetVisible (buttons, true) 
            removeEventHandler ("onClientRender", root, dxPanel) 
            showCursor (false) 
        end 
    end 
) 

you don't have to declare much variables or stuff, and you might as well want to use guiSetInputEnabled (true), as it won't output to chatbox things you write in your dxPanel

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...