Jump to content

[HELP]Checkbox problem


DeiwnEdits

Recommended Posts

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 by Naruto Edits
Link to comment
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 by DNL291
fix
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...