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

TFS 1.X+ Teleport Scroll

Try this one
Lua:
exhaustion =
{
        check = function (cid, storage)
                return getPlayerStorageValue(cid, storage) >= os.time(t)
        end,

        get = function (cid, storage)
                local exhaust = getPlayerStorageValue(cid, storage)
                if(exhaust > 0) then
                        local left = exhaust - os.time(t)
                        if(left >= 0) then
                                return left
                        end
                end

                return false
        end,

        set = function (cid, storage, time)
                setPlayerStorageValue(cid, storage, os.time(t) + time)
        end,

        make = function (cid, storage, time)
                local exhaust = exhaustion.get(cid, storage)
                if(not exhaust) then
                        exhaustion.set(cid, storage, time)
                        return true
                end

                return false
        end
}

local newpos = {x=861,  y=698,  z=7}
local time = 8--in second

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    local cid   = player:getId()


if exhaustion.check(cid, 1605) then
return doPlayerSendCancel(cid, "Please Wait "..exhaustion.get(cid,1605).." seconds.") and doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
end

if not player:isPzLocked() == 1 then
doSendMagicEffect(getPlayerPosition(cid), 2)
doTeleportThing(cid,newpos)
doSendMagicEffect(getThingPos(cid), CONST_ME_TELEPORT)
doCreatureSay(cid, "TELEPORTED!!" ,TALKTYPE_ORANGE_1)
exhaustion.set(cid, 1605, time)


   
else
doPlayerSendTextMessage(cid,25,"You can't use the teleport scroll if you are PZ LOCKED!!")
end
return true
end
If it doesn't work then try replacing this
Lua:
if not player:isPzLocked() == 1 then
with this one
Lua:
if not player:getCondition(CONDITION_INFIGHT, CONDITIONID_DEFAULT) then
 
Try this one
Lua:
exhaustion =
{
        check = function (cid, storage)
                return getPlayerStorageValue(cid, storage) >= os.time(t)
        end,

        get = function (cid, storage)
                local exhaust = getPlayerStorageValue(cid, storage)
                if(exhaust > 0) then
                        local left = exhaust - os.time(t)
                        if(left >= 0) then
                                return left
                        end
                end

                return false
        end,

        set = function (cid, storage, time)
                setPlayerStorageValue(cid, storage, os.time(t) + time)
        end,

        make = function (cid, storage, time)
                local exhaust = exhaustion.get(cid, storage)
                if(not exhaust) then
                        exhaustion.set(cid, storage, time)
                        return true
                end

                return false
        end
}

local newpos = {x=861,  y=698,  z=7}
local time = 8--in second

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    local cid   = player:getId()


if exhaustion.check(cid, 1605) then
return doPlayerSendCancel(cid, "Please Wait "..exhaustion.get(cid,1605).." seconds.") and doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
end

if not player:isPzLocked() == 1 then
doSendMagicEffect(getPlayerPosition(cid), 2)
doTeleportThing(cid,newpos)
doSendMagicEffect(getThingPos(cid), CONST_ME_TELEPORT)
doCreatureSay(cid, "TELEPORTED!!" ,TALKTYPE_ORANGE_1)
exhaustion.set(cid, 1605, time)


  
else
doPlayerSendTextMessage(cid,25,"You can't use the teleport scroll if you are PZ LOCKED!!")
end
return true
end
If it doesn't work then try replacing this
Lua:
if not player:isPzLocked() == 1 then
with this one
Lua:
if not player:getCondition(CONDITION_INFIGHT, CONDITIONID_DEFAULT) then

both scripts do not work :(
 
You tried it like this?
Lua:
exhaustion =
{
        check = function (cid, storage)
                return getPlayerStorageValue(cid, storage) >= os.time(t)
        end,

        get = function (cid, storage)
                local exhaust = getPlayerStorageValue(cid, storage)
                if(exhaust > 0) then
                        local left = exhaust - os.time(t)
                        if(left >= 0) then
                                return left
                        end
                end

                return false
        end,

        set = function (cid, storage, time)
                setPlayerStorageValue(cid, storage, os.time(t) + time)
        end,

        make = function (cid, storage, time)
                local exhaust = exhaustion.get(cid, storage)
                if(not exhaust) then
                        exhaustion.set(cid, storage, time)
                        return true
                end

                return false
        end
}

local newpos = {x=861,  y=698,  z=7}
local time = 8--in second

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    local cid   = player:getId()


if exhaustion.check(cid, 1605) then
return doPlayerSendCancel(cid, "Please Wait "..exhaustion.get(cid,1605).." seconds.") and doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
end

if not player:getCondition(CONDITION_INFIGHT, CONDITIONID_DEFAULT) then
doSendMagicEffect(getPlayerPosition(cid), 2)
doTeleportThing(cid,newpos)
doSendMagicEffect(getThingPos(cid), CONST_ME_TELEPORT)
doCreatureSay(cid, "TELEPORTED!!" ,TALKTYPE_ORANGE_1)
exhaustion.set(cid, 1605, time)


  
else
doPlayerSendTextMessage(cid,25,"You can't use the teleport scroll if you are PZ LOCKED!!")
end
return true
end
Your player have any special flags? in data\XML\groups.xml
 
You tried it like this?
Lua:
exhaustion =
{
        check = function (cid, storage)
                return getPlayerStorageValue(cid, storage) >= os.time(t)
        end,

        get = function (cid, storage)
                local exhaust = getPlayerStorageValue(cid, storage)
                if(exhaust > 0) then
                        local left = exhaust - os.time(t)
                        if(left >= 0) then
                                return left
                        end
                end

                return false
        end,

        set = function (cid, storage, time)
                setPlayerStorageValue(cid, storage, os.time(t) + time)
        end,

        make = function (cid, storage, time)
                local exhaust = exhaustion.get(cid, storage)
                if(not exhaust) then
                        exhaustion.set(cid, storage, time)
                        return true
                end

                return false
        end
}

local newpos = {x=861,  y=698,  z=7}
local time = 8--in second

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    local cid   = player:getId()

Where this script go? in action?
if exhaustion.check(cid, 1605) then
return doPlayerSendCancel(cid, "Please Wait "..exhaustion.get(cid,1605).." seconds.") and doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
end

if not player:getCondition(CONDITION_INFIGHT, CONDITIONID_DEFAULT) then
doSendMagicEffect(getPlayerPosition(cid), 2)
doTeleportThing(cid,newpos)
doSendMagicEffect(getThingPos(cid), CONST_ME_TELEPORT)
doCreatureSay(cid, "TELEPORTED!!" ,TALKTYPE_ORANGE_1)
exhaustion.set(cid, 1605, time)


 
else
doPlayerSendTextMessage(cid,25,"You can't use the teleport scroll if you are PZ LOCKED!!")
end
return true
end
Your player have any special flags? in data\XML\groups.xml
Post automatically merged:

Maybe he is putting wrong in the XML script show us the error console!
 
Back
Top