local newpos = {x=94, y=122, z=7} --New position
local buffer = 10 -- in seconds(time to wait to get tped)
local cooldown = 60 -- inseconds
local storage = 9075
--[[end of config]]--
function countDown(number, pos, effect, msgonend, effectonend)
local n = number
for i = 1, number do
addEvent(doSendAnimatedText,i* 1000, pos, n > 1 and n.."" or msgonend .."", n < 6 and TEXTCOLOR_RED or TEXTCOLOR_GREEN)
addEvent(doSendMagicEffect,i* 1000, pos, n > 1 and effect or effectonend )
n = n -1
end
n = number
return true
end
function onUse(cid, item, fromPosition, itemEx, toPosition)
if(getCreatureCondition(cid, CONDITION_INFIGHT) == true) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "You may not use this while in fight.")
return true
end
if not exhaustion.get(cid, storage) then
doCreatureSetNoMove(cid, 1)
exhaustion.set(cid, storage, cooldown)
countDown(buffer, getThingPos(cid), 5, "teleported!", 2)
addEvent(doTeleportThing,buffer * 1000,cid,newpos)
addEvent(doSendMagicEffect, buffer * 1000 +2 ,newpos, 10)
addEvent(doCreatureSetNoMove,buffer * 1000,cid, 0)
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Cooldown : "..exhaustion.get(cid, storage).." seconds.")
end
return true
end