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

someone convert this script to work in tfs 1.5 nekiro 8.0 ?

Shoorkill

Member
Joined
Dec 17, 2018
Messages
138
Reaction score
23
local function Teleport10(cid)
if isPlayer(cid) == TRUE then
xpos = getPlayerStorageValue(cid, 111)
ypos = getPlayerStorageValue(cid, 222)
zpos = getPlayerStorageValue(cid, 333)
spos = {x=xpos, y=ypos, z=zpos}
doTeleportThing(cid, spos)
doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE, 'Você foi teletransportado com sucesso.')
doSendMagicEffect(getCreaturePosition(cid), 38)
doSendAnimatedText(getCreaturePosition(cid), "Woup!!", 213)
end
return TRUE
end

local function Teleport9(cid)
xpos = getPlayerStorageValue(cid, 111)
ypos = getPlayerStorageValue(cid, 222)
zpos = getPlayerStorageValue(cid, 333)
spos = {x=xpos, y=ypos, z=zpos}
if isPlayer(cid) == TRUE then
doSendMagicEffect(spos, 38)
doSendMagicEffect(getCreaturePosition(cid), 38)
addEvent(Teleport10, 1 * 1000, cid)
end
end

local function Teleport8(cid)
xpos = getPlayerStorageValue(cid, 111)
ypos = getPlayerStorageValue(cid, 222)
zpos = getPlayerStorageValue(cid, 333)
spos = {x=xpos, y=ypos, z=zpos}
if isPlayer(cid) == TRUE then
doSendMagicEffect(spos, 38)
doSendMagicEffect(getCreaturePosition(cid), 38)
addEvent(Teleport9, 1 * 1000, cid)
end
end

local function Teleport7(cid)
xpos = getPlayerStorageValue(cid, 111)
ypos = getPlayerStorageValue(cid, 222)
zpos = getPlayerStorageValue(cid, 333)
spos = {x=xpos, y=ypos, z=zpos}
if isPlayer(cid) == TRUE then
doSendMagicEffect(spos, 38)
doSendMagicEffect(getCreaturePosition(cid), 38)
addEvent(Teleport8, 1 * 1000, cid)
end
end

local function Teleport6(cid)
xpos = getPlayerStorageValue(cid, 111)
ypos = getPlayerStorageValue(cid, 222)
zpos = getPlayerStorageValue(cid, 333)
spos = {x=xpos, y=ypos, z=zpos}
if isPlayer(cid) == TRUE then
doSendMagicEffect(spos, 38)
doSendMagicEffect(getCreaturePosition(cid), 38)
addEvent(Teleport7, 1 * 1000, cid)
end
end

local function Teleport5(cid)
xpos = getPlayerStorageValue(cid, 111)
ypos = getPlayerStorageValue(cid, 222)
zpos = getPlayerStorageValue(cid, 333)
spos = {x=xpos, y=ypos, z=zpos}
if isPlayer(cid) == TRUE then
doSendMagicEffect(spos, 38)
doSendMagicEffect(getCreaturePosition(cid), 38)
addEvent(Teleport6, 1 * 1000, cid)
end
end

local function Teleport4(cid)
xpos = getPlayerStorageValue(cid, 111)
ypos = getPlayerStorageValue(cid, 222)
zpos = getPlayerStorageValue(cid, 333)
spos = {x=xpos, y=ypos, z=zpos}
if isPlayer(cid) == TRUE then
doSendMagicEffect(spos, 38)
doSendMagicEffect(getCreaturePosition(cid), 38)
addEvent(Teleport5, 1 * 1000, cid)
end
end

local function Teleport3(cid)
xpos = getPlayerStorageValue(cid, 111)
ypos = getPlayerStorageValue(cid, 222)
zpos = getPlayerStorageValue(cid, 333)
spos = {x=xpos, y=ypos, z=zpos}
if isPlayer(cid) == TRUE then
doSendMagicEffect(spos, 38)
doSendMagicEffect(getCreaturePosition(cid), 38)
addEvent(Teleport4, 1 * 1000, cid)
end
end

local function Teleport2(cid)
xpos = getPlayerStorageValue(cid, 111)
ypos = getPlayerStorageValue(cid, 222)
zpos = getPlayerStorageValue(cid, 333)
spos = {x=xpos, y=ypos, z=zpos}
if isPlayer(cid) == TRUE then
doSendMagicEffect(spos, 38)
doSendMagicEffect(getCreaturePosition(cid), 38)
addEvent(Teleport3, 1 * 1000, cid)
end
end

local function Teleport1(cid)
xpos = getPlayerStorageValue(cid, 111)
ypos = getPlayerStorageValue(cid, 222)
zpos = getPlayerStorageValue(cid, 333)
spos = {x=xpos, y=ypos, z=zpos}
if isPlayer(cid) == TRUE then
doSendMagicEffect(spos, 38)
doSendMagicEffect(getCreaturePosition(cid), 38)
addEvent(Teleport2, 1 * 1000, cid)
end
end



local condition = createConditionObject(CONDITION_EXHAUSTED)
setConditionParam(condition, CONDITION_PARAM_TICKS, 15000)

function onUse(cid, item, frompos, item2, topos)

-- Exhausted Settings --
local exhausted_seconds1 = 15 -- Segundos que irá demorar para usar denovo
local exhausted_storagevalue1 = 8754 -- Storage Value do exhausted
local exhausted_seconds3 = 15 -- How many seconds mana fluid will be unavailible to use. --
local exhausted_storagevalue3 = 8162 -- Storage Value to store exhaust. It MUST be unused! --exhausted


local teleport = getPlayerStorageValue(cid, 384)

if(os.time() < getPlayerStorageValue(cid, exhausted_storagevalue1)) then
doPlayerSendCancel(cid,"Você está muito cansado.")
return TRUE
end

if getPlayerSkullType(cid) == 3 then
doPlayerSendCancel(cid,"Você não pode usar esse teleport enquanto estiver PK.")
return TRUE
end

if teleport == -1 or teleport == 0 then
savpos = {x=getThingPos(cid).x, y=getThingPos(cid).y, z=getThingPos(cid).z, stackpos=253}
setPlayerStorageValue(cid, 111, savpos.x)
setPlayerStorageValue(cid, 222, savpos.y)
setPlayerStorageValue(cid, 333, savpos.z)
setPlayerStorageValue(cid, 384, 1)
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_BLUE)
doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE, 'Você gravou suas coordenadas em seu teleport mistico.')

rand = math.random(0,100)
elseif teleport == 1 and (os.time() >= getPlayerStorageValue(cid, exhausted_storagevalue1)) and rand < 40 then
addEvent(Teleport1, 1 * 1000, cid)
setPlayerStorageValue(cid, 384, 0)
doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE, 'Você ativou seu teleport mistico.')
setPlayerStorageValue(cid, exhausted_storagevalue1, os.time() + exhausted_seconds1)
setPlayerStorageValue(cid, exhausted_storagevalue3, os.time() + exhausted_seconds3)
addCombatCondition(0, cid, condition, CONST_ME_NONE)
doSendMagicEffect(getCreaturePosition(cid), 38)
doRemoveItem(item.uid,1)


