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

Teleport scroll

freddzor11

Member
Joined
May 25, 2009
Messages
695
Reaction score
5
Greetings people!

I got a teleport script, but when I having an event like Zombie event or something then people can use it in there and win, so I wanna ask you if it's possible to make that you can't use it while you are in NO-PVP zone?

Here is teleport script
Code:
local t = {}

function count(cid, time)
    if isPlayer(cid) then
        if getCreatureCondition(cid,CONDITION_INFIGHT) == false and isPlayerPzLocked(cid) == false then
            if time > 0 then
                doSendAnimatedText(getThingPos(cid), time, COLOR_RED)
                addEvent(count, 1000, cid, time - 1)
                return
            else
                local p = getPlayerMasterPos(cid)
                doTeleportThing(cid, p)
                doSendMagicEffect(p, CONST_ME_ENERGYAREA)
            end
        else
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Teleport to temple cancelled because you got attacked!")
        end
    end
    t[cid] = nil
end

function onUse(cid, item, fromPosition, itemEx, toPosition)
    if t[cid] then
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Your teleporter already in use.")
        return true
    end

    if getCreatureCondition(cid, CONDITION_INFIGHT) or isPlayerPzLocked(cid) then
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You can't use this while you are in battle.")
        return true
    end

    count(cid, 5, temple)
    t[cid] = true
    return true
end
 
Code:
function onUse(cid, item, frompos, item2, topos)
local telepos = {x = pos, y = poss, z = poss}
ppos = getPlayerPosition(cid)
if (getCreatureCondition(cid, CONDITION_INFIGHT) == FALSE) then
doTeleportThing(cid, telepos, TRUE)
doSendMagicEffect(ppos,13)
doSendAnimatedText(frompos,'You have been teleported',251)
else
doPlayerSendCancel(cid,"You can't use this while you are in battle.")
doSendMagicEffect(ppos,2)
end
return 1
end
is this?
 
use this teleport scroll script
you need 40 seconds to go back to temple also you must not have pz at this times
Code:
function count(name,time,pos)
    local cid = getCreatureByName(name)
    if cid then
        if not (getCreatureCondition(cid,CONDITION_INFIGHT)) and not (isPlayerPzLocked(cid)) then
            if time > 0 then
                doPlayerSendTextMessage(cid,MESSAGE_TYPES["green"],"You will be teleported in ".. time .. " seconds.")
                addEvent(count,2*1000, name, time - 2, pos)
            else
                doTeleportThing(cid,pos,false)
                doSendMagicEffect(getThingPos(cid),10)
            end
        else
            doPlayerSendTextMessage(cid,MESSAGE_TYPES["green"],"Teleport to temple cancelled as you have battle sign.")
        end
    end
    return true
end

function onUse(cid, item, fromPosition, itemEx, toPosition)
    local scrollid = 12261 -- Id of your rune.
    local temple = getPlayerMasterPos(cid) -- Dont touch


    if getPlayerStorageValue(cid, 1338) >= os.time() then
        doPlayerSendTextMessage(cid,MESSAGE_TYPES["green"],"You can't use this item while you are jailed")
        return true
    end
   
    local coolDown = os.time() - getPlayerStorageValue(cid, 1338)
    if coolDown < 300 then
        doPlayerSendTextMessage(cid,MESSAGE_TYPES["green"],"Your teleporter is in cooldown of 5 minutes. Please wait.")
        return true
    end

    if (getCreatureCondition(cid,CONDITION_INFIGHT)) or (isPlayerPzLocked(cid)) then
        doPlayerSendTextMessage(cid,MESSAGE_TYPES["green"],"You can't use this while you are in battle.")
        return true
    end
    count(getCreatureName(cid),40,temple)
    setPlayerStorageValue(cid,1338, os.time())
    return true
end
Code:
function count(name,time,pos)
    local cid = getCreatureByName(name)
    if cid then
        if not (getCreatureCondition(cid,CONDITION_INFIGHT)) and not (isPlayerPzLocked(cid)) then
            if time > 0 then
                doPlayerSendTextMessage(cid,MESSAGE_TYPES["green"],"You will be teleported in ".. time .. " seconds.")
                addEvent(count,2*1000, name, time - 2, pos)
            else
                doTeleportThing(cid,pos,false)
                doSendMagicEffect(getThingPos(cid),10)
            end
        else
            doPlayerSendTextMessage(cid,MESSAGE_TYPES["green"],"Teleport to temple cancelled as you have battle sign.")
        end
    end
    return true
end

function onUse(cid, item, fromPosition, itemEx, toPosition)
    local scrollid = 12261 -- Id of your rune.
    local temple = getPlayerMasterPos(cid) -- Dont touch


    if getPlayerStorageValue(cid, 1338) >= os.time() then
        doPlayerSendTextMessage(cid,MESSAGE_TYPES["green"],"You can't use this item while you are jailed")
        return true
    end
   
    local coolDown = os.time() - getPlayerStorageValue(cid, 1338)
    if coolDown < 300 then
        doPlayerSendTextMessage(cid,MESSAGE_TYPES["green"],"Your teleporter is in cooldown of 5 minutes. Please wait.")
        return true
    end

    if (getCreatureCondition(cid,CONDITION_INFIGHT)) or (isPlayerPzLocked(cid)) then
        doPlayerSendTextMessage(cid,MESSAGE_TYPES["green"],"You can't use this while you are in battle.")
        return true
    end
    count(getCreatureName(cid),40,temple)
    setPlayerStorageValue(cid,1338, os.time())
    return true
end
 
A Easy code so just configure the from and to and start and it will work

PS:player can't use the teleporter in the following range.{from,to}

Code:
local t = {}
local zombiefrom = {x=900,y=506,z=7}
local zombieto = {x=800,y=605,z=7}

function count(cid, time)
    if isPlayer(cid) then
        if getCreatureCondition(cid,CONDITION_INFIGHT) == false and isPlayerPzLocked(cid) == false then
            if time > 0 then
                doSendAnimatedText(getThingPos(cid), time, COLOR_RED)
                addEvent(count, 1000, cid, time - 1)
                return
            else
                local p = getPlayerMasterPos(cid)
                doTeleportThing(cid, p)
                doSendMagicEffect(p, CONST_ME_ENERGYAREA)
            end
        else
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Teleport to temple cancelled because you got attacked!")
        end
    end
    t[cid] = nil
end

function onUse(cid, item, fromPosition, itemEx, toPosition)
    if t[cid] then
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Your teleporter already in use.")
        return true
    end
if isInRange(getPlayerPosition(cid),zombiefrom,zombieto) then
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You Can't Use Teleporter In Zombie Event.")
return true
end

    if getCreatureCondition(cid, CONDITION_INFIGHT) or isPlayerPzLocked(cid) then
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You can't use this while you are in battle.")
        return true
    end

    count(cid, 5, temple)
    t[cid] = true
    return true
end
 
Code:
if getPlayerStorageValue(cid, 34370) > 0 then
     return doPlayerSendCancel(cid, "You can't use this in the zombie event.")
end
 
Back
Top