Jump to content

[HELP] Attach dynamic light to vehicle


Polak0

Recommended Posts

Hi. How can I attach dynamic light to vehicle?

I tried attachElements, but it doesn't work.

bindKey("l", "down", function()
local veh = getPedOccupiedVehicle( localPlayer )
local x,y,z = getElementPosition(veh)
if getElementModel(veh)==582 then
if getElementData(veh, "light_left_on") == true then
			setElementData(veh, "light_left_on", false)
			exports["dynamic_lighting"]:destroyLight(light_leftside)
		else
			setElementData(veh, "light_left_on", true)
			--posX,posY,posZ,colorR,colorG,colorB,colorA,dirX,dirY,dirZ,isEuler,falloff,theta,phi,attenuation,...)
			light_leftside = exports["dynamic_lighting"]:createSpotLight(x,y+1.5,z, 1, 1, 1, 1, 0, 0, 0, 2, 40, 0.55, 8, 10)
			attachElements(light_leftside, veh)
end
end
end)

 

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...