SK
dúvida

Spell nao volta

Por SkyDarkyes, 25 de ago. de 2013 em Scripts

8
1.2k
25 de agosto de 2013 às 23:04

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
AvronexA
25 de agosto de 2013 às 23:24

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

25 de agosto de 2013 às 23:29

Deu certo,teria como colocar,um efeito no player que usar e um efeito no player que foi atingido?

Session StartS
25 de agosto de 2013 às 23:32

 

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)
doSendMagicEffect(posCid, 75)
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
25 de agosto de 2013 às 23:34

Aparece efeito apenas no que usou no alvo nao

Editado Agosto 25 por SkyDarkyes

Session StartS
25 de agosto de 2013 às 23:37

agora vai dar

 

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)
doSendMagicEffect(posCid, 75)
doSendMagicEffect(posTarget, 75)
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
25 de agosto de 2013 às 23:40

Deu certo vlw

Limite Rep,dps dou

Editado Agosto 25 por SkyDarkyes

RoksasR
26 de agosto de 2013 às 13:00

Tópico movido para a seção de dúvidas e pedidos resolvidos.