Matevsz Posted June 22 Share Posted June 22 Hi, how do I make a marker appear next to the plane after pressing the "3" key? for plane (553) local x, y, z = getElementPosition(player) local lightMarker = createMarker(x, y, z - 1, "corona", 1, 255, 255, 255, 150) attachElements(lightMarker, vehicle, 4, 3, -2) setElementData(vehicle, "Marker", lightMarker) local x, y, z = getElementPosition(player) local lightMarker2 = createMarker(x, y, z - 1, "corona", 1, 255, 255, 255, 150) attachElements(lightMarker2, vehicle, -4, 3, -2) setElementData(vehicle, "Marker2", lightMarker2) Link to comment
FileEX Posted June 24 Share Posted June 24 (edited) local function toggleLight(player) local plane = getPedOccupiedVehicle(player) if (plane) then local lightMarker = getElementData(plane, "lightMarker") if (isElement(lightMarker) then -- disable light destroyElement(lightMarker) removeElementData(plane, "lightMarker") return end -- enable light local x,y,z = getElementPosition(plane) local lightMarker = createMarker(x,y,z - 1, 'corona', 1, 255,255,255,150) attachElements(lightMarker, plane, 4, 3, -2) setElementData(plane, "lightMarker", lightMarker, false) end end addEventHandler('onVehicleEnter', root, function(seat,plr) if (seat == 0 and getElementModel(source) == 553) then bindKey(plr, "3", "down", toggleLight) end end) addEventHandler('onVehicleExit', root, function(seat,plr) if (seat == 0 and getElementModel(source) == 553) then unbindKey(plr, "3", "down", toggleLight) end end) Edited June 24 by FileEX 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