Jump to content

Problem with guiSetEnabled in Freeroam panel


Anzo

Recommended Posts

What is the getControl function returning?

Apparently not a gui element as it should, at least in this case.

Mhm, freeroam used getControl for obtain variables/windows/labels. (i think)

Line when defined ''BalasExplosivas''

{ 
      "btn", 
      width=100, 
      x=20, 
      id ="BalasExplosivas",text="Balas explosivas" 
    }, 

Link to comment

There is no function in Freeroam to enable/disable controls by default. You can create your own. e.g

function disableControls(wnd, ...) 
    for i,ctrlName in ipairs({ ... }) do 
        guiSetEnabled(getControl(wnd, ctrlName), false) 
    end 
end 
function enableControls(wnd, ...) 
    for i,ctrlName in ipairs({ ... }) do 
        guiSetEnabled(getControl(wnd, ctrlName), true) 
    end 
end 

Link to comment
There is no function in Freeroam to enable/disable controls by default. You can create your own. e.g
function disableControls(wnd, ...) 
    for i,ctrlName in ipairs({ ... }) do 
        guiSetEnabled(getControl(wnd, ctrlName), false) 
    end 
end 
function enableControls(wnd, ...) 
    for i,ctrlName in ipairs({ ... }) do 
        guiSetEnabled(getControl(wnd, ctrlName), true) 
    end 
end 

Not work:

function disableControls(wndItems) 
    for i,ctrlName in ipairs({ "Balas(Explosivas)" }) do 
        guiSetEnabled(getControl(wndItems, ctrlName), false) 
    end 
end 
addEventHandler("onClientResourceStart", root, disableControls) 

Debug:

WARNING: freeroam\fr_client.lua:106:Bad argument @ 'guiSetEnabled' [Expected gui-element at argument 1, got resource-data

Link to comment
function disableControls(wndItems) -- This is the one and only parameter however wiki says that onClientResourceStart first parameter is the resource that was started

Try using a timer instead.

function disableControls(wndItems) 
    for i,ctrlName in ipairs({ "Balas(Explosivas)" }) do 
        guiSetEnabled(getControl(wndItems, ctrlName), false) 
    end 
end 
setTimer(disableControls, 1000, 1) 

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