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

temple teleport

Kjhgfd

New Member
Joined
Dec 25, 2016
Messages
63
Reaction score
1
hello guys i use 0.4 i need help to edit in this script
when player move or somone push him tp stop count and stop teleport

Code:
function countDown(number, pos, effect, msgonend, effectonend)
  local n = number
       for i = 1, number do
           addEvent(doSendAnimatedText,i* 1000, pos, n > 1 and n.."" or msgonend .."", n < 6 and TEXTCOLOR_RED or TEXTCOLOR_GREEN)
           addEvent(doSendMagicEffect,i* 1000, pos, n > 1 and effect or effectonend )
              n = n -1
       end
      n = number
return true
end
function onUse(cid, item, fromPosition, itemEx, toPosition)
if isPlayerPzLocked(cid) then
    doPlayerSendCancel(cid,"You Cannot Teleport Right After A Battle!.")
else
    countDown(10, getThingPos(cid), 5, "Warped!", 2)
    doCreatureSetNoMove(cid, 1)
    addEvent(doTeleportThing,10000,cid,getTownTemplePosition(getPlayerTown(cid)),FALSE)
    addEvent(doCreatureSetNoMove,10000,cid, 0)
    addEvent(doSendMagicEffect,10004,getTownTemplePosition(getPlayerTown(cid)), 10)
  end
return true
end
 
you mean this: If you push the player into the portal, you want the portal to not work? is that it?
 
Lua:
function countdown(cid, count, pos, string, effect, endEffect)
    if getThingPos(cid) ~= pos then
        doCreatureSetNoMove(cid, 0)
        return
    end

    if count <= 0 then
        doCreatureSetNoMove(cid, 0)

        local temple_pos = getTownTemplePosition(getPlayerTown(cid))
        doTeleportThing(cid, temple_pos, FALSE)
        doSendMagicEffect(temple_pos, endEffect)
        doSendAnimatedText(pos, string, TEXTCOLOR_RED)
    else
        doSendMagicEffect(pos, effect)
        doSendAnimatedText(pos, count)
        addEvent(countdown, 1000, cid, count - 1, pos, string, effect, endEffect)
    end
end

function onUse(cid, item, fromPosition, itemEx, toPosition)
    if isPlayerPzLocked(cid) then
        doPlayerSendCancel(cid,"You Cannot Teleport Right After A Battle!.")
    else
        doCreatureSetNoMove(cid, 1)
        countdown(cid, 10, getThingPos(cid), "Warped!", 5, 2)
    end
    return true
end

@Kjhgfd Untested but probs something like this would work better.
 
@Kjhgfd There's no way it just didn't work and there weren't errors. This is all I got for you, if this doesn't work, or isn't what you want. You either need to learn to explain in english better or learn to change how you want it yourself.

Teleport rune, counts down and if your positions changes from when you started it cancels the teleport process:
Lua:
function countdown(cid, count, pos, string, effect, endEffect)
    if getThingPos(cid) ~= pos then
        doSendAnimatedText("Cancelled", getThingPos(cid), TEXTCOLOR_RED)
        return
    end
    if count <= 0 then
        local temple_pos = getTownTemplePosition(getPlayerTown(cid))
        doTeleportThing(cid, temple_pos, FALSE)
        doSendMagicEffect(temple_pos, endEffect)
        doSendMagicEffect(pos, endEffect)
        doSendAnimatedText(string, pos, TEXTCOLOR_BLUE)
    else
        doSendMagicEffect(pos, effect)
        doSendAnimatedText(count, pos, TEXTCOLOR_BLUE)
        addEvent(countdown, 1000, cid, count - 1, pos, string, effect, endEffect)
    end
end
function onUse(cid, item, fromPosition, itemEx, toPosition)
    if isPlayerPzLocked(cid) then
        doPlayerSendCancel(cid,"You cannot teleport right after a battle!.")
    else
        local cid = type(cid) ~= "userdata" and cid or cid.uid
        local pos = getThingPos(cid)
        doSendAnimatedText("Portal", pos, TEXTCOLOR_BLUE)
        addEvent(countdown, 1000, cid, 10, pos, "Warped!", CONST_ME_LOSEENERGY, CONST_ME_TELEPORT)
    end
    return true
end
 
Last edited:
@Kjhgfd There's no way it just didn't work and there weren't errors. This is all I got for you, if this doesn't work, or isn't what you want. You either need to learn to explain in english better or learn to change how you want it yourself.

