a de se teleportar eu ja fiz.. a outra eu não vou fazer porque ela requer um nível de detalhes que eu não to afim de ficar discutindo com você até você me explicar.
local config = {
pos = {x=42, y=234, z=7}, -- posição da aegis dimension
tempo = 15, -- tempo pra voltar
effect1 = 66, -- efeito ao ser teleportado
effect2 = 10, -- efeito ao voltar
storage = 19329
}
local cooldown = 60
function onCastSpell(cid, var)
if isPlayer(cid) then
if os.time() - getPlayerStorageValue(cid, config.storage) >= cooldown then
doPlayerSetStorageValue(cid, config.storage, os.time())
addEvent(doTeleportThing, 1000*config.tempo, cid, getThingPos(cid), true)
addEvent(doSendMagicEffect, 1000*config.tempo, getThingPos(cid), config.effect2)
doSendMagicEffect(getThingPos(cid), config.effect1)
doTeleportThing(cid, config.pos)
if isCreature(cid) then
doPlayerSendTextMessage(cid, 27, "You were teleported by yourself.")
end
for i = 1,config.tempo do
addEvent(function()
if isCreature(cid) then
doPlayerSendTextMessage(cid,25,"You'll be back in " .. config.tempo -i +1 .. " second(s)")
end
end, 1000*i)
end
else
doPlayerSendCancel(cid, "Your skill is in cooldown, you must wait "..(cooldown - (os.time() - getPlayerStorageValue(cid, config.storage))).." seconds.")
end
end
return true
end