elseif teleport == 1 and (os.time() >= getPlayerStorageValue(cid, exhausted_storagevalue1)) and rand > 40 then
addEvent(Teleport1, 1 * 1000, cid)
setPlayerStorageValue(cid, 384, 0)
doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE, 'Você ativou seu teleport mistico.')
setPlayerStorageValue(cid, exhausted_storagevalue1, os.time() + exhausted_seconds1)
setPlayerStorageValue(cid, exhausted_storagevalue3, os.time() + exhausted_seconds3)
addCombatCondition(0, cid, condition, CONST_ME_NONE)
doSendMagicEffect(getCreaturePosition(cid), 38)
doRemoveItem(item.uid,1)
end
end
 
local function Teleport10(cid)
if isPlayer(cid) == TRUE then
xpos = getPlayerStorageValue(cid, 111)
ypos = getPlayerStorageValue(cid, 222)
zpos = getPlayerStorageValue(cid, 333)
spos = {x=xpos, y=ypos, z=zpos}
doTeleportThing(cid, spos)
doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE, 'Você foi teletransportado com sucesso.')
doSendMagicEffect(getCreaturePosition(cid), 38)
doSendAnimatedText(getCreaturePosition(cid), "Woup!!", 213)
end
return TRUE
end

local function Teleport9(cid)
xpos = getPlayerStorageValue(cid, 111)
ypos = getPlayerStorageValue(cid, 222)
zpos = getPlayerStorageValue(cid, 333)
spos = {x=xpos, y=ypos, z=zpos}
if isPlayer(cid) == TRUE then
doSendMagicEffect(spos, 38)
doSendMagicEffect(getCreaturePosition(cid), 38)
addEvent(Teleport10, 1 * 1000, cid)
end
end

local function Teleport8(cid)
xpos = getPlayerStorageValue(cid, 111)
ypos = getPlayerStorageValue(cid, 222)
zpos = getPlayerStorageValue(cid, 333)
spos = {x=xpos, y=ypos, z=zpos}
if isPlayer(cid) == TRUE then
doSendMagicEffect(spos, 38)
doSendMagicEffect(getCreaturePosition(cid), 38)
addEvent(Teleport9, 1 * 1000, cid)
end
end

local function Teleport7(cid)
xpos = getPlayerStorageValue(cid, 111)
ypos = getPlayerStorageValue(cid, 222)
zpos = getPlayerStorageValue(cid, 333)
spos = {x=xpos, y=ypos, z=zpos}
if isPlayer(cid) == TRUE then
doSendMagicEffect(spos, 38)
doSendMagicEffect(getCreaturePosition(cid), 38)
addEvent(Teleport8, 1 * 1000, cid)
end
end

local function Teleport6(cid)
xpos = getPlayerStorageValue(cid, 111)
ypos = getPlayerStorageValue(cid, 222)
zpos = getPlayerStorageValue(cid, 333)
spos = {x=xpos, y=ypos, z=zpos}
if isPlayer(cid) == TRUE then
doSendMagicEffect(spos, 38)
doSendMagicEffect(getCreaturePosition(cid), 38)
addEvent(Teleport7, 1 * 1000, cid)
end
end

local function Teleport5(cid)
xpos = getPlayerStorageValue(cid, 111)
ypos = getPlayerStorageValue(cid, 222)
zpos = getPlayerStorageValue(cid, 333)
spos = {x=xpos, y=ypos, z=zpos}
if isPlayer(cid) == TRUE then
doSendMagicEffect(spos, 38)
doSendMagicEffect(getCreaturePosition(cid), 38)
addEvent(Teleport6, 1 * 1000, cid)
end
end

local function Teleport4(cid)
xpos = getPlayerStorageValue(cid, 111)
ypos = getPlayerStorageValue(cid, 222)
zpos = getPlayerStorageValue(cid, 333)
spos = {x=xpos, y=ypos, z=zpos}
if isPlayer(cid) == TRUE then
doSendMagicEffect(spos, 38)
doSendMagicEffect(getCreaturePosition(cid), 38)
addEvent(Teleport5, 1 * 1000, cid)
end
end

local function Teleport3(cid)
xpos = getPlayerStorageValue(cid, 111)
ypos = getPlayerStorageValue(cid, 222)
zpos = getPlayerStorageValue(cid, 333)
spos = {x=xpos, y=ypos, z=zpos}
if isPlayer(cid) == TRUE then
doSendMagicEffect(spos, 38)
doSendMagicEffect(getCreaturePosition(cid), 38)
addEvent(Teleport4, 1 * 1000, cid)
end
end

local function Teleport2(cid)
xpos = getPlayerStorageValue(cid, 111)
ypos = getPlayerStorageValue(cid, 222)
zpos = getPlayerStorageValue(cid, 333)
spos = {x=xpos, y=ypos, z=zpos}
if isPlayer(cid) == TRUE then
doSendMagicEffect(spos, 38)
doSendMagicEffect(getCreaturePosition(cid), 38)
addEvent(Teleport3, 1 * 1000, cid)
end
end

local function Teleport1(cid)
xpos = getPlayerStorageValue(cid, 111)
ypos = getPlayerStorageValue(cid, 222)
zpos = getPlayerStorageValue(cid, 333)
spos = {x=xpos, y=ypos, z=zpos}
if isPlayer(cid) == TRUE then
doSendMagicEffect(spos, 38)
doSendMagicEffect(getCreaturePosition(cid), 38)
addEvent(Teleport2, 1 * 1000, cid)
end
end



local condition = createConditionObject(CONDITION_EXHAUSTED)
setConditionParam(condition, CONDITION_PARAM_TICKS, 15000)

function onUse(cid, item, frompos, item2, topos)

-- Exhausted Settings --
local exhausted_seconds1 = 15 -- Segundos que irá demorar para usar denovo
local exhausted_storagevalue1 = 8754 -- Storage Value do exhausted
local exhausted_seconds3 = 15 -- How many seconds mana fluid will be unavailible to use. --
local exhausted_storagevalue3 = 8162 -- Storage Value to store exhaust. It MUST be unused! --exhausted


local teleport = getPlayerStorageValue(cid, 384)

if(os.time() < getPlayerStorageValue(cid, exhausted_storagevalue1)) then
doPlayerSendCancel(cid,"Você está muito cansado.")
return TRUE
end

if getPlayerSkullType(cid) == 3 then
doPlayerSendCancel(cid,"Você não pode usar esse teleport enquanto estiver PK.")
return TRUE
end

if teleport == -1 or teleport == 0 then
savpos = {x=getThingPos(cid).x, y=getThingPos(cid).y, z=getThingPos(cid).z, stackpos=253}
setPlayerStorageValue(cid, 111, savpos.x)
setPlayerStorageValue(cid, 222, savpos.y)
setPlayerStorageValue(cid, 333, savpos.z)
setPlayerStorageValue(cid, 384, 1)
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_BLUE)
doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE, 'Você gravou suas coordenadas em seu teleport mistico.')

