function getAllPickups() -- https://www.blast.hk/threads/13380/page-8#post-361600
local pu = {}
pPu = sampGetPickupPoolPtr() + 16388
for i = 0, 4095 do
local id = readMemory(pPu + 4 * i, 4)
if id ~= -1 then
table.insert(pu, sampGetPickupHandleBySampId(i))
end
end
return pu
end
function getPickupAtCoords(x, y, z)
local result = { handle = nil, dist = math.huge }
for _, handle in ipairs(getAllPickups()) do
local px, py, pz = getPickupCoordinates(handle)
local dist = getDistanceBetweenCoords3d(x, y, z, px, py, pz)
if dist < result.dist then
result.dist = dist
result.handle = handle
end
end
return result.handle...