Getting world objects near player

I have tried quite a few methods to check if player is near a tree, and no matter how large I set the radius, the code always returns 0.

Citizen.CreateThread(
    function()
        while true do
            Citizen.Wait(10)
            local ped = GetPlayerPed(-1)
            local pos = GetEntityCoords(ped)
            hash = (GetHashKey("prop_w_r_cedar_01"))
            tree = GetClosestObjectOfType(pos.x,pos.y,pos.z, 5000, hash, true, 0, 1)
            print (tree)
        end
    end
)

What I’ve tried:
Setting the radius to extreme values.
Using a static position near the tree, instead of the player’s position
Using the object name “prop_w_r_cedar_01” instead of the actual hash

Some natives require you to explicitly use floating point values.

I am not 100% sure in this case, but try it with 5000.0 and not just 5000.
Also tried setting the isMission parameter to false instead of true yet?

Citizen.CreateThread(function()
    local hash = `prop_w_r_cedar_01`
    while true do
        Citizen.Wait(0)
        local pos = GetEntityCoords(PlayerPedId())
        tree = GetClosestObjectOfType(pos, 5000.0, hash, true, 0, 1)
        print (tree)
    end
end)

I just tried every combination of switching the radius between float and integer, and every boolean, nothing seemed to work.

Edit: I tried having one spawned in by code, rather than trying to use the ones on the map, and it worked with that. Unfortunately, that doesn’t solve my problem entirely, for what I’m trying to accomplish I need the trees that are already in-game.

Trees generally aren’t a dynamic object (CObject) but a static object (CBuilding). I’m not sure if there’s any obvious function calls to get these in such a way at this time.

I figured it would be something like that, could it be accomplished using raycasting, or would I still encounter the same problem?