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

x Players with x level teleport to x pos

Appzyt

New Member
Joined
Jun 1, 2008
Messages
92
Reaction score
0
So I tried scripting such simple script but it dosnt work flawless anyone know why just by looking at the code?

Lua:
local t = {
	oldPosition = {
		{x = 539, y = 337, z = 12},
		{x = 540, y = 337, z = 12},
		{x = 541, y = 337, z = 12},
		{x = 542, y = 337, z = 12},
		{x = 543, y = 337, z = 12},
		
		{x = 539, y = 341, z = 12},
		{x = 540, y = 341, z = 12},
		{x = 541, y = 341, z = 12},		
		{x = 542, y = 341, z = 12},		
		{x = 543, y = 341, z = 12}
	},
	newPosition = {
		{x = 772, y = 485, z = 2},
		{x = 773, y = 485, z = 2},
		{x = 774, y = 485, z = 2},
		{x = 775, y = 486, z = 2},
		
		{x = 784, y = 486, z = 2},
		{x = 783, y = 486, z = 2},
		{x = 782, y = 486, z = 2},
		
		{x = 783, y = 476, z = 2},	
		{x = 783, y = 475, z = 2},		
		{x = 782, y = 475, z = 2}
	}
}
local players = {}
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if item.itemid == 1945 or item.itemid == 1946 then
		for _, pos in ipairs(t.oldPosition) do
			local c = getTopCreature(pos).uid
			if c > 0 and isPlayer(c) then
				table.insert(players, c)
			end
		end
		if #players == 10 then
			for i, v in ipairs(players) do
				if getPlayerLevel(v) >= 100 then 
					doSendMagicEffect(t.oldPosition[i], CONST_ME_POFF)
					doTeleportThing(v, t.newPosition[i], true)
					doSendMagicEffect(t.newPosition[i], CONST_ME_TELEPORT)
				else
					doPlayerSendCancel(v, "If all players not yet achived X level.")
					break
				end
			end
		else
			return doPlayerSendCancel(#players > 0 and players[1] or cid, "Cancel text here.")
		end
	end
	return doTransformItem(item.uid, item.itemid == 1945 and 1946 or 1945)
end
 

Similar threads

Back
Top