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

Lua [Action] Problem with tp-lever

lenidas

New Member
Joined
Mar 18, 2010
Messages
149
Reaction score
0
Hello, i have problem with lever..

It teleports player when player stand on special X,Y,Z (getTopCreature) so its good but when no one stand on this item and player use lever than i have error in console:

Code:
[Error - Action Interface] 
data/actions/scripts/zaolever.lua:onUse
Description: 
(luaDoTeleportThing) Thing not found

Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if(item.actionid == 4830) then
       doTeleportThing(getTopCreature({x=32991,y=31539,z=1}).uid, {x=32991,y=31539,z=4})
	elseif (item.actionid == 4831) then
		doTeleportThing(getTopCreature({x=32991,y=31539,z=4}).uid, {x=32991,y=31539,z=1})
	elseif (item.actionid == 4832) then
		doTeleportThing(getTopCreature({x=32993,y=31547,z=4}).uid, {x=33061,y=31527,z=10})
	elseif (item.actionid == 4833) then
		doTeleportThing(getTopCreature({x=33061,y=31527,z=10}).uid, {x=32993,y=31547,z=4})
	end
	return true
end

I think i have to add something like
Code:
doPlayerSendCancel(cid,"Sorry, not possible")

but where?
 
Last edited:
Try this :D



PHP:
local Pos1 = {x=32991, y=31539, z=1, stackpos=1}
local Pos2 = {x=32991, y=31539, z=4, stackpos=1}
local Pos3 = {x=32993, y=31547, z=4, stackpos=1}
local Pos4 = {x=33061, y=31527, z=10, stackpos=1}
local newPos1 = {x=32991, y=31539, z=1, stackpos=1}
local newPos2 = {x=32991, y=31539, z=1, stackpos=1}
local newPos3 = {x=33061, y=31527, z=10, stackpos=1}
local newPos4 = {x=32993, y=31547, z=4, stackpos=1}



function onUse(cid, item, fromPosition, itemEx, toPosition)

    if(item.actionid == 4830) then
      if getTopCreature(Pos1) == TRUE then
        doTeleportThing(getTopCreature(Pos1), newPos1)
        return TRUE
      end
    end
     
    if (item.actionid == 4831) then
      if getTopCreature(Pos2) == TRUE then
	doTeleportThing(getTopCreature(Pos2), newPos2)
        return TRUE
      end
    end

    if (item.actionid == 4832) then
        if getTopCreature(Pos3) == TRUE then
          doTeleportThing(getTopCreature(Pos3), newPos3)
          return TRUE
        end
    end

    if (item.actionid == 4833) then
      if getTopCreature(Pos4) == TRUE then
        doTeleportThing(getTopCreature(Pos4), newPos4)
	return TRUE
      end
    end

end
 
Code:
local t = {
	[4830] = {{x=32991,y=31539,z=1}, {x=32991,y=31539,z=4}},
	[4831] = {{x=32991,y=31539,z=4}, {x=32991,y=31539,z=1}},
	[4832] = {{x=32993,y=31547,z=4}, {x=33061,y=31527,z=10}},
	[4833] = {{x=33061,y=31527,z=10}, {x=32993,y=31547,z=4}}
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if item.itemid == 1945 then
		local i = t[item.actionid]
		local v = getTopCreature(i[1]).uid
		if isPlayer(v) then
			doTeleportThing(v, i[2])
			doSendMagicEffect(i[1], CONST_ME_TELEPORT)
			doSendMagicEffect(i[2], CONST_ME_TELEPORT)
			doTransformItem(item.uid, 1946)
		else
			return doPlayerSendCancel(cid, 'Sorry, not possible.')
		end
	else
		return doTransformItem(item.uid, 1945)
	end
end
 
Back
Top