• 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 item TFS 1.3

Musaab

NoxOts
Premium User
Joined
May 13, 2010
Messages
177
Reaction score
74
Location
Sweden
Hello there community, its all about sharing i guess, this is a paid script that was made for me a while ago and i thought why not share it for those that are in need of it!

So idk if there is a better script out there for TFS 1.3 or not but am dropping it for the community anyways so enjoy, or not :)

Info:

A teleport item that takes you to your home town /Tempel destination.

Installation below!

data/actions.xml (remember to change itemID to your own item.

Lua:
    <action itemid="2344" script="teleport.lua"/>

new script file in data/actions/scripts and i named the script teleport.lua

Lua:
local cfg = {
useEffect = true, -- display effect after item used? true = yes, false = no
removeCharge = true, -- remove rune after using it? true = yes, false = no
minLevel = 8, --level to use
effect = CONST_ME_TELEPORT -- id or name of Effect
}


local exhaust = createConditionObject(CONDITION_EXHAUST_HEAL)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, (getConfigInfo('timeBetweenExActions') - 2000))


function onUse(cid, item, fromPosition, itemEx, toPosition)
local player = Player(cid)

if(getCreatureCondition(cid, CONDITION_EXHAUST_HEAL) == TRUE) then
doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
return true
end

if player:getLevel() < cfg.minLevel then
player:say("You need " .. cfg.minLevel .. " level to use this item.", TALKTYPE_MONSTER_SAY)
doAddCondition(cid, exhaust)
return true
end

if player:getCondition(CONDITION_INFIGHT, CONDITIONID_DEFAULT) then
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You cannot teleport with pz.")
doAddCondition(cid, exhaust)
return true
end

if cfg.useEffect then
player:say("Teleported Home!", TALKTYPE_MONSTER_SAY)
player:getPosition():sendMagicEffect(cfg.effect)
end
doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))

if cfg.useEffect then
player:getPosition():sendMagicEffect(cfg.effect)
end
doAddCondition(cid, exhaust)

if cfg.removeCharge then
doRemoveItem(item.uid, 1)
end

return true
end
 

N e r o n Z

Banned User
Joined
Jul 12, 2016
Messages
308
Reaction score
81
Hey
If u prefer revscriptys and new code style, here we go:

Lua:
local teleportScript = Action()

local cfg = {
    useEffect = true, -- display effect after item used? true = yes, false = no
    removeCharge = true, -- remove rune after using it? true = yes, false = no
    minLevel = 8, --level to use
    effect = CONST_ME_TELEPORT -- id or name of Effect
}

function teleportScript.onUse(player, item, fromPosition, target, toPosition, isHotkey)

    if player:getStorageValue(52346) >= os.time() then
        player:sendCancelMessage("You cant use it now")
        return true
    end

    if player:getLevel() < cfg.minLevel then
        player:say("You need " .. cfg.minLevel .. " level to use this item.", TALKTYPE_MONSTER_SAY)
        return true
    end

    if player:getCondition(CONDITION_INFIGHT, CONDITIONID_DEFAULT) then
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You cannot teleport with pz.")
        return true
    end

    if cfg.useEffect then
        player:say("Teleported Home!", TALKTYPE_MONSTER_SAY)
        player:getPosition():sendMagicEffect(cfg.effect)
    end

    if cfg.removeCharge then
        item:remove(1)
    end
   
    player:teleportTo(player:getTown():getTemplePosition())
    player:setStorageValue(52346, os.time() + 10) -- 10 means 10 seconds
    return true
end

teleportScript:id(4848)
teleportScript:register()
 
Top