rand = math.random(0,100)
elseif teleport == 1 and (os.time() >= getPlayerStorageValue(cid, exhausted_storagevalue1)) and rand < 40 then
addEvent(Teleport1, 1 * 1000, cid)
setPlayerStorageValue(cid, 384, 0)
doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE, 'Você ativou seu teleport mistico.')
setPlayerStorageValue(cid, exhausted_storagevalue1, os.time() + exhausted_seconds1)
setPlayerStorageValue(cid, exhausted_storagevalue3, os.time() + exhausted_seconds3)
addCombatCondition(0, cid, condition, CONST_ME_NONE)
doSendMagicEffect(getCreaturePosition(cid), 38)
doRemoveItem(item.uid,1)


elseif teleport == 1 and (os.time() >= getPlayerStorageValue(cid, exhausted_storagevalue1)) and rand > 40 then
addEvent(Teleport1, 1 * 1000, cid)
setPlayerStorageValue(cid, 384, 0)
doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE, 'Você ativou seu teleport mistico.')
setPlayerStorageValue(cid, exhausted_storagevalue1, os.time() + exhausted_seconds1)
setPlayerStorageValue(cid, exhausted_storagevalue3, os.time() + exhausted_seconds3)
addCombatCondition(0, cid, condition, CONST_ME_NONE)
doSendMagicEffect(getCreaturePosition(cid), 38)
doRemoveItem(item.uid,1)
end
end




LUA:
local function Teleport10(cid)
    if isPlayer(cid) then
        local xpos = getPlayerStorageValue(cid, 111)
        local ypos = getPlayerStorageValue(cid, 222)
        local zpos = getPlayerStorageValue(cid, 333)
        local spos = {x = xpos, y = ypos, z = zpos}
        doTeleportThing(cid, spos)
        doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, 'Você foi teletransportado com sucesso.')
        doSendMagicEffect(getCreaturePosition(cid), 38)
        doSendAnimatedText(getCreaturePosition(cid), "Woup!!", 213)
    end
    return true
end

local function Teleport9(cid)
    local xpos = getPlayerStorageValue(cid, 111)
    local ypos = getPlayerStorageValue(cid, 222)
    local zpos = getPlayerStorageValue(cid, 333)
    local spos = {x = xpos, y = ypos, z = zpos}
    if isPlayer(cid) then
        doSendMagicEffect(spos, 38)
        doSendMagicEffect(getCreaturePosition(cid), 38)
        addEvent(Teleport10, 1 * 1000, cid)
    end
end

local function Teleport8(cid)
    local xpos = getPlayerStorageValue(cid, 111)
    local ypos = getPlayerStorageValue(cid, 222)
    local zpos = getPlayerStorageValue(cid, 333)
    local spos = {x = xpos, y = ypos, z = zpos}
    if isPlayer(cid) then
        doSendMagicEffect(spos, 38)
        doSendMagicEffect(getCreaturePosition(cid), 38)
        addEvent(Teleport9, 1 * 1000, cid)
    end
end

local function Teleport7(cid)
    local xpos = getPlayerStorageValue(cid, 111)
    local ypos = getPlayerStorageValue(cid, 222)
    local zpos = getPlayerStorageValue(cid, 333)
    local spos = {x = xpos, y = ypos, z = zpos}
    if isPlayer(cid) then
        doSendMagicEffect(spos, 38)
        doSendMagicEffect(getCreaturePosition(cid), 38)
        addEvent(Teleport8, 1 * 1000, cid)
    end
end

local function Teleport6(cid)
    local xpos = getPlayerStorageValue(cid, 111)
    local ypos = getPlayerStorageValue(cid, 222)
    local zpos = getPlayerStorageValue(cid, 333)
    local spos = {x = xpos, y = ypos, z = zpos}
    if isPlayer(cid) then
        doSendMagicEffect(spos, 38)
        doSendMagicEffect(getCreaturePosition(cid), 38)
        addEvent(Teleport7, 1 * 1000, cid)
    end
end

local function Teleport5(cid)
    local xpos = getPlayerStorageValue(cid, 111)
    local ypos = getPlayerStorageValue(cid, 222)
    local zpos = getPlayerStorageValue(cid, 333)
    local spos = {x = xpos, y = ypos, z = zpos}
    if isPlayer(cid) then
        doSendMagicEffect(spos, 38)
        doSendMagicEffect(getCreaturePosition(cid), 38)
        addEvent(Teleport6, 1 * 1000, cid)
    end
end

local function Teleport4(cid)
    local xpos = getPlayerStorageValue(cid, 111)
    local ypos = getPlayerStorageValue(cid, 222)
    local zpos = getPlayerStorageValue(cid, 333)
    local spos = {x = xpos, y = ypos, z = zpos}
    if isPlayer(cid) then
        doSendMagicEffect(spos, 38)
        doSendMagicEffect(getCreaturePosition(cid), 38)
        addEvent(Teleport5, 1 * 1000, cid)
    end
end

local function Teleport3(cid)
    local xpos = getPlayerStorageValue(cid, 111)
    local ypos = getPlayerStorageValue(cid, 222)
    local zpos = getPlayerStorageValue(cid, 333)
    local spos = {x = xpos, y = ypos, z = zpos}
    if isPlayer(cid) then
        doSendMagicEffect(spos, 38)
        doSendMagicEffect(getCreaturePosition(cid), 38)
        addEvent(Teleport4, 1 * 1000, cid)
    end
end

local function Teleport2(cid)
    local xpos = getPlayerStorageValue(cid, 111)
    local ypos = getPlayerStorageValue(cid, 222)
    local zpos = getPlayerStorageValue(cid, 333)
    local spos = {x = xpos, y = ypos, z = zpos}
    if isPlayer(cid) then
        doSendMagicEffect(spos, 38)
        doSendMagicEffect(getCreaturePosition(cid), 38)
        addEvent(Teleport3, 1 * 1000, cid)
    end
end

local function Teleport1(cid)
    local xpos = getPlayerStorageValue(cid, 111)
    local ypos = getPlayerStorageValue(cid, 222)
    local zpos = getPlayerStorageValue(cid, 333)
    local spos = {x = xpos, y = ypos, z = zpos}
    if isPlayer(cid) then
        doSendMagicEffect(spos, 38)
        doSendMagicEffect(getCreaturePosition(cid), 38)
        addEvent(Teleport2, 1 * 1000, cid)
    end
end

local condition = createConditionObject(CONDITION_EXHAUSTED)
setConditionParam(condition, CONDITION_PARAM_TICKS, 15000)

