Jump to content

Marker near plane


Recommended Posts

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
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 by FileEX
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...