local defaultArea = Vector(-16, -16, 72) local function IsEmpty(vector, ignore) ignore = ignore or {} local point = util.PointContents(vector) local a = point ~= CONTENTS_SOLID and point ~= CONTENTS_MOVEABLE and point ~= CONTENTS_LADDER and point ~= CONTENTS_PLAYERCLIP and point ~= CONTENTS_MONSTERCLIP if not a then return false end local b = true for _, v in ipairs(ents.FindInSphere(vector, 35)) do if (v:IsNPC() or v:IsPlayer() or v:GetClass() == "prop_physics" or v.NotEmptyPos) and not table.HasValue(ignore, v) then b = false break end end return a and b end local defaultArea = Vector(-16, -16, 72) -- darkrp local function FindEmptyPos(pos, ignore, distance, step, area) distance = distance or 600 step = step or 20 area = area or defaultArea if IsEmpty(pos, ignore) and IsEmpty(pos + area, ignore) then return pos end for j = step, distance, step do for i = -1, 1, 2 do -- alternate in direction local k = j * i -- Look North/South if IsEmpty(pos + Vector(k, 0, 0), ignore) and IsEmpty(pos + Vector(k, 0, 0) + area, ignore) then return pos + Vector(k, 0, 0) end -- Look East/West if IsEmpty(pos + Vector(0, k, 0), ignore) and IsEmpty(pos + Vector(0, k, 0) + area, ignore) then return pos + Vector(0, k, 0) end -- Look Up/Down if IsEmpty(pos + Vector(0, 0, k), ignore) and IsEmpty(pos + Vector(0, 0, k) + area, ignore) then return pos + Vector(0, 0, k) end end end return pos end function evocitySetPosition(pPlayer) pPlayer:SetPos(FindEmptyPos(Vector(-6956, -9519, 136))) end