function onUse(cid, item, frompos, item2, topos)
    -- Exhausted Settings --
    local exhausted_seconds1 = 15 -- Segundos que irá demorar para usar denovo
    local exhausted_storagevalue1 = 8754 -- Storage Value do exhausted
    local exhausted_seconds3 = 15 -- How many seconds mana fluid will be unavailible to use. --
    local exhausted_storagevalue3 = 8162 -- Storage Value to store exhaust. It MUST be unused! --exhausted

    local teleport = getPlayerStorageValue(cid, 384)

    if os.time() < getPlayerStorageValue(cid, exhausted_storagevalue1) then
        doPlayerSendCancel(cid, "Você está muito cansado.")
        return true
    end

    if getPlayerSkullType(cid) == SKULL_RED then
        doPlayerSendCancel(cid, "Você não pode usar esse teleport enquanto estiver PK.")
        return true
    end

    if teleport == -1 or teleport == 0 then
        local savpos = {x = getThingPos(cid).x, y = getThingPos(cid).y, z = getThingPos(cid).z, stackpos = 253}
        setPlayerStorageValue(cid, 111, savpos.x)
        setPlayerStorageValue(cid, 222, savpos.y)
        setPlayerStorageValue(cid, 333, savpos.z)
        setPlayerStorageValue(cid, 384, 1)
        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_BLUE)
        doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, 'Você gravou suas coordenadas em seu teleport mistico.')

        local rand = math.random(0, 100)
    elseif teleport == 1 and os.time() >= getPlayerStorageValue(cid, exhausted_storagevalue1) then
        if rand < 40 then
            addEvent(Teleport1, 1 * 1000, cid)
            setPlayerStorageValue(cid, 384, 0)
            doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, 'Você ativou seu teleport mistico.')
            setPlayerStorageValue(cid, exhausted_storagevalue1, os.time() + exhausted_seconds1)
            setPlayerStorageValue(cid, exhausted_storagevalue3, os.time() + exhausted_seconds3)
            addCombatCondition(0, cid, condition, CONST_ME_NONE)
            doSendMagicEffect(getCreaturePosition(cid), 38)
            doRemoveItem(item.uid, 1)
        else
            addEvent(Teleport1, 1 * 1000, cid)
            setPlayerStorageValue(cid, 384, 0)
            doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, 'Você ativou seu teleport mistico.')
            setPlayerStorageValue(cid, exhausted_storagevalue1, os.time() + exhausted_seconds1)
            setPlayerStorageValue(cid, exhausted_storagevalue3, os.time() + exhausted_seconds3)
            addCombatCondition(0, cid, condition, CONST_ME_NONE)
            doSendMagicEffect(getCreaturePosition(cid), 38)
            doRemoveItem(item.uid, 1)
        end
    end
end

Test and report errors.
 
LUA:
local function Teleport10(cid)
    if isPlayer(cid) then
        local xpos = getPlayerStorageValue(cid, 111)
        local ypos = getPlayerStorageValue(cid, 222)
        local zpos = getPlayerStorageValue(cid, 333)
        local spos = {x = xpos, y = ypos, z = zpos}
        doTeleportThing(cid, spos)
        doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, 'Você foi teletransportado com sucesso.')
        doSendMagicEffect(getCreaturePosition(cid), 38)
        doSendAnimatedText(getCreaturePosition(cid), "Woup!!", 213)
    end
    return true
end

local function Teleport9(cid)
    local xpos = getPlayerStorageValue(cid, 111)
    local ypos = getPlayerStorageValue(cid, 222)
    local zpos = getPlayerStorageValue(cid, 333)
    local spos = {x = xpos, y = ypos, z = zpos}
    if isPlayer(cid) then
        doSendMagicEffect(spos, 38)
        doSendMagicEffect(getCreaturePosition(cid), 38)
        addEvent(Teleport10, 1 * 1000, cid)
    end
end

local function Teleport8(cid)
    local xpos = getPlayerStorageValue(cid, 111)
    local ypos = getPlayerStorageValue(cid, 222)
    local zpos = getPlayerStorageValue(cid, 333)
    local spos = {x = xpos, y = ypos, z = zpos}
    if isPlayer(cid) then
        doSendMagicEffect(spos, 38)
        doSendMagicEffect(getCreaturePosition(cid), 38)
        addEvent(Teleport9, 1 * 1000, cid)
    end
end

local function Teleport7(cid)
    local xpos = getPlayerStorageValue(cid, 111)
    local ypos = getPlayerStorageValue(cid, 222)
    local zpos = getPlayerStorageValue(cid, 333)
    local spos = {x = xpos, y = ypos, z = zpos}
    if isPlayer(cid) then
        doSendMagicEffect(spos, 38)
        doSendMagicEffect(getCreaturePosition(cid), 38)
        addEvent(Teleport8, 1 * 1000, cid)
    end
end

local function Teleport6(cid)
    local xpos = getPlayerStorageValue(cid, 111)
    local ypos = getPlayerStorageValue(cid, 222)
    local zpos = getPlayerStorageValue(cid, 333)
    local spos = {x = xpos, y = ypos, z = zpos}
    if isPlayer(cid) then
        doSendMagicEffect(spos, 38)
        doSendMagicEffect(getCreaturePosition(cid), 38)
        addEvent(Teleport7, 1 * 1000, cid)
    end
end

local function Teleport5(cid)
    local xpos = getPlayerStorageValue(cid, 111)
    local ypos = getPlayerStorageValue(cid, 222)
    local zpos = getPlayerStorageValue(cid, 333)
    local spos = {x = xpos, y = ypos, z = zpos}
    if isPlayer(cid) then
        doSendMagicEffect(spos, 38)
        doSendMagicEffect(getCreaturePosition(cid), 38)
        addEvent(Teleport6, 1 * 1000, cid)
    end
end

local function Teleport4(cid)
    local xpos = getPlayerStorageValue(cid, 111)
    local ypos = getPlayerStorageValue(cid, 222)
    local zpos = getPlayerStorageValue(cid, 333)
    local spos = {x = xpos, y = ypos, z = zpos}
    if isPlayer(cid) then
        doSendMagicEffect(spos, 38)
        doSendMagicEffect(getCreaturePosition(cid), 38)
        addEvent(Teleport5, 1 * 1000, cid)
    end
end

local function Teleport3(cid)
    local xpos = getPlayerStorageValue(cid, 111)
    local ypos = getPlayerStorageValue(cid, 222)
    local zpos = getPlayerStorageValue(cid, 333)
    local spos = {x = xpos, y = ypos, z = zpos}
    if isPlayer(cid) then
        doSendMagicEffect(spos, 38)
        doSendMagicEffect(getCreaturePosition(cid), 38)
        addEvent(Teleport4, 1 * 1000, cid)
    end
end

local function Teleport2(cid)
    local xpos = getPlayerStorageValue(cid, 111)
    local ypos = getPlayerStorageValue(cid, 222)
    local zpos = getPlayerStorageValue(cid, 333)
    local spos = {x = xpos, y = ypos, z = zpos}
    if isPlayer(cid) then
        doSendMagicEffect(spos, 38)
        doSendMagicEffect(getCreaturePosition(cid), 38)
        addEvent(Teleport3, 1 * 1000, cid)
    end
end

