Jump to content

no afectar al jugador, pero si alos que estan cerca


Bossy

Recommended Posts

Posted

    for i, thePlayer in ipairs ( getElementsByType( "player" ) ) do    
        if ( sasori ~= 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( thePlayer, ( getElementHealth( sasori ) - 80 ) 
            end
        end
    end

 

Hola tengo ese pequeño script pero quiero que le quite vida a los que están cerca del jugador pero no al jugador porfa tengo esa duda

Posted

tendrias que cambiar sasori por player no ? :L tambien vendria bien saber que evento usas, lo digo porque estas usando "sasori" como variable del jugador pero tambien "player" para obtener la posicion del jugador que no se ve afectado.

Posted

Si pasas solo esa parte ni sabemos lo que es thePlayer ni sabemos lo que es sasori. Deberías pasar algo más completo y utilizar por favor el formato de código:

UbnKUWE.png

e9sOUfJ.png

  • 4 weeks later...
Posted (edited)

Complicado de entender tu post la verdad. Pero prueba esto:

function takeHealth( thePlayer, cmd )
	local x, y, z = getElementPosition( thePlayer )
	for i,players in ipairs(getElementsByType('player')) do
		local tx, ty, tz = getElementPosition( players )
		if getDistanceBetweenPoints3D( x, y, z, tx, ty, tz ) <= 50 then
			setElementHealth( players, getElementHealth( players ) - 80 )
		end
	end
end
addCommandHandler('take', takeHealth)

 

Edited by Rut

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...