Ir para conteúdo
  • Cadastre-se

(Resolvido)[AJUDA] Cooldown em Spell


Ir para solução Resolvido por Wend II,

Posts Recomendados

Ola galera do TK, gostaria de pedir agora para que alguem pfv coloque Colldown nessa spell. Vlw

 

local remove_time = 4 -- tempo em segundos para remover as magic wall


local item_id = 5750 -- id da magic wall

function onCastSpell(cid, var)

local pos = getThingPosition(getCreatureTarget(cid))
posTile1 = {x=pos.x+1,y=pos.y+1,z=pos.z,stackpos=1}
posTile2 = {x=pos.x+1,y=pos.y,z=pos.z,stackpos=1}
posTile3 = {x=pos.x+1,y=pos.y-1,z=pos.z,stackpos=1}
posTile4 = {x=pos.x,y=pos.y-1,z=pos.z,stackpos=1}
posTile5 = {x=pos.x-1,y=pos.y-1,z=pos.z,stackpos=1}
posTile6 = {x=pos.x-1,y=pos.y,z=pos.z,stackpos=1}
posTile7 = {x=pos.x-1,y=pos.y+1,z=pos.z,stackpos=1}
posTile8 = {x=pos.x,y=pos.y+1,z=pos.z,stackpos=1}
posAll = {posTile1,posTile2,posTile3,posTile4,posTile5,posTile6,posTile7,posTile8}

for i=1, #posAll do
if isWalkable(posAll) then
doCreateItem(item_id, 1, posAll)
end
end
addEvent(removeItem, remove_time*1000, posAll)

return true
end

function isWalkable(pos, creature, pz, proj)
if getTileThingByPos({x = pos.x, y = pos.y, z = pos.z, stackpos = 0}).itemid == 0 then return false end
local creature = getTopCreature(pos)
if creature.type > 0 then return false end
if getTilePzInfo(pos) and not pz then return false end
local n = not proj and 3 or 2
for i = 0, 255 do
pos.stackpos = i
local tile = getTileThingByPos(pos)
if tile.itemid ~= 0 and not isCreature(tile.uid) then
if hasProperty(tile.uid, n) or hasProperty(tile.uid, 7) then
return false
end
end
end
return true
end

function removeItem(posAll)
for i=1, #posAll do
for j=0, 255 do
pos_stack = {x=posAll.x,y=posAll.y,z=posAll.z,stackpos=j}
removeTile = getThingfromPos(pos_stack)
if removeTile.itemid == item_id then
doRemoveItem(removeTile.uid)
end
end
end
end

 

Rep++   :wow: 

Link para o post
Compartilhar em outros sites

testa ae.

local remove_time = 4 -- tempo em segundos para remover as magic wall


local item_id = 5750 -- id da magic wall
local storage, exhaust = 94360, 1

function onCastSpell(cid, var)
if (getPlayerStorageValue(cid, storage) >= os.time()) then
doPlayerSendCancel(cid, "wait "..exhaust.." for use spell")
return true
end
local pos = getThingPosition(getCreatureTarget(cid))
posTile1 = {x=pos.x+1,y=pos.y+1,z=pos.z,stackpos=1}
posTile2 = {x=pos.x+1,y=pos.y,z=pos.z,stackpos=1}
posTile3 = {x=pos.x+1,y=pos.y-1,z=pos.z,stackpos=1}
posTile4 = {x=pos.x,y=pos.y-1,z=pos.z,stackpos=1}
posTile5 = {x=pos.x-1,y=pos.y-1,z=pos.z,stackpos=1}
posTile6 = {x=pos.x-1,y=pos.y,z=pos.z,stackpos=1}
posTile7 = {x=pos.x-1,y=pos.y+1,z=pos.z,stackpos=1}
posTile8 = {x=pos.x,y=pos.y+1,z=pos.z,stackpos=1}
posAll = {posTile1,posTile2,posTile3,posTile4,posTile5,posTile6,posTile7,posTile8}

for i=1, #posAll do
if isWalkable(posAll) then
doCreateItem(item_id, 1, posAll)
end
end
addEvent(removeItem, remove_time*1000, posAll)
setPlayerStorageValue(cid, storage, os.time()+exhaust)
return true
end