local function Teleport1(cid)
    local xpos = getPlayerStorageValue(cid, 111)
    local ypos = getPlayerStorageValue(cid, 222)
    local zpos = getPlayerStorageValue(cid, 333)
    local spos = {x = xpos, y = ypos, z = zpos}
    if isPlayer(cid) then
        doSendMagicEffect(spos, 38)
        doSendMagicEffect(getCreaturePosition(cid), 38)
        addEvent(Teleport2, 1 * 1000, cid)
    end
end

local condition = createConditionObject(CONDITION_EXHAUSTED)
setConditionParam(condition, CONDITION_PARAM_TICKS, 15000)

function onUse(cid, item, frompos, item2, topos)
    -- Exhausted Settings --
    local exhausted_seconds1 = 15 -- Segundos que irá demorar para usar denovo
    local exhausted_storagevalue1 = 8754 -- Storage Value do exhausted
    local exhausted_seconds3 = 15 -- How many seconds mana fluid will be unavailible to use. --
    local exhausted_storagevalue3 = 8162 -- Storage Value to store exhaust. It MUST be unused! --exhausted

    local teleport = getPlayerStorageValue(cid, 384)

    if os.time() < getPlayerStorageValue(cid, exhausted_storagevalue1) then
        doPlayerSendCancel(cid, "Você está muito cansado.")
        return true
    end

    if getPlayerSkullType(cid) == SKULL_RED then
        doPlayerSendCancel(cid, "Você não pode usar esse teleport enquanto estiver PK.")
        return true
    end

    if teleport == -1 or teleport == 0 then
        local savpos = {x = getThingPos(cid).x, y = getThingPos(cid).y, z = getThingPos(cid).z, stackpos = 253}
        setPlayerStorageValue(cid, 111, savpos.x)
        setPlayerStorageValue(cid, 222, savpos.y)
        setPlayerStorageValue(cid, 333, savpos.z)
        setPlayerStorageValue(cid, 384, 1)
        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_BLUE)
        doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, 'Você gravou suas coordenadas em seu teleport mistico.')

        local rand = math.random(0, 100)
    elseif teleport == 1 and os.time() >= getPlayerStorageValue(cid, exhausted_storagevalue1) then
        if rand < 40 then
            addEvent(Teleport1, 1 * 1000, cid)
            setPlayerStorageValue(cid, 384, 0)
            doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, 'Você ativou seu teleport mistico.')
            setPlayerStorageValue(cid, exhausted_storagevalue1, os.time() + exhausted_seconds1)
            setPlayerStorageValue(cid, exhausted_storagevalue3, os.time() + exhausted_seconds3)
            addCombatCondition(0, cid, condition, CONST_ME_NONE)
            doSendMagicEffect(getCreaturePosition(cid), 38)
            doRemoveItem(item.uid, 1)
        else
            addEvent(Teleport1, 1 * 1000, cid)
            setPlayerStorageValue(cid, 384, 0)
            doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, 'Você ativou seu teleport mistico.')
            setPlayerStorageValue(cid, exhausted_storagevalue1, os.time() + exhausted_seconds1)
            setPlayerStorageValue(cid, exhausted_storagevalue3, os.time() + exhausted_seconds3)
            addCombatCondition(0, cid, condition, CONST_ME_NONE)
            doSendMagicEffect(getCreaturePosition(cid), 38)
            doRemoveItem(item.uid, 1)
        end
    end
end

Test and report errors.
Lua Script Error: [Action Interface]
data/actions/scripts/tp.lua:onUse
data/actions/scripts/tp.lua:156: attempt to compare nil with number
stack traceback:
[C]: in function '__lt'
data/actions/scripts/tp.lua:156: in function <data/actions/scripts/tp.lua:126>

it only marks the coordinates, but when I click again it doesn't take me to the marked coordinates and shows this error above
 
Lua Script Error: [Action Interface]
data/actions/scripts/tp.lua:eek:nUse
data/actions/scripts/tp.lua:156: attempt to compare nil with number
stack traceback:
[C]: in function '__lt'
data/actions/scripts/tp.lua:156: in function <data/actions/scripts/tp.lua:126>

it only marks the coordinates, but when I click again it doesn't take me to the marked coordinates and shows this error above

add the local rand below the OnUse function like:


LUA:
local rand = math.random(0, 100)


it should look like this:



LUA:
local function Teleport10(cid)
    if isPlayer(cid) then
        local xpos = getPlayerStorageValue(cid, 111)
        local ypos = getPlayerStorageValue(cid, 222)
        local zpos = getPlayerStorageValue(cid, 333)
        local spos = {x = xpos, y = ypos, z = zpos}
        doTeleportThing(cid, spos)
        doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, 'Você foi teletransportado com sucesso.')
        doSendMagicEffect(getCreaturePosition(cid), 38)
        doSendAnimatedText(getCreaturePosition(cid), "Woup!!", 213)
    end
    return true
end

local function Teleport9(cid)
    local xpos = getPlayerStorageValue(cid, 111)
    local ypos = getPlayerStorageValue(cid, 222)
    local zpos = getPlayerStorageValue(cid, 333)
    local spos = {x = xpos, y = ypos, z = zpos}
    if isPlayer(cid) then
        doSendMagicEffect(spos, 38)
        doSendMagicEffect(getCreaturePosition(cid), 38)
        addEvent(Teleport10, 1 * 1000, cid)
    end
end

local function Teleport8(cid)
    local xpos = getPlayerStorageValue(cid, 111)
    local ypos = getPlayerStorageValue(cid, 222)
    local zpos = getPlayerStorageValue(cid, 333)
    local spos = {x = xpos, y = ypos, z = zpos}
    if isPlayer(cid) then
        doSendMagicEffect(spos, 38)
        doSendMagicEffect(getCreaturePosition(cid), 38)
        addEvent(Teleport9, 1 * 1000, cid)
    end
end

local function Teleport7(cid)
    local xpos = getPlayerStorageValue(cid, 111)
    local ypos = getPlayerStorageValue(cid, 222)
    local zpos = getPlayerStorageValue(cid, 333)
    local spos = {x = xpos, y = ypos, z = zpos}
    if isPlayer(cid) then
        doSendMagicEffect(spos, 38)
        doSendMagicEffect(getCreaturePosition(cid), 38)
        addEvent(Teleport8, 1 * 1000, cid)
    end
end

local function Teleport6(cid)
    local xpos = getPlayerStorageValue(cid, 111)
    local ypos = getPlayerStorageValue(cid, 222)
    local zpos = getPlayerStorageValue(cid, 333)
    local spos = {x = xpos, y = ypos, z = zpos}
    if isPlayer(cid) then
        doSendMagicEffect(spos, 38)
        doSendMagicEffect(getCreaturePosition(cid), 38)
        addEvent(Teleport7, 1 * 1000, cid)
    end
end

local function Teleport5(cid)
    local xpos = getPlayerStorageValue(cid, 111)
    local ypos = getPlayerStorageValue(cid, 222)
    local zpos = getPlayerStorageValue(cid, 333)
    local spos = {x = xpos, y = ypos, z = zpos}
    if isPlayer(cid) then
        doSendMagicEffect(spos, 38)
        doSendMagicEffect(getCreaturePosition(cid), 38)
        addEvent(Teleport6, 1 * 1000, cid)
    end
