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

Lua Action: Advanced Teleport Scroll

Zarabustor

Human Being
Joined
Sep 10, 2009
Messages
186
Reaction score
0
Location
Cancun, Mexico
Hi li want a script of a teleport that when worn on the floor creates a teleport that takes you to the temple and disappears in 10 seconds (I want you in the position of where telport izo, say 10,9,8,7,6, 5,4,3,2,1 and then it dissapear animated seqan number) and you can only use every 60 finished second, and you can not use with PZ locked. Thanks for helping me hope.
 
Here it is (tested in TFS 0.3.5/6):
Lua:
-- Advanced Teleport Script // by Xampy --

function onUse(cid, item, frompos, item2, topos)
	local templeid = getPlayerTown(cid)
	local temple = getTownTemplePosition(templeid)
	local position = getPlayerPosition(cid)
	local positionn = position
	local exhausttime = 60 -- in seconds

local function removeTP()
	local posTP = getTileItemById(positionn, 1387).uid
	if posTP ~= nil then
		doRemoveItem(posTP)
	end
end

local function nineSeconds()
	local posTP = getTileItemById(positionn, 1387).uid
	if posTP ~= nil then
		doSendAnimatedText(positionn, '9', TEXTCOLOR_RED)
	end
end

local function eightSeconds()
	local posTP = getTileItemById(positionn, 1387).uid
	if posTP ~= nil then
		doSendAnimatedText(positionn, '8', TEXTCOLOR_RED)
	end
end

local function sevenSeconds()
	local posTP = getTileItemById(positionn, 1387).uid
	if posTP ~= nil then
		doSendAnimatedText(positionn, '7', TEXTCOLOR_RED)
	end
end

local function sixSeconds()
	local posTP = getTileItemById(positionn, 1387).uid
	if posTP ~= nil then
		doSendAnimatedText(positionn, '6', TEXTCOLOR_RED)
	end
end

local function fiveSeconds()
	local posTP = getTileItemById(positionn, 1387).uid
	if posTP ~= nil then
		doSendAnimatedText(positionn, '5', TEXTCOLOR_RED)
	end
end

local function fourSeconds()
	local posTP = getTileItemById(positionn, 1387).uid
	if posTP ~= nil then
		doSendAnimatedText(positionn, '4', TEXTCOLOR_RED)
	end
end

local function threeSeconds()
	local posTP = getTileItemById(positionn, 1387).uid
	if posTP ~= nil then
		doSendAnimatedText(positionn, '3', TEXTCOLOR_RED)
	end
end

local function twoSeconds()
	local posTP = getTileItemById(positionn, 1387).uid
	if posTP ~= nil then
		doSendAnimatedText(positionn, '2', TEXTCOLOR_RED)
	end
end

local function oneSecond()
	local posTP = getTileItemById(positionn, 1387).uid
	if posTP ~= nil then
		doSendAnimatedText(positionn, '1', TEXTCOLOR_RED)
	end
end


	if getPlayerStorageValue(cid, 558555) > os.time() then
		if (getPlayerStorageValue(cid, 558555) - os.time()) == 1 then
			letter = ""
		else
			letter = "s"
		end
		doPlayerSendCancel(cid, 'You must wait ' .. getPlayerStorageValue(cid, 558555) - os.time() .. ' second' .. letter .. '.')
		doSendMagicEffect(position, 2)
		return TRUE
	elseif getCreatureCondition(cid, CONDITION_EXHAUST) == FALSE and getCreatureCondition(cid, CONDITION_INFIGHT) == FALSE then
			doCreateTeleport(1387, temple, position)
			setPlayerStorageValue(cid, 558555, os.time() + exhausttime)
			doRemoveItem(item.uid, 1)
			doSendAnimatedText(position, '10', TEXTCOLOR_RED)
			addEvent(nineSeconds, 1000)
			addEvent(eightSeconds, 2000)
			addEvent(sevenSeconds, 3000)
			addEvent(sixSeconds, 4000)
			addEvent(fiveSeconds, 5000)
			addEvent(fourSeconds, 6000)
			addEvent(threeSeconds, 7000)
			addEvent(twoSeconds, 8000)
			addEvent(oneSecond, 9000)
			addEvent(removeTP, 10000)
	else
		doPlayerSendCancel(cid, 'You are in a fight!')
	end

	return TRUE
