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

2 man teleport problem

advander

Duck
Joined
May 17, 2010
Messages
275
Reaction score
9
I've a script when u use lever you will be teleported

but you need two persons but i can only use it once.

after I tryed agian it give a error.

[Error - Action Interface ]
data/actions/scripts/quest anni softboots.lua: onUse
Description:
(LuaDoPlayerSendCancel) Player not found

Code:
local t = {
	oldPosition = {
		{x = 1167, y = 1475, z = 8},
		{x = 1168, y = 1475, z = 8}
	},
	newPosition = {
		{x = 1041, y = 1593, z = 9},
		{x = 1059, y = 1588, z = 9}
	}
}
local players = {}
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if item.itemid == 9825 or item.itemid == 9826 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 == 2 then
			for i, v in ipairs(players) do
				if getPlayerLevel(v) >= 150 then -- change to whatever you want
					doSendMagicEffect(t.oldPosition[i], CONST_ME_POFF)
					doTeleportThing(v, t.newPosition[i], true)
					doSendMagicEffect(t.newPosition[i], CONST_ME_TELEPORT)
				else
					doPlayerSendCancel(v, "You dont have enough level.")
					break
				end
			end
		else
			return doPlayerSendCancel(#players > 0 and players[1] or cid, "You need atleast 2 players to enter.")
		end
	end
	return doTransformItem(item.uid, item.itemid == 9825 and 9826 or 9825)
end

Help and I Rep+++
 
Learn to read..

Lua:
local t = {
	oldPosition = {
		{x = 1167, y = 1475, z = 8},
		{x = 1168, y = 1475, z = 8}
	},
	newPosition = {
		{x = 1041, y = 1593, z = 9},
		{x = 1059, y = 1588, z = 9}
	}
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
local players = {}
	if item.itemid == 9825 or item.itemid == 9826 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 == 2 then
			for i, v in ipairs(players) do
				if getPlayerLevel(v) >= 150 then -- change to whatever you want
					doSendMagicEffect(t.oldPosition[i], CONST_ME_POFF)
					doTeleportThing(v, t.newPosition[i], true)
					doSendMagicEffect(t.newPosition[i], CONST_ME_TELEPORT)
				else
					doPlayerSendCancel(v, "You dont have enough level.")
					break
				end
			end
		else
			return doPlayerSendCancel(#players > 0 and players[1] or cid, "You need atleast 2 players to enter.")
		end
	end
	return doTransformItem(item.uid, item.itemid == 9825 and 9826 or 9825)
end
 
I read it

Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local players = {}
	if item.itemid == 9825 or item.itemid == 9826 then
		for _, pos in ipairs(t.oldPosition) do
			local c = getTopCreature(pos).uid
			if c > 0 and isPlayer(c) then
				table.insert(players, c)
so what now?
 
Back
Top