OR
pedido

Ao acabar exhausted ,enviar uma msg.

Por OriGM, 22 de out. de 2013 em Scripts

resolvido
script
7
817
OriGMO
22 de outubro de 2013 às 01:27

Olha eu aqui de novo galerinha.

Eu to tentando fazer um comando pra quando o exhausted acabar,enviar um AnimatedText avisando que acabou.

Só que nao estou conseguindo.

Seguindo a ordem dos exhaustion.set(cid, exhaust , exhausted_time) e exhaustion.check(cid, exhaust , exhausted_time).

Qual o comando que dou pra enviar automaticamente a msg ao exhausted zerar?

O scrip ja te feito e tals,avisa que ta exausted quando tento usar,mas queria saber como fazer isso de enviar mensagem automaticamente ao zerar.

 

Quem puder ajudar ficaria agradecido,estou caindo de cabeça nos scripts,e estou melhorando cada vez mais,mas infelizmente tem hora que nao descubro a solução. rsrs

Abração.

OmegaO
22 de outubro de 2013 às 01:33
function doSendTimerEffect(cid, time, effect) -- Em segundos
    addEvent(function(cid)
        if isCreature(cid) then
            doSendMagicEffect(getThingPos(cid), effect)
        end
    end, time * 1000)
    return true
end

Adiciona doSendTimerEffect(cid, tempo de exhaust, numero do efeito) nos seus scripts e essa função na lib.

Editado Outubro 22 por omega blueheaven

OriGMO
22 de outubro de 2013 às 01:44
function doSendTimerEffect(cid, time, effect) -- Em segundos
    addEvent(function(cid)
        if isCreature(cid) then
            doSendMagicEffect(getThingPos(cid), effect)
        end
    end, time * 1000)
    return true
end
Adiciona doSendTimerEffect(cid, tempo de exhaust, numero do efeito) nos seus scripts e essa função na lib.

 

Omega desculpe a ignorancia mas como eu usaria esta função? Ja adicionei na Lib.

 

---EDIT---

No caso eu queria que esse script aqui,avisasse que está disponivel para atirar ao zerar o exhausted.

function onUse(cid, item, fromPosition, itemEx, toPosition)

local need_target = true -- Precisa de target? (true / false) Se false, o sistema utilizará o Use With.

local bullet_id = 2160 -- ID da munição

local shots_amount = 1 -- Tiros por vez

local exhaustion_time = 1 -- Segundos de exhaustion

local exhaust = 19301 -- Storage da exhaustion

local dmg_min, dmg_max = -100, -200 -- Dano mínimo, dano máximo

local shot_effect = 10 -- Efeito do tiro

local shot_distance_effect = 1 -- Distance effect do tiro

local damage_type = COMBAT_PHYSICALDAMAGE -- Tipo de dano

local shots_delay = 200 -- Delay dos tiros (em milissegundos)

if need_target then

if getCreatureTarget(cid) <= 0 then

return doPlayerSendCancel(cid, "Selecione um alvo primeiro.")

elseif getPlayerItemCount(cid, bullet_id) < shots_amount then

return doPlayerSendCancel(cid, "Você não possui munição.")

elseif exhaustion.check(cid, exhaust) then

return doPlayerSendCancel(cid, "Aguarde "..(exhaustion.get(cid, exhaust)).." segundos para usar a arma novamente.")

end

exhaustion.set(cid, exhaust, exhaustion_time)

for i = 0, shots_amount-1 do

addEvent(function()

if getCreatureTarget(cid) <= 0 then

return true

elseif getPlayerItemCount(cid, bullet_id) < 1 then

return doPlayerSendCancel(cid, "Você não possui munição.")

end

doSendDistanceShoot(getCreaturePosition(cid), getCreaturePosition(getCreatureTarget(cid)), shot_distance_effect)

doTargetCombatHealth(cid, getCreatureTarget(cid), damage_type, dmg_min, dmg_max, shot_effect)

doPlayerRemoveItem(cid, bullet_id, 1)

end, shots_delay*i)

end

else

if not isCreature(itemEx.uid) then

return doPlayerSendCancel(cid, "Selecione um alvo primeiro.")

elseif getPlayerItemCount(cid, bullet_id) < shots_amount then

return doPlayerSendCancel(cid, "Você não possui munição.")

elseif exhaustion.check(cid, exhaust) then

return doPlayerSendCancel(cid, "Aguarde "..(exhaustion.get(cid, exhaust)).." segundos para usar a arma novamente.")

end

exhaustion.set(cid, exhaust, exhaustion_time)

for i = 0, shots_amount-1 do

addEvent(function()

if not isCreature(itemEx.uid) then

return true

elseif getPlayerItemCount(cid, bullet_id) < 1 then

return doPlayerSendCancel(cid, "Você não possui munição.")

end

doSendDistanceShoot(getCreaturePosition(cid), getCreaturePosition(itemEx.uid), shot_distance_effect)

doTargetCombatHealth(cid, itemEx.uid, damage_type, dmg_min, dmg_max, shot_effect)

doPlayerRemoveItem(cid, bullet_id, 1)

end, shots_delay*i)

