The method din't work.
It has bugs, it's just making objects too high in the air
items = {
"Water Bottle",
"Tea",
"Fence",
'Morphine',
"Pizza",
"Chicken Burger",
"Pepsi",
"Fanta",
"Engine",
"Wheel"
}
function getXY( )
return math.random(9999), math.random(9999), math.random(9999)
end
function spawnObjects( )
local x, y, z = getXY( )
z = getGroundPosition( x, y, z )
-- local x, y, z =
local object = createObject( 1271, x, y, z + 0.3 )
setElementData( object, "item", items[ math.random( #items ) ] )
createBlip( 1, x, y, z )
setTimer( spawnObjects, 3000, 1 )
end
spawnObjects( )