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

I dare you to see what is wrong with this .lua script!

Appzyt

New Member
Joined
Jun 1, 2008
Messages
92
Reaction score
0
Lua:
local t = {
	oldPosition = {
		{x = 298, y = 447, z = 7},
		{x = 298, y = 448, z = 7},
		{x = 298, y = 449, z = 7},
		{x = 298, y = 450, z = 7}
	},
	newPosition = {
		{x = 303, y = 444, z = 7},
		{x = 296, y = 442, z = 7},
		{x = 298, y = 444, z = 7},
		{x = 298, y = 440, z = 7}
	}
}
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 == 4 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, "All players need to reach X level.")
					break
				end
			end
		else
			return doPlayerSendCancel(#players > 0 and players[1] or cid, "You need x players in x level or higher to be able to do this!")
		end
	end
	return doTransformItem(item.uid, item.itemid == 1945 and 1946 or 1945)
end

No issues in gui but lever does not work when trying to pull it.
 
Lua:
local old = {
	{x = 298, y = 447, z = 7},
	{x = 298, y = 448, z = 7},
	{x = 298, y = 449, z = 7},
	{x = 298, y = 450, z = 7}
}
local new = {
	{x = 303, y = 444, z = 7},
	{x = 296, y = 442, z = 7},
	{x = 298, y = 444, z = 7},
	{x = 298, y = 440, z = 7}
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if item.itemid == 1945 then
		local t = {}
		for i = 1, #old do
			t[i] = getTopCreature(old[i]).uid
			if t[i] == 0 or not isPlayer(t[i]) then
				return doPlayerSendCancel(cid, 'You need ' .. #old .. ' players for this quest.')
			elseif getPlayerLevel(t[i]) < 100 then
				return doPlayerSendCancel(cid, 'All players must be Level 100 or higher.')
			end
		end
		for i = 1, #new do
			doTeleportThing(t[i], new[i])
			doSendMagicEffect(old[i], CONST_ME_POFF)
			doSendMagicEffect(new[i], CONST_ME_TELEPORT)
		end
	end
	return doTransformItem(item.uid, item.itemid == 1945 and 1946 or 1945)
end
 
Back
Top