end
 
Last edited:
Lua:
  -- Advanced Teleport Script // by Xampy --

function onUse(cid, item, frompos, item2, topos)
        local templeid = getPlayerTown(cid)
        local temple = getTownTemplePosition(templeid)
        local position = getPlayerPosition(cid)
        local positionn = position
        local exhausttime = 60 -- in seconds

local function removeTP()
        local posTP = getTileItemById(positionn, 1387).uid
        if posTP ~= nil then
                doRemoveItem(posTP)
        end
end

local function nineSeconds()
        local posTP = getTileItemById(positionn, 1387).uid
        if posTP ~= nil then
                doSendAnimatedText(positionn, '9', TEXTCOLOR_RED)
        end
end

local function eightSeconds()
        local posTP = getTileItemById(positionn, 1387).uid
        if posTP ~= nil then
                doSendAnimatedText(positionn, '8', TEXTCOLOR_RED)
        end
end

local function sevenSeconds()
        local posTP = getTileItemById(positionn, 1387).uid
        if posTP ~= nil then
                doSendAnimatedText(positionn, '7', TEXTCOLOR_RED)
        end
end

local function sixSeconds()
        local posTP = getTileItemById(positionn, 1387).uid
        if posTP ~= nil then
                doSendAnimatedText(positionn, '6', TEXTCOLOR_RED)
        end
end

local function fiveSeconds()
        local posTP = getTileItemById(positionn, 1387).uid
        if posTP ~= nil then
                doSendAnimatedText(positionn, '5', TEXTCOLOR_RED)
        end
end

local function fourSeconds()
        local posTP = getTileItemById(positionn, 1387).uid
        if posTP ~= nil then
                doSendAnimatedText(positionn, '4', TEXTCOLOR_RED)
        end
end

local function threeSeconds()
        local posTP = getTileItemById(positionn, 1387).uid
        if posTP ~= nil then
                doSendAnimatedText(positionn, '3', TEXTCOLOR_RED)
        end
end

local function twoSeconds()
        local posTP = getTileItemById(positionn, 1387).uid
        if posTP ~= nil then
                doSendAnimatedText(positionn, '2', TEXTCOLOR_RED)
        end
end

local function oneSecond()
        local posTP = getTileItemById(positionn, 1387).uid
        if posTP ~= nil then
                doSendAnimatedText(positionn, '1', TEXTCOLOR_RED)
        end
end


        if getPlayerStorageValue(cid, 558555) > os.time() then
                if (getPlayerStorageValue(cid, 558555) - os.time()) == 1 then
                        letter = ""
                else
                        letter = "s"
                end
                doPlayerSendCancel(cid, 'You must wait ' .. getPlayerStorageValue(cid, 558555) - os.time() .. ' second' .. letter .. '.')
                doSendMagicEffect(position, 2)
                return TRUE
        elseif getCreatureCondition(cid, CONDITION_EXHAUST) == FALSE and getCreatureCondition(cid, CONDITION_INFIGHT) == FALSE then
			if getTilePzInfo(getCreaturePosition(cid)) == FALSE then
                        doCreateTeleport(1387, temple, position)
                        setPlayerStorageValue(cid, 558555, os.time() + exhausttime)
                        doRemoveItem(item.uid, 1)
                        doSendAnimatedText(position, '10', TEXTCOLOR_RED)
                        addEvent(nineSeconds, 1000)
                        addEvent(eightSeconds, 2000)
                        addEvent(sevenSeconds, 3000)
                        addEvent(sixSeconds, 4000)
                        addEvent(fiveSeconds, 5000)
                        addEvent(fourSeconds, 6000)
                        addEvent(threeSeconds, 7000)
                        addEvent(twoSeconds, 8000)
                        addEvent(oneSecond, 9000)
                        addEvent(removeTP, 10000)
			else
				doPlayerSendCancel(cid, "You can't use this in a protection zone.")
			end
        else
                doPlayerSendCancel(cid, 'You are in a fight!')
        end

        return TRUE
