MYSOTO Posted November 21, 2017 Share Posted November 21, 2017 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 ) Link to comment
[A]kame Posted November 22, 2017 Share Posted November 22, 2017 (edited) Revisa este tiene una distancia de 20m parece. Edited November 22, 2017 by [A]kame bug Link to comment
MYSOTO Posted November 23, 2017 Author Share Posted November 23, 2017 22 hours ago, [A]kame said: Revisa este tiene una distancia de 20m parece. cual? Link to comment
Simple0x47 Posted November 23, 2017 Share Posted November 23, 2017 On 22/11/2017 at 00:21, MystoganScripter said: 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 ) function playerTargetCheck ( ) for i, thePlayer in ipairs ( getElementsByType( "player" ) ) do if ( player ~= thePlayer ) then local px, py, pz = getElementPosition( thePlayer ) local tx, ty, tz = getElementPosition( player ) if ( getDistanceBetweenPoints3D( px, py, pz, tx, ty, tz ) <= 50 ) then setElementHealth( player, ( getElementHealth( player ) - 50 < 0 ) and 0 or getElementHealth( player ) - 50 ) end end end end addCommandHandler ( "sharigano", playerTargetCheck ) 1 Link to comment
MYSOTO Posted November 24, 2017 Author Share Posted November 24, 2017 On 22/11/2017 at 23:54, Uknown. said: function playerTargetCheck ( ) for i, thePlayer in ipairs ( getElementsByType( "player" ) ) do if ( player ~= thePlayer ) then local px, py, pz = getElementPosition( thePlayer ) local tx, ty, tz = getElementPosition( player ) if ( getDistanceBetweenPoints3D( px, py, pz, tx, ty, tz ) <= 50 ) then setElementHealth( player, ( getElementHealth( player ) - 50 < 0 ) and 0 or getElementHealth( player ) - 50 ) end end end end addCommandHandler ( "sharigano", playerTargetCheck ) gracias me ayudaste mucho xddd Link to comment
Simple0x47 Posted November 25, 2017 Share Posted November 25, 2017 1 hour ago, MystoganScripter said: gracias me ayudaste mucho xddd np Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now