local need_target = true
local bullet_id = 2543
local shots_amount = 1
local exhaustion_time = -0.1
local exhaust = 19302
local dmg_min, dmg_max = -600, -620
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
function onUse(cid, item, fromPosition, itemEx, toPosition)
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
No caso ai é o Script sem o sistema de aumentar o dano por Level.