Checking if vehicle has landed

trying to use taskplaneland but how would I check if the plane has landed in the spot, it seems to be random coords all the time but this is what I have

local ped = GetEntityCoords(GetPlayerPed(-1), true)
	    local plane = GetEntityCoords(existingVeh, true)
	    while DoesEntityExist(existingVeh) do
			Citizen.Wait(0)
			local distance = GetDistanceBetweenCoords(ped.x, ped.y, ped.z, plane.x, plane.y, plane.z, false)
			if distance < 100 then
				drawTxt("testing to see if this is working", 5000)
			end
		end

but this isn’t drawing the text, wondering what I am doing wrong here.

local ped = GetEntityCoords(GetPlayerPed(-1), true)
	    local plane = GetEntityCoords(existingVeh, true)
	    while DoesEntityExist(existingVeh) do
			Citizen.Wait(0)
			local distance = GetDistanceBetweenCoords(ped.x, ped.y, ped.z, plane.x, plane.y, plane.z, false)
			if distance < 100 then
				DrawText1("testing to see if this is working")
			end
		end

function DrawText1(text)
    SetTextFont(0)
    SetTextProportional(1)
    SetTextScale(0.0, 0.50)
    SetTextDropshadow(1, 0, 0, 0, 255)
    SetTextEdge(1, 0, 0, 0, 255)
    SetTextDropShadow()
    SetTextOutline()
    SetTextEntry("STRING")
    AddTextComponentString(text)
    DrawText(0.10, 0.10)
end

TRY THIS

I have the drawtext function in it lol

Well you didnt show that so I didnt know

I know, just saying. Just trying to figure this out is all :stuck_out_tongue:

There is not draw text function your calling a function that isnt even there

Copy the code i sent you and it should work

still not

Ok explain top me what you want and ill try and fix it

Do you have discord?

i’m trying to when the plane lands you can walk up to it. and it would do something.but this isn’t working, I don’t know why.

pm’d you, thank you for the help

anyone else have an idea?

Try putting 100.0 instead of just 100

just tried that and it’s not making a difference. :confused:

also… put the GetEntityCoords for ped and plane in the loop too. It will only call once the way you have it and it will forever use those coords at that one time.

2 Likes

let me try that, one minute.

Put a print fuinction to see if it is working up to a certain point

“print function” :confused:

Sometimes i cri

1 Like

that was it, thank you so much <3

1 Like