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 ) 

mattybanner.jpg

...Learning Scripting...

State: Rookie, Noob

[AP3]=Matty!=

My Skype: mattias.netz

Posted

Muy buena pregunta, eh estado buscando esto, que cuando este dentro del radar de color no le cause daño alguno!

Proximamente Proyecto SX!

In game Nick: [sX]DefearT~#

Skype: imarcosr

Twitter: @iMarcosR

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 :)

-Advanced programmer C++, openGL, JS, Java y C# 

me :)

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 

rsilex.png.0e6ad382b3fdc3cbe6390e3e847572c9.png
Posted

No funciona... creeria que es con

removeEventHandler 

mattybanner.jpg

...Learning Scripting...

State: Rookie, Noob

[AP3]=Matty!=

My Skype: mattias.netz

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 

------------------------------------------------------------------------------------------

My scripts

http://community.multitheftauto.com/index.php?p=resources&s=details&id=6977

http://community.multitheftauto.com/index.php?p=resources&s=details&id=7740

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.

Developer @ MYVAL

Posted

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

y para que seria el local theCol = createColRectangle?

Proximamente Proyecto SX!

In game Nick: [sX]DefearT~#

Skype: imarcosr

Twitter: @iMarcosR

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.

Developer @ MYVAL

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

mattybanner.jpg

...Learning Scripting...

State: Rookie, Noob

[AP3]=Matty!=

My Skype: mattias.netz

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 :)

mattybanner.jpg

...Learning Scripting...

State: Rookie, Noob

[AP3]=Matty!=

My Skype: mattias.netz

  • Recently Browsing   0 members

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