function isWalkable(pos, creature, pz, proj)
if getTileThingByPos({x = pos.x, y = pos.y, z = pos.z, stackpos = 0}).itemid == 0 then return false end
local creature = getTopCreature(pos)
if creature.type > 0 then return false end
if getTilePzInfo(pos) and not pz then return false end
local n = not proj and 3 or 2
for i = 0, 255 do
pos.stackpos = i
local tile = getTileThingByPos(pos)
if tile.itemid ~= 0 and not isCreature(tile.uid) then
if hasProperty(tile.uid, n) or hasProperty(tile.uid, 7) then
return false
end
end
end
return true
end

function removeItem(posAll)
for i=1, #posAll do
for j=0, 255 do
pos_stack = {x=posAll.x,y=posAll.y,z=posAll.z,stackpos=j}
removeTile = getThingfromPos(pos_stack)
if removeTile.itemid == item_id then
doRemoveItem(removeTile.uid)
end
end
end
end

www.pokemiw.com
24 Horas Online - 1º 2º 3º 4º 5º 6º 7º gerações 100%
 

Link para o post
Compartilhar em outros sites
  • Solução

local remove_time = 4 -- tempo em segundos para remover as magic wall
local item_id = 5750 -- id da magic wall
 
function onCastSpell(cid, var)
if exhaustion.check(cid, 23006) == false then
exhaustion.set(cid, 23006, 10)
else
doPlayerSendCancel(cid, "Cooldown[" ..exhaustion.get(cid, 23006).."]")
return false
end
 
local pos = getThingPosition(getCreatureTarget(cid))
posTile1 = {x=pos.x+1,y=pos.y+1,z=pos.z,stackpos=1}
posTile2 = {x=pos.x+1,y=pos.y,z=pos.z,stackpos=1}
posTile3 = {x=pos.x+1,y=pos.y-1,z=pos.z,stackpos=1}
posTile4 = {x=pos.x,y=pos.y-1,z=pos.z,stackpos=1}
posTile5 = {x=pos.x-1,y=pos.y-1,z=pos.z,stackpos=1}
posTile6 = {x=pos.x-1,y=pos.y,z=pos.z,stackpos=1}
posTile7 = {x=pos.x-1,y=pos.y+1,z=pos.z,stackpos=1}
posTile8 = {x=pos.x,y=pos.y+1,z=pos.z,stackpos=1}
posAll = {posTile1,posTile2,posTile3,posTile4,posTile5,posTile6,posTile7,posTile8}
 
for i=1, #posAll do
if isWalkable(posAll[i]) then
doCreateItem(item_id, 1, posAll[i])
end
end
addEvent(removeItem, remove_time*1000, posAll)
 
return true
end
 
function isWalkable(pos, creature, pz, proj)
if getTileThingByPos({x = pos.x, y = pos.y, z = pos.z, stackpos = 0}).itemid == 0 then return false end
local creature = getTopCreature(pos)
if creature.type > 0 then return false end
if getTilePzInfo(pos) and not pz then return false end
local n = not proj and 3 or 2
for i = 0, 255 do
pos.stackpos = i
local tile = getTileThingByPos(pos)
if tile.itemid ~= 0 and not isCreature(tile.uid) then
if hasProperty(tile.uid, n) or hasProperty(tile.uid, 7) then
return false
end
end
end
return true
end
 
function removeItem(posAll)
for i=1, #posAll do
for j=0, 255 do
pos_stack = {x=posAll[i].x,y=posAll[i].y,z=posAll[i].z,stackpos=j}
removeTile = getThingfromPos(pos_stack)
if removeTile.itemid == item_id then
doRemoveItem(removeTile.uid)
end
end
end
end
Link para o post
Compartilhar em outros sites

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emojis são permitidos.

×   Seu link foi automaticamente incorporado.   Mostrar como link

×   Seu conteúdo anterior foi restaurado.   Limpar o editor

×   Não é possível colar imagens diretamente. Carregar ou inserir imagens do URL.

×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo