• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Lua Help Script Teleport

FearWar

Active Member
Joined
Sep 17, 2017
Messages
221
Reaction score
26
Location
Brasil
Help Scripting

LUA:
function onUse(cid, item, frompos, item2, topos)
       if item.uid == 8005 and item.itemid == 1945 then
        player1pos = {x=1135, y=988, z=10, stackpos=253}
        player1 = getThingfromPos(player1pos)

        player2pos = {x=1134, y=989, z=10, stackpos=253}
        player2 = getThingfromPos(player2pos)

        player3pos = {x=1136, y=989, z=10, stackpos=253}
        player3 = getThingfromPos(player3pos)
        
        if player1.itemid > 0 and player2.itemid > 0 and player3.itemid > 0 then
            nplayer1pos = {x=1135, y=970, z=10}
            nplayer2pos = {x=1134, y=971, z=10}
            nplayer3pos = {x=1136, y=971, z=10}

            doTeleportThing(player1,nplayer1pos)
            doTeleportThing(player2,nplayer2pos)
            doTeleportThing(player3,nplayer3pos)
            
            doSendMagicEffect(player1pos,2)
            doSendMagicEffect(player2pos,2)
            doSendMagicEffect(player3pos,2)

            doSendMagicEffect(nplayer1pos,10)
            doSendMagicEffect(nplayer2pos,10)
            doSendMagicEffect(nplayer3pos,10)

    doTransformItem(item.uid,item.itemid+1)
        else
      doPlayerSendCancel(cid,"You need three players four this quest.")
        end
elseif item.uid == 8005 and item.itemid == 1946 then
  if getPlayerAccess(cid,1) then
  doTransformItem(item.uid,item.itemid-1)
  else
  doPlayerSendCancel(cid,"Sorry, not possible.")
  end
else
  return 0
end

return 1
end

Erro console: luaTeleport: thing not found
 
Solution
Try this one
LUA:
function onUse(cid, item, frompos, item2, topos)
       if item.uid == 8005 and item.itemid == 1945 then
        player1pos = {x=1135, y=988, z=10, stackpos=253}
        player1 = getThingfromPos(player1pos)

        player2pos = {x=1134, y=989, z=10, stackpos=253}
        player2 = getThingfromPos(player2pos)

        player3pos = {x=1136, y=989, z=10, stackpos=253}
        player3 = getThingfromPos(player3pos)
       
        if player1.itemid > 0 and player2.itemid > 0 and player3.itemid > 0 then
            nplayer1pos = {x=1135, y=970, z=10}
            nplayer2pos = {x=1134, y=971, z=10}
            nplayer3pos = {x=1136, y=971, z=10}

            doTeleportThing(player1.uid,nplayer1pos)...
Please read this before creating your next thread.
What is your TFS version?
 
Please read this before creating your next thread.
What is your TFS version?

YurOTS 0.9.4f
 
Try this one
LUA:
function onUse(cid, item, frompos, item2, topos)
       if item.uid == 8005 and item.itemid == 1945 then
        player1pos = {x=1135, y=988, z=10, stackpos=253}
        player1 = getThingfromPos(player1pos)

        player2pos = {x=1134, y=989, z=10, stackpos=253}
        player2 = getThingfromPos(player2pos)

        player3pos = {x=1136, y=989, z=10, stackpos=253}
        player3 = getThingfromPos(player3pos)
       
        if player1.itemid > 0 and player2.itemid > 0 and player3.itemid > 0 then
            nplayer1pos = {x=1135, y=970, z=10}
            nplayer2pos = {x=1134, y=971, z=10}
            nplayer3pos = {x=1136, y=971, z=10}

            doTeleportThing(player1.uid,nplayer1pos)
            doTeleportThing(player2.uid,nplayer2pos)
            doTeleportThing(player3.uid,nplayer3pos)
           
            doSendMagicEffect(player1pos,2)
            doSendMagicEffect(player2pos,2)
            doSendMagicEffect(player3pos,2)

            doSendMagicEffect(nplayer1pos,10)
            doSendMagicEffect(nplayer2pos,10)
            doSendMagicEffect(nplayer3pos,10)

    doTransformItem(item.uid,item.itemid+1)
        else
      doPlayerSendCancel(cid,"You need three players four this quest.")
        end
elseif item.uid == 8005 and item.itemid == 1946 then
  if getPlayerAccess(cid,1) then
  doTransformItem(item.uid,item.itemid-1)
  else
  doPlayerSendCancel(cid,"Sorry, not possible.")
  end
else
  return 0
end

return 1
end
 
Solution
Try this one
LUA:
function onUse(cid, item, frompos, item2, topos)
       if item.uid == 8005 and item.itemid == 1945 then
        player1pos = {x=1135, y=988, z=10, stackpos=253}
        player1 = getThingfromPos(player1pos)

        player2pos = {x=1134, y=989, z=10, stackpos=253}
        player2 = getThingfromPos(player2pos)

        player3pos = {x=1136, y=989, z=10, stackpos=253}
        player3 = getThingfromPos(player3pos)
      
        if player1.itemid > 0 and player2.itemid > 0 and player3.itemid > 0 then
            nplayer1pos = {x=1135, y=970, z=10}
            nplayer2pos = {x=1134, y=971, z=10}
            nplayer3pos = {x=1136, y=971, z=10}

            doTeleportThing(player1.uid,nplayer1pos)
            doTeleportThing(player2.uid,nplayer2pos)
            doTeleportThing(player3.uid,nplayer3pos)
          
            doSendMagicEffect(player1pos,2)
            doSendMagicEffect(player2pos,2)
            doSendMagicEffect(player3pos,2)

            doSendMagicEffect(nplayer1pos,10)
            doSendMagicEffect(nplayer2pos,10)
            doSendMagicEffect(nplayer3pos,10)

    doTransformItem(item.uid,item.itemid+1)
        else
      doPlayerSendCancel(cid,"You need three players four this quest.")
        end
elseif item.uid == 8005 and item.itemid == 1946 then
  if getPlayerAccess(cid,1) then
  doTransformItem(item.uid,item.itemid-1)
  else
  doPlayerSendCancel(cid,"Sorry, not possible.")
  end
else
  return 0
end

return 1
end
Thanks @M0ustafa
 
Back
Top