xXGhostXx Posted October 17, 2018 Share Posted October 17, 2018 (edited) Hi . What problem my code for on or off vehicle light with bind Key ? Client : bindKey ("5", "down", function() if isPedInVehicle (localPlayer) then local veh = getPedOccupiedVehicle(localPlayer) local id = getElementModel(veh) triggerServerEvent("cheraq", getLocalPlayer()) else -- end end ) Server : function light (thePlayer) local playerVehicle = getPedOccupiedVehicle (thePlayer) setVehicleOverrideLights (playerVehicle, 2) triggerClientEvent ( playerVehicle, "cheraq" ) end @iMr.WiFi..! Please help me ! Edited October 17, 2018 by xXGhostXx Link to comment
iMr.WiFi..! Posted October 17, 2018 Share Posted October 17, 2018 there some mistakes any ways, i made it for you : Client side :- bindKey ("5", "down", function() if isPedInVehicle( localPlayer ) then triggerServerEvent("cheraq", localPlayer) end end ) Server Side :- function light () local playerVehicle = getPedOccupiedVehicle (source) setVehicleOverrideLights (playerVehicle, 2) end addEvent( "cheraq", true ) addEventHandler( "cheraq", root, light ) Link to comment
xXGhostXx Posted October 17, 2018 Author Share Posted October 17, 2018 (edited) 7 minutes ago, iMr.WiFi..! said: there some mistakes any ways, i made it for you : Client side :- bindKey ("5", "down", function() if isPedInVehicle( localPlayer ) then triggerServerEvent("cheraq", localPlayer) end end ) Server Side :- function light () local playerVehicle = getPedOccupiedVehicle (source) setVehicleOverrideLights (playerVehicle, 2) end addEvent( "cheraq", true ) addEventHandler( "cheraq", root, light ) Thanks but cant off light ! @iMr.WiFi..! Help me Edited October 17, 2018 by xXGhostXx Link to comment
iMr.WiFi..! Posted October 17, 2018 Share Posted October 17, 2018 (edited) 12 minutes ago, xXGhostXx said: Thanks but cant off light ! So you want to make it toggle ? Change the server side to :- function light () local playerVehicle = getPedOccupiedVehicle (source) if getVehicleOverrideLights (playerVehicle) < 2 then setVehicleOverrideLights (playerVehicle, 2) else setVehicleOverrideLights (playerVehicle, 0) end end addEvent( "cheraq", true ) addEventHandler( "cheraq", root, light ) Edited October 17, 2018 by iMr.WiFi..! Link to comment
xXGhostXx Posted October 17, 2018 Author Share Posted October 17, 2018 (edited) 2 minutes ago, iMr.WiFi..! said: So you want to make it toggle ? Change the server side to :- function light () local playerVehicle = getPedOccupiedVehicle (source) if getVehicleOverrideLights (playerVehicle) > 2 then setVehicleOverrideLights (playerVehicle, 2) else setVehicleOverrideLights (playerVehicle, 0) end end addEvent( "cheraq", true ) addEventHandler( "cheraq", root, light ) Not work @iMr.WiFi..! Edited October 17, 2018 by xXGhostXx Link to comment
iMr.WiFi..! Posted October 17, 2018 Share Posted October 17, 2018 (edited) function light () local playerVehicle = getPedOccupiedVehicle (source) if ( getVehicleOverrideLights ( playerVehicle ) ~= 2 ) then setVehicleOverrideLights ( playerVehicle, 2 ) else setVehicleOverrideLights ( playerVehicle, 1 ) end end addEvent( "cheraq", true ) addEventHandler( "cheraq", root, light ) Edited October 17, 2018 by iMr.WiFi..! Link to comment
xXGhostXx Posted October 17, 2018 Author Share Posted October 17, 2018 3 minutes ago, iMr.WiFi..! said: function light () local playerVehicle = getPedOccupiedVehicle (source) if ( getVehicleOverrideLights ( playerVehicle ) ~= 2 ) then setVehicleOverrideLights ( playerVehicle, 2 ) else setVehicleOverrideLights ( playerVehicle, 1 ) end end addEvent( "cheraq", true ) addEventHandler( "cheraq", root, light ) Thanks ! Can you give me function for make script engine and hand brake and open door vehicle Link to comment
Gordon_G Posted October 17, 2018 Share Posted October 17, 2018 @iMr.WiFi..! a bit off topic but why you made it for him without even let him try ? You're not helping when you give the entire script 1 Link to comment
iMr.WiFi..! Posted October 17, 2018 Share Posted October 17, 2018 Just now, Gordon_G said: @iMr.WiFi..! a bit off topic but why you made it for him without even let him try ? You're not helping when you give the entire script And the code he did send is not a try? Link to comment
xXGhostXx Posted October 17, 2018 Author Share Posted October 17, 2018 4 minutes ago, Gordon_G said: @iMr.WiFi..! a bit off topic but why you made it for him without even let him try ? You're not helping when you give the entire script Please do not interfere ! 10 minutes ago, iMr.WiFi..! said: And the code he did send is not a try? Sorry men ! I have a question ! function engine () local playerVehicle = getPedOccupiedVehicle (source) if ( getVehicleEngineState ( playerVehicle ) ~= 2 ) then setVehicleEngineState ( playerVehicle, true ) else setVehicleEngineState ( playerVehicle, false ) end end addEvent( "roshan", true ) addEventHandler( "roshan", root, engine ) What is problem ?! I want turn on engine vehicle and turn off engine vehicle like light ! Link to comment
iMr.WiFi..! Posted October 17, 2018 Share Posted October 17, 2018 (edited) 9 minutes ago, xXGhostXx said: Please do not interfere ! Sorry men ! I have a question ! function engine () local playerVehicle = getPedOccupiedVehicle (source) if ( getVehicleEngineState ( playerVehicle ) ~= 2 ) then setVehicleEngineState ( playerVehicle, true ) else setVehicleEngineState ( playerVehicle, false ) end end addEvent( "roshan", true ) addEventHandler( "roshan", root, engine ) What is problem ?! I want turn on engine vehicle and turn off engine vehicle like light ! You need to check if it false or not . not to check if it not a number. Edited October 17, 2018 by iMr.WiFi..! Link to comment
xXGhostXx Posted October 17, 2018 Author Share Posted October 17, 2018 1 minute ago, iMr.WiFi..! said: You need to check if it false or not . not function engine () local playerVehicle = getPedOccupiedVehicle (source) if ( getVehicleEngineState ( playerVehicle ) ~= 2 ) then setVehicleEngineState ( playerVehicle, false ) else setVehicleEngineState ( playerVehicle, true ) end end addEvent( "roshan", true ) addEventHandler( "roshan", root, engine ) Not work Link to comment
iMr.WiFi..! Posted October 17, 2018 Share Posted October 17, 2018 Just now, xXGhostXx said: function engine () local playerVehicle = getPedOccupiedVehicle (source) if ( getVehicleEngineState ( playerVehicle ) ~= 2 ) then setVehicleEngineState ( playerVehicle, false ) else setVehicleEngineState ( playerVehicle, true ) end end addEvent( "roshan", true ) addEventHandler( "roshan", root, engine ) Not work I mean in line 3 not line 4 or 6 Link to comment
xXGhostXx Posted October 17, 2018 Author Share Posted October 17, 2018 2 minutes ago, iMr.WiFi..! said: I mean in line 3 not line 4 or 6 I did not understand where the problem is ! Link to comment
iMr.WiFi..! Posted October 17, 2018 Share Posted October 17, 2018 16 minutes ago, xXGhostXx said: Please do not interfere ! Sorry men ! I have a question ! function engine () local playerVehicle = getPedOccupiedVehicle (source) if ( getVehicleEngineState ( playerVehicle ) ~= 2 ) then setVehicleEngineState ( playerVehicle, true ) else setVehicleEngineState ( playerVehicle, false ) end end addEvent( "roshan", true ) addEventHandler( "roshan", root, engine ) What is problem ?! I want turn on engine vehicle and turn off engine vehicle like light ! You need just to change in line 3, " ~= 2 " to " ~= false "And it will work. Link to comment
xXGhostXx Posted October 17, 2018 Author Share Posted October 17, 2018 25 minutes ago, iMr.WiFi..! said: You need just to change in line 3, " ~= 2 " to " ~= false "And it will work. Thanks ! I have a problem for set hood vehicle door ! function kapootmashin () local playerVehicle = getPedOccupiedVehicle (source) if ( getVehicleDoorState ( playerVehicle ) ~= false ) then setVehicleDoorState ( playerVehicle, 0, true ) else setVehicleDoorState ( playerVehicle, 0, false ) end end addEvent( "kapoot", true ) addEventHandler( "kapoot", root, kapootmashin ) What is problem ?! Link to comment
iMr.WiFi..! Posted October 17, 2018 Share Posted October 17, 2018 if you wants to lock a car use next function : setVehicleLocked Link to comment
xXGhostXx Posted October 17, 2018 Author Share Posted October 17, 2018 11 minutes ago, iMr.WiFi..! said: if you wants to lock a car use next function : setVehicleLocked Please help me for setVehicleDoorState function Link to comment
Insigne Posted October 17, 2018 Share Posted October 17, 2018 What do you want to do with setVehicleDoorState function? Link to comment
iMr.WiFi..! Posted October 18, 2018 Share Posted October 18, 2018 14 hours ago, xXGhostXx said: Please help me for setVehicleDoorState function As i see, that you trying to lock the vehicle with "setVehicleDoorState" function! As i said before: 14 hours ago, iMr.WiFi..! said: if you wants to lock a car use next function : setVehicleLocked Link to comment
xXGhostXx Posted October 18, 2018 Author Share Posted October 18, 2018 3 hours ago, iMr.WiFi..! said: As i see, that you trying to lock the vehicle with "setVehicleDoorState" function! As i said before: How to make handbrake ?! @iMr.WiFi..! Link to comment
Dimos7 Posted October 18, 2018 Share Posted October 18, 2018 (edited) setElementFrozen Edited October 18, 2018 by Dimos7 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