Tente assim:
local newPos1 = {x = 0, y = 0, z = 0} --pos pra onde sera levado o caster da spell
local newPos2 = {x = 242, y = 1056, z = 4} --pos pra onde sera levado o target
local time = 60 --tempo pra teleporta devolta, em segs
local function teleport(cid, pid, pos, pos2)
if isCreature(pid) then
doTeleportThing(pid, getClosestFreeTile(pid, pos2 or pos))
doSendMagicEffect(getPlayerPosition(pid), 75)
end
end
function onCastSpell(cid, var)
local target = getCreatureTarget(cid)
if not isCreature(target) or not isPlayer(target) then
return doPlayerSendTextMessage(cid, 27, "Voce So Pode Usar Essa Spell Em Players e Fora de Exames,Arenas,Quests")
end
if getPlayerStorageValue(cid, 33333) < os.time () then
local target = getCreatureTarget(cid)
local posCid = getPlayerPosition(cid)
local posTarget = getPlayerPosition(target)
setPlayerStorageValue(cid, 33333, os.time () + 200)
teleport(cid, target, newPos1, newPos2)
addEvent(teleport, time*1000, cid, target, posCid, posTarget)
else
doPlayerSendCancel(cid, " VOCE SÓ PODE USAR DAKI A "..getPlayerStorageValue(cid, 33333) - os.time ().." SEGUNDOS ")
end
return true
end
Se ajudei Rep++!







info
Grupo: Infante
Registrado: 27/01/13
Posts: 1.7k
Reputação: +104
Gênero: Masculino
Bom tenho essa magia,essa teleporta o player para x lugar porem o player nao volta
Quero que o player volta,para onde ele foi atakado,
local newPos1 = {x = 0, y = 0, z = 0} --pos pra onde sera levado o caster da spell local newPos2 = {x = 242, y = 1056, z = 4} --pos pra onde sera levado o target local time = 60 --tempo pra teleporta devolta, em segs local function teleport(cid, pid, pos, pos2) if isCreature(pid) then doTeleportThing(pid, getClosestFreeTile(pid, pos2 or pos)) doSendMagicEffect(getPlayerPosition(pid), 75) end end function onCastSpell(cid, var) local target = getCreatureTarget(cid) if not isCreature(target) or not isPlayer(target) then return doPlayerSendTextMessage(cid, 27, "Voce So Pode Usar Essa Spell Em Players e Fora de Exames,Arenas,Quests") end if getPlayerStorageValue(cid, 33333) < os.time () then local target = getCreatureTarget(cid) local posCid = getPlayerPosition(cid) local posTarget = getPlayerPosition(target) setPlayerStorageValue(cid, 33333, os.time () + 200) teleport(cid, target, newPos1, newPos2) addEvent(teleport, time*60000, cid, target, posCid, posTarget) else doPlayerSendCancel(cid, " VOCE SÓ PODE USAR DAKI A "..getPlayerStorageValue(cid, 33333) - os.time ().." SEGUNDOS ") end return true end