local kamui = {
posTeleport = { x = 1111, y = 1231, z = 7}, -- Posição onde será teleportado
tempo = 10, -- tempo para voltar
exaust = 34455 -- Exaust para usar novalmente, adicionado esta linha.
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
if ( isPlayer( getCreatureTarget(cid) ) and getPlayerStorageValue(cid, kamui.exaust) < os.time() ) then -- Modificado esta linha
target = getCreatureTarget(cid)
addEvent(doTeleportThing, 1000*kamui.tempo, target, getThingPos(target), true)
addEvent(doSendMagicEffect, 1000*kamui.tempo, getThingPos(target), 10)
doSendMagicEffect(getThingPos(target), 50)
doTeleportThing(target, kamui.posTeleport)
setPlayerStorageValue(cid, kamui.exaust, 2 + os.time()) -- Adicionado esta linha
if isCreature(cid) then
doPlayerSendTextMessage(target, 27, "Você foi teleportado pelo kamui do jogador: ".. getCreatureName(cid) ..".")
end
if isPlayer(cid) and isCreature(target) then
doPlayerSendTextMessage(cid, 27, "Você teletransportou: ".. getCreatureName(target) .."!")
end
for i = 1,config.tempo do
addEvent(
function()
if isCreature(target) then
doPlayerSendTextMessage(target,25,"Voce estara de volta" .. kamui.tempo -i +1 .. " segundos(s)")
end
end, 1000*i
)
end
else
doPlayerSendCancel(cid, "Voce so pode usar esse feitico nos jogadores")
end
return true
end
Comentei a linha que adicionei, acho melhor vc remover o item do player ficando "100 - Kamui, usou remove: 99 - Kamui" e assim vai indo, igual potion quando vai usando ele vai acabando.
Então mano como você queria spells, foi o seguinte:
if isPlayer( getCreatureTarget(cid) ) then
Isso vai funcionar se aquela target vermelha estiver em volta do player:
ai sim ele vai usar no player com o use with e vai teleportar.
Quem Está Navegando
0 membros estão online
Nenhum usuário registrado visualizando esta página.