end
 
Lua:
  -- Advanced Teleport Script // by Xampy --

function onUse(cid, item, frompos, item2, topos)
        local templeid = getPlayerTown(cid)
        local temple = getTownTemplePosition(templeid)
        local position = getPlayerPosition(cid)
        local positionn = position
        local exhausttime = 60 -- in seconds

local function removeTP()
        local posTP = getTileItemById(positionn, 1387).uid
        if posTP ~= nil then
                doRemoveItem(posTP)
        end
end

local function nineSeconds()
        local posTP = getTileItemById(positionn, 1387).uid
        if posTP ~= nil then
                doSendAnimatedText(positionn, '9', TEXTCOLOR_RED)
        end
end

local function eightSeconds()
        local posTP = getTileItemById(positionn, 1387).uid
        if posTP ~= nil then
                doSendAnimatedText(positionn, '8', TEXTCOLOR_RED)
        end
end

local function sevenSeconds()
        local posTP = getTileItemById(positionn, 1387).uid
        if posTP ~= nil then
                doSendAnimatedText(positionn, '7', TEXTCOLOR_RED)
        end
end

local function sixSeconds()
        local posTP = getTileItemById(positionn, 1387).uid
        if posTP ~= nil then
                doSendAnimatedText(positionn, '6', TEXTCOLOR_RED)
        end
end

local function fiveSeconds()
        local posTP = getTileItemById(positionn, 1387).uid
        if posTP ~= nil then
                doSendAnimatedText(positionn, '5', TEXTCOLOR_RED)
        end
end

local function fourSeconds()
        local posTP = getTileItemById(positionn, 1387).uid
        if posTP ~= nil then
                doSendAnimatedText(positionn, '4', TEXTCOLOR_RED)
        end
end

local function threeSeconds()
        local posTP = getTileItemById(positionn, 1387).uid
        if posTP ~= nil then
                doSendAnimatedText(positionn, '3', TEXTCOLOR_RED)
        end
end

local function twoSeconds()
        local posTP = getTileItemById(positionn, 1387).uid
        if posTP ~= nil then
                doSendAnimatedText(positionn, '2', TEXTCOLOR_RED)
        end
end

local function oneSecond()
        local posTP = getTileItemById(positionn, 1387).uid
        if posTP ~= nil then
                doSendAnimatedText(positionn, '1', TEXTCOLOR_RED)
        end
end


        if getPlayerStorageValue(cid, 558555) > os.time() then
                if (getPlayerStorageValue(cid, 558555) - os.time()) == 1 then
                        letter = ""
                else
                        letter = "s"
                end
                doPlayerSendCancel(cid, 'You must wait ' .. getPlayerStorageValue(cid, 558555) - os.time() .. ' second' .. letter .. '.')
                doSendMagicEffect(position, 2)
                return TRUE
        elseif getCreatureCondition(cid, CONDITION_EXHAUST) == FALSE and getCreatureCondition(cid, CONDITION_INFIGHT) == FALSE then
                    if getTilePzInfo(getCreaturePosition(cid)) == FALSE then
                        doCreateTeleport(1387, temple, getClosestFreeTile(getCreaturePosition(cid), false, false))
                        setPlayerStorageValue(cid, 558555, os.time() + exhausttime)
                        doRemoveItem(item.uid, 1)
                        doSendAnimatedText(position, '10', TEXTCOLOR_RED)
                        addEvent(nineSeconds, 1000)
                        addEvent(eightSeconds, 2000)
                        addEvent(sevenSeconds, 3000)
                        addEvent(sixSeconds, 4000)
                        addEvent(fiveSeconds, 5000)
                        addEvent(fourSeconds, 6000)
                        addEvent(threeSeconds, 7000)
                        addEvent(twoSeconds, 8000)
                        addEvent(oneSecond, 9000)
                        addEvent(removeTP, 10000)
                        else
                                doPlayerSendCancel(cid, "You can't use this in a protection zone.")
                        end
        else
                doPlayerSendCancel(cid, 'You are in a fight!')
        end

        return TRUE
