is there a native to check if a player is underground or / and in a tunnel? I’ve been looking for this but haven’t found anything ^^
i think you can use the interior id theoretically:
A tool that might help you find interior ids faster:
Not sure if this is the most elegant way of doing this but this might work. Code is not tested though.
function IsUnderground(ped)
local pCoords = GetEntityCoords(ped)
local ground, posZ = GetGroundZFor_3dCoord(pCoords.x, pCoords.y, pCoords.z + 999.0, true)
if ground then
local dist = GetDistanceBetweenCoords(pCoords, posZ, true)
if dist > 5.0 then
return true
end
end
return false
end