DeiwnEdits Posted December 22, 2018 Share Posted December 22, 2018 (edited) Hi guys , I have problem I creating checkbox ; steerhelp = guiCreateCheckBox(145,470,100,15,"Steering Assist",true,false,window) Function; function deneme(button) if button == "left" then if source == bOpenHood then local door = 0 local move_door = 1 triggerServerEvent("moveDoorVeh", getLocalPlayer(), door, move_door) ------------------------------------------------------------------------------------------------ if(guiCheckBoxGetSelected(steerhelp))then if(guiCheckBoxSetSelected(steerhelp,true) local steeringHelpEnabled = true else guiCheckBoxSetSelected(steerhelp,false) local steeringHelpEnabled = false end end addEventHandler("onClientGUIClick", getRootElement(), deneme) When I check the checkbox, I want to have "local steeringHelpEnabled = true / false" Please help me , where error? I don't know function. Edited December 22, 2018 by Naruto Edits Link to comment
DNL291 Posted December 23, 2018 Share Posted December 23, 2018 (edited) local steeringHelpEnabled = true steerhelp = guiCreateCheckBox(145,470,100,15,"Steering Assist",true,false,window) function deneme(button) if button == "left" then if source == bOpenHood then local door = 0 local move_door = 1 triggerServerEvent("moveDoorVeh", getLocalPlayer(), door, move_door) steeringHelpEnabled = not steeringHelpEnabled guiCheckBoxSetSelected(steerhelp, steeringHelpEnabled) end end end addEventHandler("onClientGUIClick", guiRoot, deneme) About the rest of code I didn't understand how should work, but the variable changing it's value when clicking the check box should work. Edit: If 'source' is the checkbox your code should look like this: local steeringHelpEnabled = true steerhelp = guiCreateCheckBox(145,470,100,15,"Steering Assist",true,false,window) function deneme(button) if button == "left" then if source == steerhelp then local door = 0 local move_door = 1 triggerServerEvent("moveDoorVeh", getLocalPlayer(), door, move_door) steeringHelpEnabled = guiCheckBoxGetSelected(source) end end end addEventHandler("onClientGUIClick", guiRoot, deneme) Edited December 23, 2018 by DNL291 fix 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