end

end

return true

end

Retirei os exhaustion.get e check e substitui por storage + os.time,consegui que ele avise que ta pronto para atirar,porém só ao tentar usar a arma,nao teria como enviar automaticamente ao zerar o os.time?

Editado Outubro 22 por OriGM

markindootM
22 de outubro de 2013 às 09:55

 

function doSendTimerEffect(cid, time, effect) -- Em segundos
    addEvent(function(cid)
        if isCreature(cid) then
            doSendMagicEffect(getThingPos(cid), effect)
        end
    end, time * 1000)
    return true
end
Adiciona doSendTimerEffect(cid, tempo de exhaust, numero do efeito) nos seus scripts e essa função na lib.

 

Omega desculpe a ignorancia mas como eu usaria esta função? Ja adicionei na Lib.

 

---EDIT---

No caso eu queria que esse script aqui,avisasse que está disponivel para atirar ao zerar o exhausted.

function onUse(cid, item, fromPosition, itemEx, toPosition)

local need_target = true -- Precisa de target? (true / false) Se false, o sistema utilizará o Use With.

local bullet_id = 2160 -- ID da munição

local shots_amount = 1 -- Tiros por vez

local exhaustion_time = 1 -- Segundos de exhaustion

local exhaust = 19301 -- Storage da exhaustion

local dmg_min, dmg_max = -100, -200 -- Dano mínimo, dano máximo

local shot_effect = 10 -- Efeito do tiro

local shot_distance_effect = 1 -- Distance effect do tiro

local damage_type = COMBAT_PHYSICALDAMAGE -- Tipo de dano

local shots_delay = 200 -- Delay dos tiros (em milissegundos)

if need_target then

if getCreatureTarget(cid) <= 0 then

return doPlayerSendCancel(cid, "Selecione um alvo primeiro.")

elseif getPlayerItemCount(cid, bullet_id) < shots_amount then

return doPlayerSendCancel(cid, "Você não possui munição.")

elseif exhaustion.check(cid, exhaust) then

return doPlayerSendCancel(cid, "Aguarde "..(exhaustion.get(cid, exhaust)).." segundos para usar a arma novamente.")

end

exhaustion.set(cid, exhaust, exhaustion_time)

for i = 0, shots_amount-1 do

addEvent(function()

if getCreatureTarget(cid) <= 0 then

return true

elseif getPlayerItemCount(cid, bullet_id) < 1 then

return doPlayerSendCancel(cid, "Você não possui munição.")

end

doSendDistanceShoot(getCreaturePosition(cid), getCreaturePosition(getCreatureTarget(cid)), shot_distance_effect)

doTargetCombatHealth(cid, getCreatureTarget(cid), damage_type, dmg_min, dmg_max, shot_effect)

doPlayerRemoveItem(cid, bullet_id, 1)

end, shots_delay*i)

end

else

if not isCreature(itemEx.uid) then

return doPlayerSendCancel(cid, "Selecione um alvo primeiro.")

elseif getPlayerItemCount(cid, bullet_id) < shots_amount then

return doPlayerSendCancel(cid, "Você não possui munição.")

elseif exhaustion.check(cid, exhaust) then

return doPlayerSendCancel(cid, "Aguarde "..(exhaustion.get(cid, exhaust)).." segundos para usar a arma novamente.")

end

exhaustion.set(cid, exhaust, exhaustion_time)

for i = 0, shots_amount-1 do

addEvent(function()

if not isCreature(itemEx.uid) then

return true

elseif getPlayerItemCount(cid, bullet_id) < 1 then

return doPlayerSendCancel(cid, "Você não possui munição.")

end

doSendDistanceShoot(getCreaturePosition(cid), getCreaturePosition(itemEx.uid), shot_distance_effect)

doTargetCombatHealth(cid, itemEx.uid, damage_type, dmg_min, dmg_max, shot_effect)

doPlayerRemoveItem(cid, bullet_id, 1)

end, shots_delay*i)

end

end

return true

end

Retirei os exhaustion.get e check e substitui por storage + os.time,consegui que ele avise que ta pronto para atirar,porém só ao tentar usar a arma,nao teria como enviar automaticamente ao zerar o os.time?

 

existe algum modo de por essa action menos de 1 segundo? 0.5<- para a arma atirar em 0.5

OriGMO
23 de outubro de 2013 às 22:16

Queria agradecer a quem se propos a ajudar,consegui resolver meu problema,adicionando um evento.

CARAMBA to me surpreendendo nos scripts em. Auhuhhua

Pra quem até semana passada não sabia faze nem remover um item. kkk

LumusL
23 de outubro de 2013 às 22:30

Dúvida sanada.

 

Reportado para que movam.

RoksasR
24 de outubro de 2013 às 18:28

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