0 Members and 2 Guests are viewing this topic.
local p = getVehicleController( source )function lights() if isPedInVehicle(source) then --if player in car then --get the car of the controller, lets call it gat gat = getPedOccupiedVehicle(source) if (gat) then --check if gat is here (the vehicle) if ( getVehicleOverrideLights ( gat ) ~= 2 ) then --check if lights arent on setVehicleOverrideLights ( gat, 2 ) --set it on else setVehicleOverrideLights ( gat, 1 ) --set it off if it already on end end endendbindKey(p, "l", "down", lights) --bind this function in L button to trigger it.--oraddCommandHandler("lights", lights) -- trigger it by /lights
local p = getVehicleController(source)addCommandHandler("lights", --orbindKey(p, "l", "down", function() if isPedInVehicle(source) then --if player in car then --get the car of the controller, lets call it gat local gat = getPedOccupiedVehicle(source) if ( gat ) then --check if gat is here (the Vehicle) if ( getVehicleOverrideLights ( gat ) == 0 ) or ( getVehicleOverrideLights ( playerVehicle ) == 1 ) then --check if lights arent on setVehicleOverrideLights ( gat, 2 ) --set it on else setVehicleOverrideLights ( gat, 1 ) --set it off if it already on end end endend)
bindKey(gat, "l", "down", lights) --bind this function in L button to trigger it.
Cool, So you're saying we can use this script to switch on/off vehicle Head Lights? @Gat
bindKey(gat)?first argument is a player not a vehicle
Spoiler: showEnable or disable vehicles lights by pressing "L" buttonCode: (server) [Select]local p = getVehicleController( source )function lights() if isPedInVehicle(source) then --if player in car then --get the car of the controller, lets call it gat gat = getPedOccupiedVehicle(source) if (gat) then --check if gat is here (the vehicle) if ( getVehicleOverrideLights ( gat ) ~= 2 ) then --check if lights arent on setVehicleOverrideLights ( gat, 2 ) --set it on else setVehicleOverrideLights ( gat, 1 ) --set it off if it already on end end endendbindKey(p, "l", "down", lights) --bind this function in L button to trigger it.--oraddCommandHandler("lights", lights) -- trigger it by /lightsAnother wayCode: (server) [Select]local p = getVehicleController(source)addCommandHandler("lights", --orbindKey(p, "l", "down", function() if isPedInVehicle(source) then --if player in car then --get the car of the controller, lets call it gat local gat = getPedOccupiedVehicle(source) if ( gat ) then --check if gat is here (the Vehicle) if ( getVehicleOverrideLights ( gat ) == 0 ) or ( getVehicleOverrideLights ( playerVehicle ) == 1 ) then --check if lights arent on setVehicleOverrideLights ( gat, 2 ) --set it on else setVehicleOverrideLights ( gat, 1 ) --set it off if it already on end end endend)https://forum.igcrpg.com/?topic=4064.msg23978#newJust practice to myself
--Client sidefunction lightss() if (not isPedInVehicle(localPlayer)) then return false end local veh = getPedOccupiedVehicle(localPlayer) if (getVehicleOverrideLights(veh) ~= 2) then setVehicleOverrideLights(veh, 2) else setVehicleOverrideLights(veh, 1) endendaddCommandHandler("lights", lights)