end
 
Code:
function onUse(cid, item, frompos, item2, topos)
local config =
{
tpPos = {x = , y =, z =},
topos = getTownTemplePosition(getPlayerTown(cid)),
exhaustion = 60
}
	if (getPlayerStorageValue(cid, 558555) > os.time()) then
		doPlayerTextMessage(cid, 22, 'Be patient')
		doSendMagicEffect(frompos, 2)
		return true
	end
	if (getCreatureCondition(cid, CONDITION_EXHAUST) == true) then
		doPlayerTextMessage(cid, 22, 'You are exhausted.')
		doSendMagicEffect(frompos, 2)
		return true
	end
	if (getCreatureCondition(cid, CONDITION_INFIGHT) == true) then
		doPlayerTextMessage(cid, 22, 'You are in fight')
		doSendMagicEffect(frompos, 2)
		return true
	end
	doCreateTeleport(1387, config.topos, config.tpPos)
	setPlayerStorageValue(cid, 558555, os.time() + config.exhaustion)
	doRemoveItem(item.uid, 1)
	doSendAnimatedText(config.tpPos, '10', TEXTCOLOR_RED)
	for i = 1, 9 do
		addEvent(sendText, (i * 1000), {pos=config.topos, text=i})
	end
	addEvent(removeTp, 10000, config.topos)
	return true
end

function sendText(pos, text)
	text = tostring(text)
	local posTP = getTileItemById(pos, 1387).uid
	if posTP ~= nil then
        doSendAnimatedText(positionn, text, TEXTCOLOR_RED)
    end
end
function removeTP(pos)
    local posTP = getTileItemById(pos, 1387).uid
    if posTP ~= nil then
        doRemoveItem(posTP)
    end
end
Not tested
 
Lua:
  -- Advanced Teleport Script // by Xampy --

function onUse(cid, item, frompos, item2, topos)
        local temple = {x=1000, y=1000, z=7} -- Change this to where you want them to be teleported
        local position = getPlayerPosition(cid)
        local positionn = position
        local exhausttime = 60 -- in seconds

local function removeTP()
        local posTP = getTileItemById(positionn, 1387).uid
        if posTP ~= nil then
                doRemoveItem(posTP)
        end
end

local function nineSeconds()
        local posTP = getTileItemById(positionn, 1387).uid
        if posTP ~= nil then
                doSendAnimatedText(positionn, '9', TEXTCOLOR_RED)
        end
end

local function eightSeconds()
        local posTP = getTileItemById(positionn, 1387).uid
        if posTP ~= nil then
                doSendAnimatedText(positionn, '8', TEXTCOLOR_RED)
        end
end

local function sevenSeconds()
        local posTP = getTileItemById(positionn, 1387).uid
        if posTP ~= nil then
                doSendAnimatedText(positionn, '7', TEXTCOLOR_RED)
        end
end

local function sixSeconds()
        local posTP = getTileItemById(positionn, 1387).uid
        if posTP ~= nil then
                doSendAnimatedText(positionn, '6', TEXTCOLOR_RED)
        end
end

local function fiveSeconds()
        local posTP = getTileItemById(positionn, 1387).uid
        if posTP ~= nil then
                doSendAnimatedText(positionn, '5', TEXTCOLOR_RED)
        end
end

local function fourSeconds()
        local posTP = getTileItemById(positionn, 1387).uid
        if posTP ~= nil then
                doSendAnimatedText(positionn, '4', TEXTCOLOR_RED)
        end
end

local function threeSeconds()
        local posTP = getTileItemById(positionn, 1387).uid
        if posTP ~= nil then
                doSendAnimatedText(positionn, '3', TEXTCOLOR_RED)
        end
