undefined Posted August 4, 2014 Share Posted August 4, 2014 Hey All. I have a problem on my freeroam and i dont understand this problem. When the player entered vehicle, the gui elements visible true but when the player left vehicle then chkEngine and chkKilit is visible false but the other gui elements not visible false. It's not give error or warning on debug. My enter code: addEventHandler("onClientVehicleEnter", getRootElement(), function( thePlayer, seat ) if thePlayer == gMe then local vehicle = getPedOccupiedVehicle(thePlayer) if not vehicle then return end guiSetVisible(repairVehicleButton, true) guiSetVisible(flipVehicleButton, true) guiSetVisible(upgradeVehicleButton, true) guiSetVisible(colorVehicleButton, true) guiSetVisible(paintjobVehicleButton, true) guiSetVisible(chkLights, true) if seat == 0 then guiSetVisible(chkEngine, true) guiSetVisible(chkKilit, true) end if getVehicleOverrideLights ( vehicle ) == 2 then guiCheckBoxSetSelected(chkLights, true) else guiCheckBoxSetSelected(chkLights, false) end end end) My left code: addEventHandler("onClientVehicleStartExit", getRootElement(), function( thePlayer, seat, door ) if thePlayer == gMe then guiCheckBoxSetSelected(chkLights, false) guiCheckBoxSetSelected(chkKilit, false) guiSetVisible(vehPaintjobWindow, false) guiSetVisible(repairVehicleButton, false) guiSetVisible(flipVehicleButton, false) guiSetVisible(upgradeVehicleButton, false) guiSetVisible(colorVehicleButton, false) guiSetVisible(paintjobVehicleButton, false) guiSetVisible(chkLights, false) guiSetVisible(chkKilit, false) guiSetVisible(chkEngine, false) triggerServerEvent("vehPaintjobWindowAyar", localPlayer) guiSetVisible(vehUpgradeWindow, false) triggerServerEvent("vehUpgradeWindowAyar", localPlayer) if seat == 0 then local vehicle = getPedOccupiedVehicle(thePlayer) setVehicleEngineState ( vehicle, false ) triggerServerEvent("setLockState", localPlayer, false) end end end) Note: gMe = getLocalPlayer() Link to comment
AboShanab Posted August 4, 2014 Share Posted August 4, 2014 put your freeroam client file Link to comment
undefined Posted August 4, 2014 Author Share Posted August 4, 2014 But the problem is not in the other code. When the im change "onClientVehicleStartExit" to "onClientVehicleExit" then it's work perfectly. Help... Link to comment
undefined Posted August 5, 2014 Author Share Posted August 5, 2014 My part gui code: repairVehicleButton = guiCreateButton(91, 241, 67, 22, "Tamir Et", false, freeroamWindow) guiSetFont(repairVehicleButton, "default-bold-small") flipVehicleButton = guiCreateButton(167, 241, 67, 22, "Çevir", false, freeroamWindow) guiSetFont(flipVehicleButton, "default-bold-small") upgradeVehicleButton = guiCreateButton(14, 269, 67, 22, "Yükselt", false, freeroamWindow) guiSetFont(upgradeVehicleButton, "default-bold-small") colorVehicleButton = guiCreateButton(91, 269, 67, 22, "Renk", false, freeroamWindow) guiSetFont(colorVehicleButton, "default-bold-small") paintjobVehicleButton = guiCreateButton(168, 269, 67, 22, "Boya", false, freeroamWindow) guiSetFont(paintjobVehicleButton, "default-bold-small") chkLights = guiCreateCheckBox(14, 301, 77, 15, "Far", false, false, freeroamWindow) chkKilit = guiCreateCheckBox(14, 319, 77, 15, "Kilit", false, false, freeroamWindow) chkEngine = guiCreateCheckBox(157, 301, 77, 15, "Motor", true, false, freeroamWindow) Help pls... Link to comment
Max+ Posted August 5, 2014 Share Posted August 5, 2014 Please Explain more what are you trying to do .. . Link to comment
TAPL Posted August 5, 2014 Share Posted August 5, 2014 addEventHandler("onClientVehicleEnter", root, function(thePlayer, seat) if thePlayer == gMe then guiSetVisible(repairVehicleButton, true) guiSetVisible(flipVehicleButton, true) guiSetVisible(upgradeVehicleButton, true) guiSetVisible(colorVehicleButton, true) guiSetVisible(paintjobVehicleButton, true) guiSetVisible(chkLights, true) if seat == 0 then guiSetVisible(chkEngine, true) guiSetVisible(chkKilit, true) end if getVehicleOverrideLights(source) == 2 then guiCheckBoxSetSelected(chkLights, true) else guiCheckBoxSetSelected(chkLights, false) end end end) addEventHandler("onClientVehicleStartExit", root, function(thePlayer, seat, door) if thePlayer == gMe then guiCheckBoxSetSelected(chkLights, false) guiCheckBoxSetSelected(chkKilit, false) guiSetVisible(vehPaintjobWindow, false) guiSetVisible(repairVehicleButton, false) guiSetVisible(flipVehicleButton, false) guiSetVisible(upgradeVehicleButton, false) guiSetVisible(colorVehicleButton, false) guiSetVisible(paintjobVehicleButton, false) guiSetVisible(chkLights, false) guiSetVisible(chkKilit, false) guiSetVisible(chkEngine, false) triggerServerEvent("vehPaintjobWindowAyar", localPlayer) guiSetVisible(vehUpgradeWindow, false) triggerServerEvent("vehUpgradeWindowAyar", localPlayer) if seat == 0 then setVehicleEngineState(source, false) triggerServerEvent("setLockState", localPlayer, false) end end end) Link to comment
undefined Posted August 5, 2014 Author Share Posted August 5, 2014 addEventHandler("onClientVehicleEnter", root, function(thePlayer, seat) if thePlayer == gMe then guiSetVisible(repairVehicleButton, true) guiSetVisible(flipVehicleButton, true) guiSetVisible(upgradeVehicleButton, true) guiSetVisible(colorVehicleButton, true) guiSetVisible(paintjobVehicleButton, true) guiSetVisible(chkLights, true) if seat == 0 then guiSetVisible(chkEngine, true) guiSetVisible(chkKilit, true) end if getVehicleOverrideLights(source) == 2 then guiCheckBoxSetSelected(chkLights, true) else guiCheckBoxSetSelected(chkLights, false) end end end) addEventHandler("onClientVehicleStartExit", root, function(thePlayer, seat, door) if thePlayer == gMe then guiCheckBoxSetSelected(chkLights, false) guiCheckBoxSetSelected(chkKilit, false) guiSetVisible(vehPaintjobWindow, false) guiSetVisible(repairVehicleButton, false) guiSetVisible(flipVehicleButton, false) guiSetVisible(upgradeVehicleButton, false) guiSetVisible(colorVehicleButton, false) guiSetVisible(paintjobVehicleButton, false) guiSetVisible(chkLights, false) guiSetVisible(chkKilit, false) guiSetVisible(chkEngine, false) triggerServerEvent("vehPaintjobWindowAyar", localPlayer) guiSetVisible(vehUpgradeWindow, false) triggerServerEvent("vehUpgradeWindowAyar", localPlayer) if seat == 0 then setVehicleEngineState(source, false) triggerServerEvent("setLockState", localPlayer, false) end end end) Not work Link to comment
undefined Posted August 5, 2014 Author Share Posted August 5, 2014 Please Explain more what are you trying to do .. . When the player start exit to vehicle, the gui elements must be visible false. But only the visible false chkEngine and chkKilit... Link to comment
Max+ Posted August 5, 2014 Share Posted August 5, 2014 (edited) - Edited August 5, 2014 by Guest Link to comment
TAPL Posted August 5, 2014 Share Posted August 5, 2014 --ClientSide repairVehicleButton = guiCreateButton(91, 241, 67, 22, "Tamir Et", false, freeroamWindow) guiSetFont(repairVehicleButton, "default-bold-small") flipVehicleButton = guiCreateButton(167, 241, 67, 22, "Çevir", false, freeroamWindow) guiSetFont(flipVehicleButton, "default-bold-small") upgradeVehicleButton = guiCreateButton(14, 269, 67, 22, "Yükselt", false, freeroamWindow) guiSetFont(upgradeVehicleButton, "default-bold-small") colorVehicleButton = guiCreateButton(91, 269, 67, 22, "Renk", false, freeroamWindow) guiSetFont(colorVehicleButton, "default-bold-small") paintjobVehicleButton = guiCreateButton(168, 269, 67, 22, "Boya", false, freeroamWindow) guiSetFont(paintjobVehicleButton, "default-bold-small") chkLights = guiCreateCheckBox(14, 301, 77, 15, "Far", false, false, freeroamWindow) chkKilit = guiCreateCheckBox(14, 319, 77, 15, "Kilit", false, false, freeroamWindow) chkEngine = guiCreateCheckBox(157, 301, 77, 15, "Motor", true, false, freeroamWindow) addEventHandler("onClientVehicleEnter", root, function(thePlayer, seat) if ( thePlayer == localPlayer and seat == 0 ) then guiSetVisible(repairVehicleButton, true) guiSetVisible(flipVehicleButton, true) guiSetVisible(upgradeVehicleButton, true) guiSetVisible(colorVehicleButton, true) guiSetVisible(paintjobVehicleButton, true) guiSetVisible(chkLights, true) guiSetVisible(chkEngine, true) guiSetVisible(chkKilit, true) if getVehicleOverrideLights(localPlayer) == 2 then guiCheckBoxSetSelected(chkLights, true) else guiCheckBoxSetSelected(chkLights, false) end end end) addEventHandler("onClientVehicleStartExit", root, function(thePlayer, seat, door) if ( thePlayer == localPlayer and seat == 0 ) then guiCheckBoxSetSelected(chkLights, false) guiCheckBoxSetSelected(chkKilit, false) guiSetVisible(vehPaintjobWindow, false) guiSetVisible(repairVehicleButton, false) guiSetVisible(flipVehicleButton, false) guiSetVisible(upgradeVehicleButton, false) guiSetVisible(colorVehicleButton, false) guiSetVisible(paintjobVehicleButton, false) guiSetVisible(chkLights, false) guiSetVisible(chkKilit, false) guiSetVisible(chkEngine, false) triggerServerEvent("vehPaintjobWindowAyar", localPlayer) triggerServerEvent("vehUpgradeWindowAyar", localPlayer) guiSetVisible(vehUpgradeWindow, false) if (door == 0 )then setVehicleEngineState(getPedOccupiedVehicle(localPlayer, false)) triggerServerEvent("setLockState", localPlayer, false) end end end) /debugscript 3 for erros if getVehicleOverrideLights(localPlayer) == 2 then localPlayer is a vehicle? ok don't tell anyone. @AbaZaSiRiN00, I can't see anything wrong with the code, recheck your code there must be a code changing the visible to true again. Link to comment
Max+ Posted August 5, 2014 Share Posted August 5, 2014 Iam sure , he can fix it like this , if getVehicleOverrideLights(getPedOccupiedVehicle(localPlayer == 2)) then Link to comment
undefined Posted August 5, 2014 Author Share Posted August 5, 2014 Im fixed it myself. My problem is in the open/close gui elements. Between "onClientVehicleStartExit" and "onClientVehicleExit" are considered a player in the car. Im added the onVehicleStartExit = false in the "onClientVehicleStartExit" event. And im added the open/close function's if onVehicleStartExit then guiSetVisible(...) ..... Thanks for your help... Link to comment
Max+ Posted August 5, 2014 Share Posted August 5, 2014 (edited) - Edited August 5, 2014 by Guest Link to comment
undefined Posted August 5, 2014 Author Share Posted August 5, 2014 Thnx but im fixed it. Link to comment
Max+ Posted August 5, 2014 Share Posted August 5, 2014 Thnx but im fixed it. As you wish , You'r welcome 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