end

local function Teleport4(cid)
    local xpos = getPlayerStorageValue(cid, 111)
    local ypos = getPlayerStorageValue(cid, 222)
    local zpos = getPlayerStorageValue(cid, 333)
    local spos = {x = xpos, y = ypos, z = zpos}
    if isPlayer(cid) then
        doSendMagicEffect(spos, 38)
        doSendMagicEffect(getCreaturePosition(cid), 38)
        addEvent(Teleport5, 1 * 1000, cid)
    end
end

local function Teleport3(cid)
    local xpos = getPlayerStorageValue(cid, 111)
    local ypos = getPlayerStorageValue(cid, 222)
    local zpos = getPlayerStorageValue(cid, 333)
    local spos = {x = xpos, y = ypos, z = zpos}
    if isPlayer(cid) then
        doSendMagicEffect(spos, 38)
        doSendMagicEffect(getCreaturePosition(cid), 38)
        addEvent(Teleport4, 1 * 1000, cid)
    end
end

local function Teleport2(cid)
    local xpos = getPlayerStorageValue(cid, 111)
    local ypos = getPlayerStorageValue(cid, 222)
    local zpos = getPlayerStorageValue(cid, 333)
    local spos = {x = xpos, y = ypos, z = zpos}
    if isPlayer(cid) then
        doSendMagicEffect(spos, 38)
        doSendMagicEffect(getCreaturePosition(cid), 38)
        addEvent(Teleport3, 1 * 1000, cid)
    end
end

local function Teleport1(cid)
    local xpos = getPlayerStorageValue(cid, 111)
    local ypos = getPlayerStorageValue(cid, 222)
    local zpos = getPlayerStorageValue(cid, 333)
    local spos = {x = xpos, y = ypos, z = zpos}
    if isPlayer(cid) then
        doSendMagicEffect(spos, 38)
        doSendMagicEffect(getCreaturePosition(cid), 38)
        addEvent(Teleport2, 1 * 1000, cid)
    end
end

local condition = createConditionObject(CONDITION_EXHAUSTED)
setConditionParam(condition, CONDITION_PARAM_TICKS, 15000)

function onUse(cid, item, frompos, item2, topos)
--Local Random--
local rand = math.random(0, 100)
    -- Exhausted Settings --
    local exhausted_seconds1 = 15 -- Segundos que irá demorar para usar denovo
    local exhausted_storagevalue1 = 8754 -- Storage Value do exhausted
    local exhausted_seconds3 = 15 -- How many seconds mana fluid will be unavailible to use. --
    local exhausted_storagevalue3 = 8162 -- Storage Value to store exhaust. It MUST be unused! --exhausted

    local teleport = getPlayerStorageValue(cid, 384)

    if os.time() < getPlayerStorageValue(cid, exhausted_storagevalue1) then
        doPlayerSendCancel(cid, "Você está muito cansado.")
        return true
    end

    if getPlayerSkullType(cid) == SKULL_RED then
        doPlayerSendCancel(cid, "Você não pode usar esse teleport enquanto estiver PK.")
        return true
    end

    if teleport == -1 or teleport == 0 then
        local savpos = {x = getThingPos(cid).x, y = getThingPos(cid).y, z = getThingPos(cid).z, stackpos = 253}
        setPlayerStorageValue(cid, 111, savpos.x)
        setPlayerStorageValue(cid, 222, savpos.y)
        setPlayerStorageValue(cid, 333, savpos.z)
        setPlayerStorageValue(cid, 384, 1)
        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_BLUE)
        doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, 'Você gravou suas coordenadas em seu teleport mistico.')

    elseif teleport == 1 and os.time() >= getPlayerStorageValue(cid, exhausted_storagevalue1) then
        if rand < 40 then
            addEvent(Teleport1, 1 * 1000, cid)
            setPlayerStorageValue(cid, 384, 0)
            doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, 'Você ativou seu teleport mistico.')
            setPlayerStorageValue(cid, exhausted_storagevalue1, os.time() + exhausted_seconds1)
            setPlayerStorageValue(cid, exhausted_storagevalue3, os.time() + exhausted_seconds3)
            addCombatCondition(0, cid, condition, CONST_ME_NONE)
            doSendMagicEffect(getCreaturePosition(cid), 38)
            doRemoveItem(item.uid, 1)
        else
            addEvent(Teleport1, 1 * 1000, cid)
            setPlayerStorageValue(cid, 384, 0)
            doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, 'Você ativou seu teleport mistico.')
            setPlayerStorageValue(cid, exhausted_storagevalue1, os.time() + exhausted_seconds1)
            setPlayerStorageValue(cid, exhausted_storagevalue3, os.time() + exhausted_seconds3)
            addCombatCondition(0, cid, condition, CONST_ME_NONE)
            doSendMagicEffect(getCreaturePosition(cid), 38)
            doRemoveItem(item.uid, 1)
        end
    end
end
 
Same script as above, but consolidated the functions..
And removed the rand, because it was doing nothing?

Couple other minor things.

Anyway, easier on the eyes now.

LUA:
-- Exhausted Settings --
local exhausted_seconds1 = 15 -- Segundos que irá demorar para usar denovo
local exhausted_storagevalue1 = 8754 -- Storage Value do exhausted
local exhausted_seconds3 = 15 -- How many seconds mana fluid will be unavailible to use. --
local exhausted_storagevalue3 = 8162 -- Storage Value to store exhaust. It MUST be unused! --exhausted

local condition = createConditionObject(CONDITION_EXHAUSTED)
setConditionParam(condition, CONDITION_PARAM_TICKS, 15000)

local function Teleport1(cid, countdown)
    if not isPlayer(cid) then
        return false
    end
   
    local xpos = getPlayerStorageValue(cid, 111)
    local ypos = getPlayerStorageValue(cid, 222)
    local zpos = getPlayerStorageValue(cid, 333)
    local spos = {x = xpos, y = ypos, z = zpos}
   
    if countdown > 0 then
        doSendMagicEffect(spos, 38)
        doSendMagicEffect(getCreaturePosition(cid), 38)
        addEvent(Teleport1, 1000, cid, countdown - 1)
        return
    end
   
    doTeleportThing(cid, spos)
    doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, 'Você foi teletransportado com sucesso.')
    doSendMagicEffect(getCreaturePosition(cid), 38)
    doSendAnimatedText(getCreaturePosition(cid), "Woup!!", 213)
    return
end

