saluta Posted August 31, 2021 Posted August 31, 2021 Spoiler how to turn off the headlights on the server side, because if on the client side, then the person who turned it on only sees and the rest do not see. function consoleVehicleLights ( thePlayer ) local playerVehicle = getPedOccupiedVehicle ( thePlayer ) if playerVehicle then if ( getVehicleOverrideLights ( playerVehicle ) ~= 2 ) then setVehicleOverrideLights ( playerVehicle, 2 ) else setVehicleOverrideLights ( playerVehicle, 1 ) end end end addCommandHandler ( "vehiclelights", consoleVehicleLights ) addEventHandler ( "onResourceStart", root, consoleVehicleLights) bindKey("l", "down", "vehiclelights", thePlayer ) hi, help please. Spoiler
βurak Posted August 31, 2021 Posted August 31, 2021 function consoleVehicleLights (thePlayer) local playerVehicle = getPedOccupiedVehicle ( thePlayer ) if playerVehicle then if ( getVehicleOverrideLights ( playerVehicle ) ~= 2 ) then setVehicleOverrideLights ( playerVehicle, 2 ) else setVehicleOverrideLights ( playerVehicle, 1 ) end end end addCommandHandler ( "vehiclelights", consoleVehicleLights ) addEventHandler("onResourceStart", resourceRoot, function() for _,player in ipairs(getElementsByType("player")) do bindKey(player, "l", "down", "vehiclelights") end end ) do it this way 1
saluta Posted September 1, 2021 Author Posted September 1, 2021 16 hours ago, Burak5312 said: function consoleVehicleLights (thePlayer) local playerVehicle = getPedOccupiedVehicle ( thePlayer ) if playerVehicle then if ( getVehicleOverrideLights ( playerVehicle ) ~= 2 ) then setVehicleOverrideLights ( playerVehicle, 2 ) else setVehicleOverrideLights ( playerVehicle, 1 ) end end end addCommandHandler ( "vehiclelights", consoleVehicleLights ) addEventHandler("onResourceStart", resourceRoot, function() for _,player in ipairs(getElementsByType("player")) do bindKey(player, "l", "down", "vehiclelights") end end ) do it this way Great work bro, do you want to return to the project? i'll do advertising right now
βurak Posted September 1, 2021 Posted September 1, 2021 By the way, if that's all the codes are, keys will not be assigned for newly joined players, so add this line. addEventHandler("onPlayerJoin", root, function() bindKey(source, "l", "down", "vehiclelights") end ) 1
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