So you have an entity, maybe a square or rectangular platform (or just a bit of floor somewhere, and you want to know if the player is standing on it.
Ent = g_Entity[e] -- the entity we need to test against
local DX, DY, DZ = g_PlayerPosX - Ent.x, g_PlayerPosY - Ent.y, g_PlayerPosZ - Ent.z
local angle = math.atan(DX, DZ) - math.rad(Ent.angley)
local hyp = math.sqrt(DX*DX + DZ*DZ)
local NX, NZ = math.sin(angle) * hyp, math.cos(angle) * hyp
Now simply check DY, NX and NZ against the entity size, assuming the entities origin is in the centre (most are) and is W wide H high and L long:
if (DY > H and DY < H + 50 and DX > -W/2 and DX < W/2 and DZ > -L/2 and DZ < L/2) then
-- Player is on the entity
end
Been there, done that, got all the T-Shirts!