Peguei este codigo na Fabrica de Scripts que fechou,e gostaria que ao usar a pistola como Use With,tivesse uma range configuravel.
Por exemplo: só usar no maximo 3 sqm do player.
Abaixo o script:
function onUse(cid, item, fromPosition, itemEx, toPosition) local need_target =true--Precisa de target?(true/false)Sefalse, o sistema utilizará o UseWith. 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--Efeitodo 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)<=0then 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-1do addEvent(function() if getCreatureTarget(cid)<=0then returntrue elseif getPlayerItemCount(cid, bullet_id)<1then 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 ifnot 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-1do addEvent(function() ifnot isCreature(itemEx.uid)then returntrue elseif getPlayerItemCount(cid, bullet_id)<1then 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 returntrue end
Pergunta
OriGM 25
Olá galera.
Peguei este codigo na Fabrica de Scripts que fechou,e gostaria que ao usar a pistola como Use With,tivesse uma range configuravel.
Por exemplo: só usar no maximo 3 sqm do player.
Abaixo o script:
Se alguem puder ajudar,fico agradecido.
Link para o comentário
https://xtibia.com/forum/topic/222761-colocar-range-na-pistola/Compartilhar em outros sites
27 respostass a esta questão
Posts Recomendados