xScatta Posted August 19, 2014 Posted August 19, 2014 (edited) Hey guys my problem is that when i press 'i' the window appears but when i press 'i' again then window are supposed to disappear but it won't. It's same in the vehicle. No output in debug script 3. function controls(cond) showCursor(cond) guiSetInputEnabled(cond) end function invShow() if not getPedOccupiedVehicle( localPlayer ) then if guiGetVisible(window) then guiSetVisible( window, false ) controls(false) else triggerServerEvent("onClientUpdateInventory",localPlayer) updatePlayerINV() guiSetVisible(window,true) controls(true) end end if getPedOccupiedVehicle( localPlayer ) then local veh = getPedOccupiedVehicle( localPlayer ) if getElementData(veh,"vehinv") then if guiGetVisible(windowVeh) then guiSetVisible(windowVeh,false) controls(false) else triggerServerEvent("onClientUpdateInventory",veh) updateVehInv() guiSetVisible( windowVeh, true ) end else if guiGetVisible(window) then guiSetVisible( window, false ) controls(false) else triggerServerEvent("onClientUpdateInventory",localPlayer) updatePlayerINV() guiSetVisible(window,true) controls(true) end end end end bindKey("i","down",invShow) Edited August 20, 2014 by Guest
xScatta Posted August 20, 2014 Author Posted August 20, 2014 Sorry for 3rd bump but i really don't understand what i'm doing wrong.
Bonsai Posted August 20, 2014 Posted August 20, 2014 Put some debug message, to see if you actually reach the line where it changes the visibility.
Et-win Posted August 21, 2014 Posted August 21, 2014 Put some debug message, to see if you actually reach the line where it changes the visibility. "No output in debug script 3." Put some 'outputChatBox("Test1/2/3/etc.")' messages in your script to check where it is stopping with working. Then, you can easily see what 'if' is wrong.
Smart. Posted August 21, 2014 Posted August 21, 2014 Maybe you should post the entire script so we also can try? and by just taking a quick glance at it wouldn't be a lot better/easier to use guiSetVisible(window, not guiGetVisible(window))
xScatta Posted August 21, 2014 Author Posted August 21, 2014 I solved the problem by replacing bindKey with "onClientKey".
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