Jump to content

Bad Argument @ getElementParent


Recommended Posts

function detectHit()
if getElementType(markerBlip)=="vehicle" then 
outputChatBox("Get out of that vehicle",markerBlip,255,0,0)
else
outputChatBox("Get out of that vehicle",markerBlip,255,0,0)
end
end

function devMarker()

local deliveryMarker = createMarker(-2300.9340820313, -1649.5125732422, 483.56658935547, "checkpoint")

local markerBlip = createBlipAttachedTo(deliveryMarker, 23)

addEventHandler("onMarkerHit", markerBlip, devMarker)

end
function setupSpawns(thePlayer, command)
local x, y, z = getElementPosition(thePlayer)
local helicopter = createVehicle(417, 0, 0, 0)
local spawnVehicle = spawnVehicle (helicopter, x+3, y+3, z)
if spawnVehicle then exports.SANGcommands:sendMessage("A helicopter has been abandonded (R Icon). Deliver it for a good payday!", 255, 255, 255)

local heliBlip = createBlipAttachedTo(helicopter, 34)

end
end


addCommandHandler("startheli", setupSpawns)
addCommandHandler("startheli", devMarker)
setElementParent(heliBlip, helicopter)

[expected element at argument 1, got nil] ~ How to fix?

Link to comment

Try this.
 

function detectHit()
	if getElementType(markerBlip)=="vehicle" then 
		outputChatBox("Get out of that vehicle",markerBlip,255,0,0)
	else
		outputChatBox("Get out of that vehicle",markerBlip,255,0,0)
	end
end

function devMarker()
	local deliveryMarker = createMarker(-2300.9340820313, -1649.5125732422, 483.56658935547, "checkpoint")
	local markerBlip = createBlipAttachedTo(deliveryMarker, 23)
end
addEventHandler("onMarkerHit", markerBlip, devMarker)

function setupSpawns(thePlayer, command)
	local x, y, z = getElementPosition(thePlayer)
	local helicopter = createVehicle(417, 0, 0, 0)
	local spawned = spawnVehicle (helicopter, x+3, y+3, z)
	if spawned then
		exports.SANGcommands:sendMessage("A helicopter has been abandonded (R Icon). Deliver it for a good payday!", 255, 255, 255)
		local heliBlip = createBlipAttachedTo(helicopter, 34)
		setElementParent(heliBlip, helicopter)
	end
end
addCommandHandler("startheli", setupSpawns)
addCommandHandler("startheli", devMarker)

 

Edited by Skully
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...