neoX304 0 Posted September 15, 2018 Share Posted September 15, 2018 (edited) ~ RESOLVIDO ~ Edited September 15, 2018 by neoX304 RESOLVIDO Link to comment Share on other sites More sharing options...
Crypter 136 Posted September 15, 2018 Share Posted September 15, 2018 (edited) local need_target = true local bullet_id = 2543 local shots_amount = 1 local exhaustion_time = -0.1 local exhaust = 19302 local shot_effect = 17 local shot_distance_effect = 7 local damage_type = COMBAT_PHYSICALDAMAGE local shots_delay = 330 local slots = {CONST_SLOT_LEFT, CONST_SLOT_RIGHT} local control = 0 --- configs do dano: local dmg_min, dmg_max = -600, -620 local levelDamageRate = 0.5 function onUse(cid, item, fromPosition, itemEx, toPosition) if isCreature(cid) then dmg_min = dmg_min + (getPlayerLevel(cid) * levelDamageRate) dmg_max = dmg_max + (getPlayerLevel(cid) * levelDamageRate) end for a, b in ipairs(slots) do if getPlayerSlotItem(cid, b).uid ~= item.uid then control = control + 1 end end if control == slots then return doPlayerSendCancel(cid, "Coloque a arma no slot correto.") end 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(uid, 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 Edited September 15, 2018 by Crypter Link to comment Share on other sites More sharing options...
neoX304 0 Posted September 15, 2018 Author Share Posted September 15, 2018 (edited) 1 hora atrás, Crypter disse: local need_target = true local bullet_id = 2543 local shots_amount = 1 local exhaustion_time = -0.1 local exhaust = 19302 local shot_effect = 17 local shot_distance_effect = 7 local damage_type = COMBAT_PHYSICALDAMAGE local shots_delay = 330 local slots = {CONST_SLOT_LEFT, CONST_SLOT_RIGHT} local control = 0 --- configs do dano: local dmg_min, dmg_max = -600, -620 local levelDamageRate = 1 function onUse(cid, item, fromPosition, itemEx, toPosition) if isCreature(cid) then dmg_min = dmg_min * (getPlayerLevel(cid)* levelDamageRate * 0.5) dmg_max = dmg_max * (getPlayerLevel(cid)* levelDamageRate * 2) end for a, b in ipairs(slots) do if getPlayerSlotItem(cid, b).uid ~= item.uid then control = control + 1 end end if control == slots then return doPlayerSendCancel(cid, "Coloque a arma no slot correto.") end 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(uid, 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 Mano "funcionou" só que eu queria que o Dano Minimo e maximo somassem com metade do nivel. E o dano ta sempre aumentando ao invés de manter tipo, ao invés de manter em 900, fica: 900, 1200, 1500, 1800 e assim infinitamente. Edited September 15, 2018 by neoX304 Link to comment Share on other sites More sharing options...
Crypter 136 Posted September 15, 2018 Share Posted September 15, 2018 @neoX304 mudei a formula , testa e me diga se ficou bom caso queria menos ou mais dano de acordo com o lvl altere a variável levelDamageRate = 0.5 neoX304 1 Link to comment Share on other sites More sharing options...
Recommended Posts