Polak0 Posted April 19, 2020 Posted April 19, 2020 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)
Moderators IIYAMA Posted April 19, 2020 Moderators Posted April 19, 2020 16 minutes ago, Polak0 said: Hi. How can I attach dynamic light to vehicle? Using: https://wiki.multitheftauto.com/wiki/Resource:Dynamic_lighting#setLightPosition + https://wiki.multitheftauto.com/wiki/OnClientPreRender Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
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