stevensalvaro Posted January 21, 2016 Share Posted January 21, 2016 Hello , I don't know what to do again... I just want to make button when i enter the vehicle .. But it's always visible. So how to make it visible when i enter the vehicle and disable when i exit the vehicle ? Link to comment
1LoL1 Posted January 21, 2016 Share Posted January 21, 2016 onClientPlayerVehicleEnter onClientPlayerVehicleExit Link to comment
NewbProgramming Posted January 21, 2016 Share Posted January 21, 2016 THIS_RESOURCE = getThisResource(); ROOT_ELEMENT = getRootElement(); GUI = { -- BUTTONS button = false }; OnResourceStart = function(resource) if resource == THIS_RESOURCE then GUI.button = guiCreateButton(0.40, 0.75, 0.20, 0.10, "CLICK ME", true, nil); -- x_position, y_position, width, height, text, relative, parent guiSetVisible(GUI.button, false); end return; end OnResourceStop = function(resource) if resource == THIS_RESOURCE then if GUI.button ~= false then destroyElement(GUI.button); end end return; end OnVehicleEnter = function(player, seat, jacked) -- source = vehicle_element if GUI.button ~= false then guiSetVisible(GUI.button, true); end return; end OnVehicleExit = function(player, seat, jacked) -- source = vehicle_element if GUI.button ~= false then guiSetVisible(GUI.button, false); end return; end OnGUIClick = function(button, state, x, y) -- source = gui if state == "up" then if source == GUI.button and guiGetVisible(GUI.button) == true then outputChatBox("You've clicked me!"); end end return; end addEventHandler("onClientResourceStart", ROOT_ELEMENT, OnResourceStart ); addEventHandler("onClientResourceStop", ROOT_ELEMENT, OnResourceStop ); addEventHandler("onClientVehicleEnter", ROOT_ELEMENT, OnVehicleEnter ); addEventHandler("onClientVehicleExit", ROOT_ELEMENT, OnVehicleExit ); addEventHandler("onClientGUIClick", ROOT_ELEMENT, OnGUIClick ); Link to comment
stevensalvaro Posted January 22, 2016 Author Share Posted January 22, 2016 Thank you @NewbProgramming and @1LoL1 , it's work and so helpfull 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