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

[REQUEST] Training monks teleport script

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" />

Ps: change the pos to ur training room pos.

Script nto made by me. credits to the author "Idk him lol"
 
Back
Top