Jump to content

Ayuda - Damage


Matty

Recommended Posts

Posted

Buenas... como puedo hacer para que no le cause daños al jugador estando dentro del RadarArea...

Code:

local theRadar = createRadarArea (1056, -1402, 200, 120, 255, 0, 0, 80) 
local theCol = createColRectangle (1056, -1402, 200, 120) 
  
function noDamage () 
  
-- ¿? 
  
end 
addEventHandler ( "onColShapeHit",theCol, noDamage ) 

Posted
local theRadar = createRadarArea (1056, -1402, 200, 120, 255, 0, 0, 80) 
local theCol = createColRectangle (1056, -1402, 200, 120) 
  
function noDamage () 
    addEventHandler ("onPlayerWasted", getRootElement(), invincible) 
end 
addEventHandler ( "onColShapeHit",theCol, noDamage ) 
  
function invincible ( attacker, weapon, bodypart, loss ) 
    local vidaActual = getElementHealth ( source ) 
    setElementHelath ( source,  vidaActual + loss ) 
end  

Prueba esto :)

Posted

Mas simple es esto

local theRadar = createRadarArea (1056, -1402, 200, 120, 255, 0, 0, 80) 
local theCol = createColRectangle (1056, -1402, 200, 120) 
  
function noDamage () 
    addEventHandler ("onPlayerWasted", getRootElement(), invincible) 
end 
addEventHandler ( "onColShapeHit",theCol, noDamage ) 
  
function invincible ( attacker, weapon, bodypart, loss ) 
cancelEvent() 
end 

Posted

Talvez podrias usar :

local theRadar = createRadarArea (1056, -1402, 200, 120, 255, 0, 0, 80) 
local theCol = createColRectangle (1056, -1402, 200, 120) 
  
function noDamage () 
    exports [ "extra_health" ]:setElementInvulnerable ( thePlayer, true )-- talvez puedas usar  el "extra_health" 
end 
addEventHandler ( "onColShapeHit",theCol, noDamage ) 
  
function invincible ( attacker, weapon, bodypart, loss ) 
cancelEvent() 
end 

Posted
addEventHandler("onClientPlayerDamage", getRootElement(), 
function() 
local gx,gy,gz = getElementPosition(source) 
 if isInsideRadarArea ( AREA, gx, gy ) then --Cambia 'AREA' por tu Radar Area. 
   cancelEvent() 
  end 
end 
) 

El daño solo es cancelable en client side.

Posted

me explico, como seria local theRadar = createRadarArea(posx, posy, posx, posy, color, alpha)

y para que seria el local theCol = createColRectangle?

Posted
me explico, como seria local theRadar = createRadarArea(posx, posy, posx, posy, color, alpha)

y para que seria el local theCol = createColRectangle?

Al ver su código el pensaba que el daño seria cancelable con el evento onColShapeHit ya que no existe onRadarAreaHit, pero quizá lo use en otras cosas, yo tampoco saco cosas de mis códigos al pedir ayuda.

Posted
me explico, como seria local theRadar = createRadarArea(posx, posy, posx, posy, color, alpha)

y para que seria el local theCol = createColRectangle?

al createColRectangle lo hice siguiendo los ejemplos de la wiki en server-side... pero como dijo Alexs, se cancela solo en client-side

Posted
me explico, como seria local theRadar = createRadarArea(posx, posy, posx, posy, color, alpha)

y para que seria el local theCol = createColRectangle?

Al ver su código el pensaba que el daño seria cancelable con el evento onColShapeHit ya que no existe onRadarAreaHit, pero quizá lo use en otras cosas, yo tampoco saco cosas de mis códigos al pedir ayuda.

la funcion isInsideRadarArea la pase de largo :? . Gracias Alexs :)

  • Recently Browsing   0 members

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