• 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!

Help with yalahari error.. rep++ and likes!

Bacheer

New Member
Joined
Jun 18, 2009
Messages
246
Reaction score
0
Location
Sweden
Hello, i get an error when i enter this tp on the picture.. It does teleports me to yalahari room quest but i get this strange error posted below.. Also it does not removes when i press on the globe so all can enter it while its a fight in the room..

The error:
Code:
[2:1:29.218] [Error - MoveEvents Interface]
[2:1:29.218] data/movements/scripts/yalahariclean.lua:onStepIn
[2:1:29.218] Description:
[2:1:29.218] data/movements/scripts/yalahariclean.lua:64: attempt to get length
of local 'players' (a number value)
[2:1:29.218] stack traceback:
[2:1:29.218] data/movements/scripts/yalahariclean.lua:64: in function <data/m
ovements/scripts/yalahariclean.lua:51>

The script:
Code:
function mapArea(fromPos, toPos, stack)
	-- Area iterator by Colandus.
	local pos = {x=fromPos.x, y=fromPos.y-1, z=fromPos.z}
	return function()
		if (pos.y < toPos.y) then
			pos.y = pos.y+1
		elseif (pos.x <= toPos.x) then
			pos.y = fromPos.y
			pos.x = pos.x+1
		else
			pos.x = fromPos.x
			pos.y = fromPos.y
			pos.z = pos.z+1
		end
		if (pos.x <= toPos.x and pos.y <= toPos.y or pos.z < toPos.z) then
			if (stack == nil) then
				return pos
			else
				pos.stackpos = stack
				--return pos, getTileThingByPos(pos)
				return pos, getThingfromPos(pos)
			end
		end
	end
end

function getMonstersfromArea(fromPos, toPos)
	-- Function by Penis xD.
	local monsters = {}
	for _, thing in mapArea(fromPos, toPos, 253) do
		if isMonster(thing.uid) == TRUE then
			table.insert(monsters, thing.uid)
		end
	end
	return monsters
end 

function getPlayersfromArea(fromPos, toPos)
	-- Function by Penis xD.
	local players = {}
	for _, thing in mapArea(fromPos, toPos, 253) do
		if isPlayer(thing.uid) == TRUE then
			table.insert(players, thing.uid)
		end
	end
	return players
end



function onStepIn(cid, item, pos, frompos)
	local config = {
		arena = {
			frompos = {x = 5757, y = 6233, z =10},
			topos = {x = 5773, y = 6254, z=10}
		}
	}
	
	local tp = {x=5766, y=6253, z=10} -- teleport to
	local players = getPlayersfromArea(config.arena.frompos, config.arena.topos)
	local monsters = getMonstersfromArea(config.arena.frompos, config.arena.topos)


		if #players  >= 0 then
			doTeleportThing(cid, tp)
			doSendMagicEffect(tp,10)
			end
		if #players  <= 0 then
		for _, monster in ipairs(monsters) do
			doRemoveCreature(monster)
		end
	end

	return true
end

The teleport on mapeditor & positions in game..
muc17m.jpg



Rep++ and likes for help!!:)
 
Back
Top