local sx,sy = guiGetScreenSize()
local px,py = 1280,720
local x, y = (sx/px), (sy/py)
local localP = getLocalPlayer()
local data = {}
local positions = {
{323.9013671875, 2490.8134765625, 15.484375},
{335.341796875, 2486.669921875, 15.484375},
{330.0751953125, 2496.310546875, 15.484375},
{325, 2480.7265625, 15.484375}
}
addEventHandler("onClientResourceStart", resourceRoot,
function()
for _, value in ipairs(positions) do
local object = createObject(2427, value[1], value[2], value[3])
local colsphere = createColSphere (value[1], value[2], value[3], 1.5)
local blip = createBlip(value[1], value[2], value[3], 33, 2.5, 255, 0, 0, 255, 0, 100)
data[colsphere] = {object = object, blip = blip, colsphere = colsphere}
setObjectScale(value.object, 1.5)
addEventHandler("onClientColShapeHit", colsphere, onClientColShapeHit)
addEventHandler("onClientColShapeLeave", colsphere, onClientColShapeLeave)
end
end
)
function onClientColShapeHit(element, dimension)
if not data[source] then return end
if element == localP and dimension then
bindKey('F','down', StartSeta, source)
addEventHandler('onClientRender', getRootElement(), Text_Seta)
end
end
function onClientColShapeLeave()
unbindKey('F','down', StartSeta)
removeEventHandler('onClientRender', getRootElement(), Text_Seta)
end
function StartSeta(_, _, colsphere)
if data[colsphere] then
unbindKey('F','down', StartSeta)
removeEventHandler('onClientRender', getRootElement(), Text_Seta)
removeEventHandler("onClientColShapeHit", colsphere, onClientColShapeHit)
removeEventHandler("onClientColShapeLeave", colsphere, onClientColShapeLeave)
destroyElement(data[colsphere].object)
destroyElement(data[colsphere].blip)
destroyElement(data[colsphere].colsphere)
data[colsphere] = nil
end
end
function Text_Seta ()
dxDrawText("Use (F) to pick this item", x*481, y*483, x*800, y*501, tocolor(255, 255, 255, 255), 1.35, "default-bold", "center", "top", false, false, false, false, false)
end
try this