• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

function getNearbyItems(pos)

manerinhu

I'm very very MaNeRiNhU
Joined
Jan 14, 2008
Messages
79
Reaction score
1
Location
Behind you!
Hi,

Probably there are some others functions like this already made, but I have made this one and I want to share with you, guys.
This functions, as the name says, gets and returns in a table itemids from a square around a predetermined position. It may be useful in some way for someone.
You may use it associated to isInArray, as it returns a table.

Lua:
function getNearbyItems(posa)
local items = {}
local posx = {
	{-1, 0, 1},
	{-1, 0, 1},
	{-1, 0, 1}
}
local posy = {
	{-1, -1, -1},
	{0, 0, 0},
	{1, 1, 1}
}
for i = 1, #posx do
for c = 1, #posy do
	local item = getThingFromPos({x = posa.x+posx[i][c], y = posa.y+posy[i][c], z = posa.z, stackpos = 255}).itemid
	table.insert(items, item)
end
end
	return items
end

Created by me. (also called Deragon)
Helped by iuniX and Elwyn.
 
Last edited:
You can make an script about something like: If getNearbyItems on square (frompos, topos) the items dissapear after drop it on ground (on the square area) ?

I mean: If you drop any item on area (frompos topos) the item is removing after 1 second or something like that
 
Back
Top