Teleport rune, counts down and if your positions changes from when you started it cancels the teleport process:
Lua:
function countdown(cid, count, pos, string, effect, endEffect)
    if getThingPos(cid) ~= pos then
        doSendAnimatedText("Cancelled", getThingPos(cid), TEXTCOLOR_RED)
        return
    end
    if count <= 0 then
        local temple_pos = getTownTemplePosition(getPlayerTown(cid))
        doTeleportThing(cid, temple_pos, FALSE)
        doSendMagicEffect(temple_pos, endEffect)
        doSendMagicEffect(pos, endEffect)
        doSendAnimatedText(string, pos, TEXTCOLOR_BLUE)
    else
        doSendMagicEffect(pos, effect)
        doSendAnimatedText(count, pos, TEXTCOLOR_BLUE)
        addEvent(countdown, 1000, cid, count - 1, pos, string, effect, endEffect)
    end
end
function onUse(cid, item, fromPosition, itemEx, toPosition)
    if isPlayerPzLocked(cid) then
        doPlayerSendCancel(cid,"You cannot teleport right after a battle!.")
    else
        local cid = type(cid) ~= "userdata" and cid or cid.uid
        local pos = getThingPos(cid)
        doSendAnimatedText("Portal", pos, TEXTCOLOR_BLUE)
        addEvent(countdown, 1000, cid, 10, pos, "Warped!", CONST_ME_LOSEENERGY, CONST_ME_TELEPORT)
    end
    return true
end

yes that i want but ur script not work and no error
 
I came up with this script for you, also tested it and works, just need someone to fix the moving stuff xd

Lua:
local cfg = {
   exhaust = 5, -- cooldown to use the item
   storage = 1337, -- choose whatever value you're not using
}

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

   local function popupEffect(seconds, text, color)
       addEvent(doSendAnimatedText, seconds * 1000, getPlayerPosition(cid), text, color)
   return true
   end

   local function teleportToTemple()
       if getCreatureCondition(cid, CONDITION_INFIGHT) == false then
           doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
           popupEffect(0, "BOOM!", TEXTCOLOR_RED)
       else
           doPlayerSendCancel(cid, "You have to wait for battle to expire before use this item.")
           doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
       end
   return true
   end
      
   if (os.time() - getPlayerStorageValue(cid, cfg.storage)) >= cfg.exhaust then

           addEvent(teleportToTemple, 10000)

           popupEffect(0, "10", TEXTCOLOR_RED)
           popupEffect(1, "9", TEXTCOLOR_RED)
           popupEffect(2, "8", TEXTCOLOR_RED)
           popupEffect(3, "7", TEXTCOLOR_RED)
           popupEffect(4, "6", TEXTCOLOR_RED)
           popupEffect(5, "5", TEXTCOLOR_RED)
           popupEffect(6, "4", TEXTCOLOR_RED)
           popupEffect(7, "3", TEXTCOLOR_RED)
           popupEffect(8, "2", TEXTCOLOR_RED)
           popupEffect(9, "1", TEXTCOLOR_RED)

           setPlayerStorageValue(cid, cfg.storage, os.time() + cfg.exhaust)
    else
       doPlayerSendCancel(cid, "This item is still on cooldown, wait ".. getPlayerStorageValue(cid, cfg.storage) - os.time() .." seconds.")
       doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
    end
  
return true
end
 
I came up with this script for you, also tested it and works, just need someone to fix the moving stuff xd

Lua:
local cfg = {
   exhaust = 5, -- cooldown to use the item
   storage = 1337, -- choose whatever value you're not using
}

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

   local function popupEffect(seconds, text, color)
       addEvent(doSendAnimatedText, seconds * 1000, getPlayerPosition(cid), text, color)
   return true
   end

   local function teleportToTemple()
       if getCreatureCondition(cid, CONDITION_INFIGHT) == false then
           doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
           popupEffect(0, "BOOM!", TEXTCOLOR_RED)
       else
           doPlayerSendCancel(cid, "You have to wait for battle to expire before use this item.")
           doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
       end
   return true
   end
     
   if (os.time() - getPlayerStorageValue(cid, cfg.storage)) >= cfg.exhaust then

           addEvent(teleportToTemple, 10000)

           popupEffect(0, "10", TEXTCOLOR_RED)
           popupEffect(1, "9", TEXTCOLOR_RED)
           popupEffect(2, "8", TEXTCOLOR_RED)
           popupEffect(3, "7", TEXTCOLOR_RED)
           popupEffect(4, "6", TEXTCOLOR_RED)
           popupEffect(5, "5", TEXTCOLOR_RED)
           popupEffect(6, "4", TEXTCOLOR_RED)
           popupEffect(7, "3", TEXTCOLOR_RED)
           popupEffect(8, "2", TEXTCOLOR_RED)
           popupEffect(9, "1", TEXTCOLOR_RED)

           setPlayerStorageValue(cid, cfg.storage, os.time() + cfg.exhaust)
    else
       doPlayerSendCancel(cid, "This item is still on cooldown, wait ".. getPlayerStorageValue(cid, cfg.storage) - os.time() .." seconds.")
       doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
    end
 
return true
end
its work fine but need when move stop count and tp
 
Back
Top