Jump to content

BindKey


SkatCh

Recommended Posts

hi guys please can any one fix this for me . i want when the player press F11 = close Hud , and if he press it again = Hud open .

i tried this i am new scripter but it dosen't work :) it just close the Hud .

Note : i create My own Hud it's not GTA Hud so "showPlayerHudComponent" it will never work ,

  
addEventHandler( "onClientKey", root, 
function(button,press) 
    
    if button == "F11" then 
        removeEventHandler("onClientHUDRender", getRootElement(), HudOpening) 
        else 
    addEventHandler("onClientHUDRender", getRootElement(), HudOpening)  
    end 
    
end ) 

Link to comment

Try Using another , Key

addEventHandler( "onClientKey", root,  
function(button,press)  
    if button == "F11" then 
    removeEventHandler("onClientHUDRender", root, HudOpening) 
    elseif button == "F10" then 
     addEventHandler ( "onClientHUDRender", root, HudOpening ) 
  
    end 
end 
) 

--ClientSide ,

Link to comment
local state = false 
  
bindKey ( "F11", "down", 
    function ( ) 
        state = ( not state ) 
        if ( state ) then 
            addEventHandler ( "onClientHUDRender", getRootElement(), HudOpening ) 
        else 
            removeEventHandler ( "onClientHUDRender", getRootElement(), HudOpening ) 
        end 
    end 
) 

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...