• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

luaDoTileAddItemEx

Status
Not open for further replies.

Fallen

Freelancer
Senator
Joined
Aug 21, 2009
Messages
3,712
Reaction score
250
Location
Egypt
luagetThingPosition() Thing not found
luaGetThingFromPos() Tile not found
line 7: attempt to get length of local 'k' <a number value>
stack traceback:
in function <>
-- this is the error --
-- script --
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local table = {2700, 7024, 2719, 2710, 2718, 3608, 3609, 3616, 3615, 3607}
local grass = 4526
local ret = RETURNVALUE_NOERROR
	if item.itemid == 1945 or item.itemid == 1946 and item.uid == 5000 then
		for _, k in ipairs(table) do
			ret = doTileAddItemEx(getThingFromPos(getThingPos(grass)).uid, doCreateItemEx(k[1][math.random(1, #k[1])]))
		end
	end
	return doTransformItem(item.uid, item.itemid == 1945 and 1946 or 1945)
end
i tried with all shit, using TFS 0.4 newest rev
rep for all who atleast try and help
 
Last edited:
Code:
local t = {2700, 7024, 2719, 2710, 2718, 3608, 3609, 3616, 3615, 3607}
local from, to = 
	{x=89, y=96, z=7},
	{x=121, y=129, z=7}
function onUse(cid, item, fromPosition, itemEx, toPosition)
	for z = from.z, to.z do
		for y = from.y, to.y do
			for x = from.x, to.x do
				local v, k = {x=x, y=y, z=z}, t[math.random(#t)]
				if doTileQueryAdd(doCreateItemEx(k), v) == 1 then
					doCreateItem(k, 1, v)
				end
			end
		end
	end
	return doTransformItem(item.uid, item.itemid == 1945 and 1946 or 1945)
end
 
Code:
local t = {2700, 7024, 2719, 2710, 2718, 3608, 3609, 3616, 3615, 3607}
local from, to = 
	{x=89, y=96, z=7},
	{x=121, y=129, z=7}
function onUse(cid, item, fromPosition, itemEx, toPosition)
	for z = from.z, to.z do
		for y = from.y, to.y do
			for x = from.x, to.x do
				local v, k = {x=x, y=y, z=z}, t[math.random(#t)]
				if doTileQueryAdd(doCreateItemEx(k), v) == 1 then
					doCreateItem(k, 1, v)
				end
			end
		end
	end
	return doTransformItem(item.uid, item.itemid == 1945 and 1946 or 1945)
end
yes sir, check ur user cp
 
Status
Not open for further replies.
Back
Top