end

local function twoSeconds()
        local posTP = getTileItemById(positionn, 1387).uid
        if posTP ~= nil then
                doSendAnimatedText(positionn, '2', TEXTCOLOR_RED)
        end
end

local function oneSecond()
        local posTP = getTileItemById(positionn, 1387).uid
        if posTP ~= nil then
                doSendAnimatedText(positionn, '1', TEXTCOLOR_RED)
        end
end


        if getPlayerStorageValue(cid, 558555) > os.time() then
                if (getPlayerStorageValue(cid, 558555) - os.time()) == 1 then
                        letter = ""
                else
                        letter = "s"
                end
                doPlayerSendCancel(cid, 'You must wait ' .. getPlayerStorageValue(cid, 558555) - os.time() .. ' second' .. letter .. '.')
                doSendMagicEffect(position, 2)
                return TRUE
        elseif getCreatureCondition(cid, CONDITION_EXHAUST) == FALSE and getCreatureCondition(cid, CONDITION_INFIGHT) == FALSE then
                    if getTilePzInfo(getCreaturePosition(cid)) == FALSE then
                        doCreateTeleport(1387, temple, getClosestFreeTile(getCreaturePosition(cid), false, false))
                        setPlayerStorageValue(cid, 558555, os.time() + exhausttime)
                        doRemoveItem(item.uid, 1)
                        doSendAnimatedText(position, '10', TEXTCOLOR_RED)
                        addEvent(nineSeconds, 1000)
                        addEvent(eightSeconds, 2000)
                        addEvent(sevenSeconds, 3000)
                        addEvent(sixSeconds, 4000)
                        addEvent(fiveSeconds, 5000)
                        addEvent(fourSeconds, 6000)
                        addEvent(threeSeconds, 7000)
                        addEvent(twoSeconds, 8000)
                        addEvent(oneSecond, 9000)
                        addEvent(removeTP, 10000)
                        else
                                doPlayerSendCancel(cid, "You can't use this in a protection zone.")
                        end
        else
                doPlayerSendCancel(cid, 'You are in a fight!')
        end

        return TRUE
end
 
Code:
-- Advanced Teleport Script // by Xampy --
local temple = {x=1000, y=1000, z=7} -- Change this to where you want them to be teleported
local exhausttime = 60 -- in seconds
	
local function removeTP(pos)
	local thing = getTileItemById(pos, 1387).uid
	return thing > 0 and doRemoveItem(thing)
end
local function textEffect(n, pos)
	doSendAnimatedText(pos, n, TEXTCOLOR_RED)
end

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if getPlayerStorageValue(cid, 558555) > os.time() then
		doPlayerSendCancel(cid, 'You must wait ' .. getPlayerStorageValue(cid, 558555) - os.time() .. ' second' .. ((getPlayerStorageValue(cid, 558555) - os.time()) == 1 and "" or "s") .. '.')
		doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
		return TRUE
	elseif getCreatureCondition(cid, CONDITION_EXHAUST) == FALSE and getCreatureCondition(cid, CONDITION_INFIGHT) == FALSE then
		if getTilePzInfo(getCreaturePosition(cid)) == FALSE then
			local teleport = doCreateTeleport(1387, temple, getClosestFreeTile(getCreaturePosition(cid), false, false))
			setPlayerStorageValue(cid, 558555, os.time() + exhausttime)
			doRemoveItem(item.uid, 1)
			local position = getThingPos(cid)
			doSendAnimatedText(position, '10', TEXTCOLOR_RED)
			for i = 9, 1, -1 do
				addEvent(textEffect, 10000 - i * 1000, i, position)
			end
			addEvent(removeTP, 10000, getThingPos(teleport))
		else
			doPlayerSendCancel(cid, "You can't use this in a protection zone.")
		end
	else
		doPlayerSendCancel(cid, 'You are in a fight!')
	end
	return TRUE
end
 
Back
Top