Eshtiz Posted February 3, 2012 Share Posted February 3, 2012 Got a tiny error in my mdc-system, this is actually found in like 10 other scripts, I guess the line is outdated but can't really do it myself, I've started learning scripting recently. Here's the error message: WARNING: mdc-system\c_mdc.lua:1738:bad argument @ 'guiGetVisible' [Expected gui-element at argument 1, got nil] Here's the script line (1738, whole function): function toggleInputEnabled2(key, keyState) -- check to see if its m and down if(key == "m") then if(guiGetVisible(guiMdcWindow)) then if (guiGetInputEnabled( )) then guiSetInputEnabled(false) outputChatBox("Chatbox active", 0, 255, 0, true) outputChatBox("Press M on the keyboard to toggle back and use the MDT") else guiSetInputEnabled(true) outputChatBox("MDT window active", 0, 255, 0, true) end end end end bindKey ( "m", "down", toggleInputEnabled2) Link to comment
Kenix Posted February 3, 2012 Share Posted February 3, 2012 Your variable guiMdcWindow is nil https://wiki.multitheftauto.com/wiki/Int ... ng_the_GUI Link to comment
drk Posted February 3, 2012 Share Posted February 3, 2012 Got a tiny error in my mdc-system, this is actually found in like 10 other scripts, I guess the line is outdated but can't really do it myself, I've started learning scripting recently.Here's the error message: WARNING: mdc-system\c_mdc.lua:1738:bad argument @ 'guiGetVisible' [Expected gui-element at argument 1, got nil] Here's the script line (1738, whole function): function toggleInputEnabled2(key, keyState) -- check to see if its m and down if(key == "m") then if(guiGetVisible(guiMdcWindow)) then if (guiGetInputEnabled( )) then guiSetInputEnabled(false) outputChatBox("Chatbox active", 0, 255, 0, true) outputChatBox("Press M on the keyboard to toggle back and use the MDT") else guiSetInputEnabled(true) outputChatBox("MDT window active", 0, 255, 0, true) end end end end bindKey ( "m", "down", toggleInputEnabled2) I don't know why you need 'if(key == "m") then' LOL bindKey( 'm', 'down', function() if ( guiGetVisible( guiMdcWindow ) == true) then if guiGetInputEnabled() then guiSetInputEnabled( false ); outputChatBox( 'Chatbox active!', 0, 255, 0, false ); outputChatBox( 'Press "M" on the keyboard to toggle back and use the MDT' ); else guiSetInputEnabled( true ); outputChatBox( 'MDT window active!', 0, 255, 0, false ); end; end; end; end); Only more one thing, guiMdcWindow is nil, not exists. Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now