Matty Posted September 6, 2012 Posted September 6, 2012 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 )
DefearT Posted September 6, 2012 Posted September 6, 2012 Muy buena pregunta, eh estado buscando esto, que cuando este dentro del radar de color no le cause daño alguno!
Tonyx97 Posted September 6, 2012 Posted September 6, 2012 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
Arsilex Posted September 6, 2012 Posted September 6, 2012 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
Tonyx97 Posted September 6, 2012 Posted September 6, 2012 Joder, no es onPlayerWasted es "onPlayerDamage"
Matty Posted September 6, 2012 Author Posted September 6, 2012 No funciona... creeria que es con removeEventHandler
NodZen Posted September 6, 2012 Posted September 6, 2012 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
Alexs Posted September 6, 2012 Posted September 6, 2012 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.
DefearT Posted September 6, 2012 Posted September 6, 2012 me explico, como seria local theRadar = createRadarArea(posx, posy, posx, posy, color, alpha) y para que seria el local theCol = createColRectangle?
Alexs Posted September 6, 2012 Posted September 6, 2012 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.
Matty Posted September 6, 2012 Author Posted September 6, 2012 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
Matty Posted September 6, 2012 Author Posted September 6, 2012 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
Recommended Posts