Hola tengo este pequeño script y lo que pasa que no se porque se bugea y no toma solo a los jugadores que les apunto o están cerca sino también toma a lejanos me gustaría saber como podría hacer que a una distancia corta solo le baje vida a los jugadores cercanos pero no al reproductor
function playerTargetCheck ( )
local target
for i, thePlayer in ipairs ( getElementsByType("player") ) do -- iterate over all players
target = getPedTarget ( thePlayer ) -
if ( target ) then -- if there was a target
local health = getElementHealth(target)
setElementHealth (target, health - 50 )
end
end
end
addCommandHandler ( "sharigano", playerTargetCheck )