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

Temple Teleport Flame

tosson

New Member
Joined
Jul 3, 2009
Messages
41
Reaction score
2
Location
<3 Egypt <3
I need a script for an item (any ID) thats opens a TP for 10 seconds and teleports to temple with position 1000, 1000, 7. Also, I want it only possible to do it once every minute (In other words, exhaust= 60 seconds). And it would be cool if you could make the time left in seconds appear over the TP (10,9,8..) and says "Closed" when it disappears. :)
 
ACTIONS/SCRIPT

scriptname.lua
Code:
function onUse(cid, item, frompos, item2, topos)

local tpId = 1387
local p = getCreaturePosition(cid)
local tps = {
pos = {x=p.x, y=p.y-1, z=p.z},
toPos = {x=1000, y=1000, z=7},
time = 10, -- remove teleport in seconds
exausted = 60, -- in seconds
storage1 = 18370, -- dont edit
storage2 = 97854 -- dont edit
}
function removeTp()
	local t = getTileItemById(tps.pos, tpId)
	if t then
		doRemoveItem(t.uid, 1)
		doSendMagicEffect(tps.pos, CONST_ME_POFF)
	end
end
function doTPSecond(cid,delay)
local seconds = math.floor((getPlayerStorageValue(cid, tps.storage1) - os.time())) 
local msg = ''.. (seconds < 0 and 0 or seconds) ..''   
doSendAnimatedText(tps.pos, msg, math.random(1,140)) 
if delay ~= 1 then
addEvent(doTPSecond, 1000,cid, delay -1)
end
end
if (getPlayerStorageValue(cid, tps.storage2) <= os.time()) then
doCreateTeleport(tpId, tps.toPos, tps.pos)
setPlayerStorageValue(cid, tps.storage1, os.time()+tps.time)
doTPSecond(cid, tps.time)
addEvent(removeTp, tps.time*1000)
setPlayerStorageValue(cid,tps.storage2,os.time()+tps.exausted)
else
doPlayerSendCancel(cid, "wait " .. getPlayerStorageValue(cid, tps.storage2) - os.time() .. " seconds to use this item again.")
end
end

actions.xml
Code:
<action itemid="ITEMID" script="scriptname.lua" />
 
Can you make it unusable in Protection Zones?
And BTW, the TP always opens over the player. ex: If I want to open the TP under me, it opens above me :(
Can you make it open in the place the player clicks on?

If you can do these 2 things please post the script again :) Ty
 
Code:
function onUse(cid, item, frompos, item2, topos)

local tpId = 1387
local p = getThingPos(item2.uid)
local tps = {
pos = {x=p.x, y=p.y, z=p.z},
toPos = {x=136, y=39, z=7},
time = 10, -- remove teleport
exausted = 60, -- in seconds
storage1 = 18370, -- dont edit
storage2 = 97854 -- dont edit
}
function removeTp()
	local t = getTileItemById(tps.pos, tpId)
	if t then
		doRemoveItem(t.uid, 1)
		doSendMagicEffect(tps.pos, CONST_ME_POFF)
	end
end
function doTPSecond(cid,delay)
local seconds = math.floor((getPlayerStorageValue(cid, tps.storage1) - os.time())) 
local msg = ''.. (seconds < 0 and 0 or seconds) ..''   
doSendAnimatedText(tps.pos, msg, math.random(1,140)) 
if delay ~= 1 then
addEvent(doTPSecond, 1000,cid, delay -1)
end
end
if (getPlayerStorageValue(cid, tps.storage2) <= os.time()) then
if (getTilePzInfo(tps.pos) == TRUE) then
doCreateTeleport(tpId, tps.toPos, tps.pos)
setPlayerStorageValue(cid, tps.storage1, os.time()+tps.time)
doTPSecond(cid, tps.time)
addEvent(removeTp, tps.time*1000)
setPlayerStorageValue(cid,tps.storage2,os.time()+tps.exausted)
else
doPlayerSendTextMessage(cid,22,"Sorry,create tp only in PZ!.")
end
else
doPlayerSendCancel(cid, "wait " .. getPlayerStorageValue(cid, tps.storage2) - os.time() .. " seconds to use this item again.")
end
return TRUE
end

ps:the item has to be usable
 
Back
Top