function onUse(cid, item, frompos, item2, topos)

    local currentTime = os.time()
    if currentTime < getPlayerStorageValue(cid, exhausted_storagevalue1) then
        doPlayerSendCancel(cid, "Você está muito cansado.")
        return true
    end

    if getPlayerSkullType(cid) == SKULL_RED then
        doPlayerSendCancel(cid, "Você não pode usar esse teleport enquanto estiver PK.")
        return true
    end
   
    local teleport = getPlayerStorageValue(cid, 384)

    if teleport == -1 or teleport == 0 then
        local savpos = getCreaturePosition(cid)
        setPlayerStorageValue(cid, 111, savpos.x)
        setPlayerStorageValue(cid, 222, savpos.y)
        setPlayerStorageValue(cid, 333, savpos.z)
        setPlayerStorageValue(cid, 384, 1)
        doSendMagicEffect(savpos, CONST_ME_MAGIC_BLUE)
        doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, 'Você gravou suas coordenadas em seu teleport mistico.')

    elseif teleport == 1 and currentTime >= getPlayerStorageValue(cid, exhausted_storagevalue1) then
        addEvent(Teleport1, 1 * 1000, cid, 10)
        setPlayerStorageValue(cid, 384, 0)
        doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, 'Você ativou seu teleport mistico.')
        setPlayerStorageValue(cid, exhausted_storagevalue1, currentTime + exhausted_seconds1)
        setPlayerStorageValue(cid, exhausted_storagevalue3, currentTime + exhausted_seconds3)
        addCombatCondition(0, cid, condition, CONST_ME_NONE)
        doSendMagicEffect(getCreaturePosition(cid), 38)
        doRemoveItem(item.uid, 1)
    end
    return true
end
 
this code that I sent in your post there was compatible with tfs 1.2, so I already changed some codes and sent it there. why not test it? I also use it on my ot tfs 1.5 @Shoorkill
there was an error answering you in the other tab ;\
Post automatically merged:

Same script as above, but consolidated the functions..
And removed the rand, because it was doing nothing?

Couple other minor things.

Anyway, easier on the eyes now.

LUA:
-- Exhausted Settings --
local exhausted_seconds1 = 15 -- Segundos que irá demorar para usar denovo
local exhausted_storagevalue1 = 8754 -- Storage Value do exhausted
local exhausted_seconds3 = 15 -- How many seconds mana fluid will be unavailible to use. --
local exhausted_storagevalue3 = 8162 -- Storage Value to store exhaust. It MUST be unused! --exhausted

local condition = createConditionObject(CONDITION_EXHAUSTED)
setConditionParam(condition, CONDITION_PARAM_TICKS, 15000)

local function Teleport1(cid, countdown)
    if not isPlayer(cid) then
        return false
    end
  
    local xpos = getPlayerStorageValue(cid, 111)
    local ypos = getPlayerStorageValue(cid, 222)
    local zpos = getPlayerStorageValue(cid, 333)
    local spos = {x = xpos, y = ypos, z = zpos}
  
    if countdown > 0 then
        doSendMagicEffect(spos, 38)
        doSendMagicEffect(getCreaturePosition(cid), 38)
        addEvent(Teleport1, 1000, cid, countdown - 1)
        return
    end
  
    doTeleportThing(cid, spos)
    doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, 'Você foi teletransportado com sucesso.')
    doSendMagicEffect(getCreaturePosition(cid), 38)
    doSendAnimatedText(getCreaturePosition(cid), "Woup!!", 213)
    return
end

function onUse(cid, item, frompos, item2, topos)

    local currentTime = os.time()
    if currentTime < getPlayerStorageValue(cid, exhausted_storagevalue1) then
        doPlayerSendCancel(cid, "Você está muito cansado.")
        return true
    end

    if getPlayerSkullType(cid) == SKULL_RED then
        doPlayerSendCancel(cid, "Você não pode usar esse teleport enquanto estiver PK.")
        return true
    end
  
    local teleport = getPlayerStorageValue(cid, 384)

    if teleport == -1 or teleport == 0 then
        local savpos = getCreaturePosition(cid)
        setPlayerStorageValue(cid, 111, savpos.x)
        setPlayerStorageValue(cid, 222, savpos.y)
        setPlayerStorageValue(cid, 333, savpos.z)
        setPlayerStorageValue(cid, 384, 1)
        doSendMagicEffect(savpos, CONST_ME_MAGIC_BLUE)
        doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, 'Você gravou suas coordenadas em seu teleport mistico.')

    elseif teleport == 1 and currentTime >= getPlayerStorageValue(cid, exhausted_storagevalue1) then
        addEvent(Teleport1, 1 * 1000, cid, 10)
        setPlayerStorageValue(cid, 384, 0)
        doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, 'Você ativou seu teleport mistico.')
        setPlayerStorageValue(cid, exhausted_storagevalue1, currentTime + exhausted_seconds1)
        setPlayerStorageValue(cid, exhausted_storagevalue3, currentTime + exhausted_seconds3)
        addCombatCondition(0, cid, condition, CONST_ME_NONE)
        doSendMagicEffect(getCreaturePosition(cid), 38)
        doRemoveItem(item.uid, 1)
    end
    return true
end
Lua Script Error: [Action Interface]
data/actions/scripts/tp.lua:onUse
LuaScriptInterface::luaAddEvent(). Argument #3 is unsafe
stack traceback:
[C]: in function 'addEvent'
data/actions/scripts/tp.lua:59: in function <data/actions/scripts/tp.lua:34>
 
First argument of onUse is actually player object so rename it and modify like follows:

LUA:
onUse(player, item, frompos, item2, topos)
   local cid = player:getId()
 
