[HELP] Trying to make police boat radar (checks plate) closest boat

I am trying to make the police boat (predator) have a radar system that displays the closest vehicle plate number, it worked until I added the ifs to check for the police boat and now nothing happens =/

This is what I did

Citizen.CreateThread(function()
	while true do	
	Citizen.Wait(1)
	local playerDis = GetEntityCoords(LocalPed())
	local boatTarget = GetClosestVehicle(playerDis, 50.000, 0, 12294)
	local boat = GetVehiclePedIsIn(LocalPed(), true)
		if IsPedInVehicle(LocalPed(), boat, true) == true then
		local boatModel = GetEntityModel(boat)
			if IsThisModelAnEmergencyBoat(boatmodel) == true then
				if DoesEntityExist(boatTarget) then
				local plate = GetVehicleNumberPlateText(boatTarget)
				drawTxtPolice('~g~Radar: ~s~boat plate: ~b~' .. plate,0,1,0.5,0.8,0.6,255,255,255,255)
				else
				drawTxtPolice('Boat not exist',0,1,0.5,0.9,0.6,255,255,255,255)
				end
			end
		end
	end
end)

Anybody know what I did wrong?

well, through out the years of me scripting fivem/gta 5, never knew boats had plates :confused:

That’s a randomly created boat from the server, I didn’t do anything to it and yes, it has a plate :wink: Also, the boats from my boat shop and docks have plates which are stored in the database…

Now I need a way to make it so I can only see this radar on this boat =/

im not home, but you can try adding these two lines (don’t know where) but “IsThisModelABoat” and “IsPedInVehicle”.

Yeah I been testing those but I think isthismodel…is broken, I got it working though with “IsVehicleModel” and then grabbing the hashkey :stuck_out_tongue_winking_eye: