[HELP] Cant get "IsEntityInWater()" to work :(

Basically I have a while loop checking to see if there is on water or not… but no matter what I use for entity nothing works look:

function LocalPed()
    return GetPlayerPed(-1)
end

Citizen.CreateThread(function()
	while true do
        Wait(0)
	drawNotification('TESTING WHILE LOOP NOTHING TO SEE HERE LUL',0,1,0.5,0.8,0.6,255,255,255,255)	   
        local player = LocalPed()

			if IsEntityInWater(LocalPed(), true) == true then
			   drawTxt('PLAYER IS IN WATER',0,1,0.5,3.8,0.6,255,255,255,255)
		    end
    end
end)

I have tried the native:

if Citizen.InvokeNative(0xCFB0A0D8EDD145A3, Citizen.PointerValueIntInitialized(LocalPed())) == true then

I tried using player, localPed(), removing the, true inside the function… nothing

I can’t get this to work =/ does anybody here know what I am doing wrong?

That’s weird, I use IsEntityInWater(GetPlayerPed(-1)) and it works very well.
I don’t use true parameter at the end since it’s not referenced in the doc: https://runtime.fivem.net/doc/reference.html#_0xCFB0A0D8EDD145A3

I don’t use it in a loop either but it shouldn’t matter.

Did you check the ingame console (F8)?

Are you sure the drawTxt is actually somewhere where you can see it.

yeah I got it working, something was wrong with my logic (as always)

I pretty much got all the natives to work that I am interested in :slight_smile: I figured since there is no way to check whats wrong with the code I’d make a message pop whenever something is true or not so far so good haha