I tested tfs 1.5 nekiro and it worked well follow the GIF
no error in the console etc.. if you want to add animated text and effect etc, I'll do it anyway
LUA:
function onUse(player, item, frompos, item2, topos)
    local cid = player:getId()
    local exausted = 5
    local storage = 10570 -- Altere o valor de storage para 10570 ou outro número de sua escolha

    if getTilePzInfo(getCreaturePosition(cid)) then
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You cannot teleport into a protected area.")
        doSendMagicEffect(getCreaturePosition(cid), EFFECT_TELEPORT_FRAME)
        return true
    end

    if getCreatureSkullType(cid) == SKULL_RED then
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Red Skull cannot use teleport.")
        doSendMagicEffect(getCreaturePosition(cid), EFFECT_TELEPORT_FRAME)
        return true
    end

    if getCreatureSkullType(cid) == SKULL_WHITE then
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "White Skull cannot use teleport.")
        doSendMagicEffect(getCreaturePosition(cid), EFFECT_TELEPORT_FRAME)
        return true
    end

    if getPlayerLevel(cid) <= 8 then
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Sorry, you don't have a high enough level.")
        doSendMagicEffect(getCreaturePosition(cid), EFFECT_TELEPORT_FRAME)
        return true
    end

    if item.itemid == 6567 then
        local testplayer = isCreature(cid)
        if not testplayer then
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Invalid player.")
            doSendMagicEffect(getCreaturePosition(cid), EFFECT_TELEPORT_FRAME)
            return true
        end

        if getPlayerStorageValue(cid, 105795) >= 1 then
            doSendMagicEffect(getCreaturePosition(cid), EFFECT_TELEPORT_FRAME)
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Sorry, you already have a teleport marked. Use a marked teleport to save new coordinates.")
            return true
        end

        if getPlayerStorageValue(cid, storage) <= os.time() then
            local playerPos = getCreaturePosition(cid)
            local posZ = playerPos.z

            setPlayerStorageValue(cid, 111, playerPos.x)
            setPlayerStorageValue(cid, 222, playerPos.y)
            setPlayerStorageValue(cid, 333, posZ)
            setPlayerStorageValue(cid, 105795, 1)
            doSendMagicEffect(topos, EFFECT_TELEPORT)
            setPlayerStorageValue(cid, storage, os.time() + exausted)
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Your coordinates have been successfully saved.")
            doRemoveItem(item.uid, 1)
            doPlayerAddItem(cid, 6568, 1)
        else
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You can only activate another teleport every 5 seconds!")
            doSendMagicEffect(getCreaturePosition(cid), EFFECT_TELEPORT_FRAME)
        end
    elseif item.itemid == 6568 then
        setPlayerStorageValue(cid, 105795, -1)
        local xpos = getPlayerStorageValue(cid, 111)
        local ypos = getPlayerStorageValue(cid, 222)
        local zpos = getPlayerStorageValue(cid, 333)
        if xpos == 0 then
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Empty position, select a position to teleport.")
            doSendMagicEffect(getCreaturePosition(cid), EFFECT_TELEPORT_FRAME)
            doTransformItem(item.uid, 6567)
        elseif getPlayerStorageValue(cid, storage) <= os.time() then
            doTeleportThing(cid, {x = xpos, y = ypos, z = zpos})
            doRemoveItem(item.uid, 1)
            doSendMagicEffect({x = xpos, y = ypos, z = zpos}, EFFECT_TELEPORT)
            setPlayerStorageValue(cid, storage, os.time() + exausted)
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have been successfully teleported.")
            setPlayerStorageValue(cid, 111, 0)
        else
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You can only activate another teleport every 5 seconds!")
            doSendMagicEffect(getCreaturePosition(cid), EFFECT_TELEPORT_FRAME)
        end
    else
        doPlayerSendCancel(cid, "Error! Incorrect item.")
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Error! Incorrect item. Change your 'actions.xml' file correctly! If you are a player, inform your GM or Administrator.")
        doSendMagicEffect(getCreaturePosition(cid), EFFECT_TELEPORT_FRAME)
    end

    return true
end

<action itemid="6567" script="teste.lua"/>
<action itemid="6568" script="teste.lua"/>
if you want to change the ids, just change it at your will
 
There is backwards compatibility in TFS, it still works with "cid".
Yea I know there's a compat.lua but for addEvent it's unsafe to pas objects and in order not to write things like cid:getId() it'd be better to just do it as it should be and for backward compatibility declare cid as:
LUA:
local cid = player:getId()

The main reason of that change was to make sure cid is actually a numeric value that is safe to use with addEvent and legacy functions would also work fine (thanks to compat.lua).
 
I tested tfs 1.5 nekiro and it worked well follow the GIF
no error in the console etc.. if you want to add animated text and effect etc, I'll do it anyway
LUA:
function onUse(player, item, frompos, item2, topos)
    local cid = player:getId()
    local exausted = 5
    local storage = 10570 -- Altere o valor de storage para 10570 ou outro número de sua escolha

    if getTilePzInfo(getCreaturePosition(cid)) then
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You cannot teleport into a protected area.")
        doSendMagicEffect(getCreaturePosition(cid), EFFECT_TELEPORT_FRAME)
        return true
    end

    if getCreatureSkullType(cid) == SKULL_RED then
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Red Skull cannot use teleport.")
        doSendMagicEffect(getCreaturePosition(cid), EFFECT_TELEPORT_FRAME)
        return true
    end

    if getCreatureSkullType(cid) == SKULL_WHITE then
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "White Skull cannot use teleport.")
        doSendMagicEffect(getCreaturePosition(cid), EFFECT_TELEPORT_FRAME)
        return true
    end

    if getPlayerLevel(cid) <= 8 then
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Sorry, you don't have a high enough level.")
        doSendMagicEffect(getCreaturePosition(cid), EFFECT_TELEPORT_FRAME)
        return true
    end

    if item.itemid == 6567 then
        local testplayer = isCreature(cid)
        if not testplayer then
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Invalid player.")
            doSendMagicEffect(getCreaturePosition(cid), EFFECT_TELEPORT_FRAME)
            return true
        end

        if getPlayerStorageValue(cid, 105795) >= 1 then
            doSendMagicEffect(getCreaturePosition(cid), EFFECT_TELEPORT_FRAME)
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Sorry, you already have a teleport marked. Use a marked teleport to save new coordinates.")
            return true
        end

        if getPlayerStorageValue(cid, storage) <= os.time() then
            local playerPos = getCreaturePosition(cid)
            local posZ = playerPos.z

            setPlayerStorageValue(cid, 111, playerPos.x)
            setPlayerStorageValue(cid, 222, playerPos.y)
            setPlayerStorageValue(cid, 333, posZ)
            setPlayerStorageValue(cid, 105795, 1)
            doSendMagicEffect(topos, EFFECT_TELEPORT)
            setPlayerStorageValue(cid, storage, os.time() + exausted)
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Your coordinates have been successfully saved.")
            doRemoveItem(item.uid, 1)
            doPlayerAddItem(cid, 6568, 1)
        else
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You can only activate another teleport every 5 seconds!")
            doSendMagicEffect(getCreaturePosition(cid), EFFECT_TELEPORT_FRAME)
        end
    elseif item.itemid == 6568 then
        setPlayerStorageValue(cid, 105795, -1)
        local xpos = getPlayerStorageValue(cid, 111)
        local ypos = getPlayerStorageValue(cid, 222)
        local zpos = getPlayerStorageValue(cid, 333)
        if xpos == 0 then
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Empty position, select a position to teleport.")
            doSendMagicEffect(getCreaturePosition(cid), EFFECT_TELEPORT_FRAME)
            doTransformItem(item.uid, 6567)
        elseif getPlayerStorageValue(cid, storage) <= os.time() then
            doTeleportThing(cid, {x = xpos, y = ypos, z = zpos})
            doRemoveItem(item.uid, 1)
            doSendMagicEffect({x = xpos, y = ypos, z = zpos}, EFFECT_TELEPORT)
            setPlayerStorageValue(cid, storage, os.time() + exausted)
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have been successfully teleported.")
            setPlayerStorageValue(cid, 111, 0)
        else
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You can only activate another teleport every 5 seconds!")
            doSendMagicEffect(getCreaturePosition(cid), EFFECT_TELEPORT_FRAME)
        end
    else
        doPlayerSendCancel(cid, "Error! Incorrect item.")
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Error! Incorrect item. Change your 'actions.xml' file correctly! If you are a player, inform your GM or Administrator.")
        doSendMagicEffect(getCreaturePosition(cid), EFFECT_TELEPORT_FRAME)
    end

    return true
end


if you want to change the ids, just change it at your will
@Shoorkill did this script work for you?
 
Back
Top