[TUT] Daño en hitzones.
#1
La primera forma es para detectar un headshot usando DeathMsg (obviamente esto no es para detectar daño ya que el usuario ya está muerto por lo que lo haría inútil en este sentido):



Código PHP:
#include <amxmodx>



public plugin_init( )

{

    
register_plugin"Hitzones Test""1.0.0""Shupiro" );

    

    
register_event"DeathMsg""Event_DeathMsg""a" );

}



public 
Event_DeathMsg( )

{

    if ( 
read_data) )

    {

        
// Es headshot.

        // Sin embargo pueden filtrar directamente el headshot

        // en el evento en lugar de chequearlo a posteriori.

        // register_event( "DeathMsg" , "Event_DeathMsg" , "a" , "3=1" );

    
}





La segunda forma sirve para detectar daño en distintas hitzones:



Código PHP:
#include <amxmodx>

#include <fakemeta>

#include <hamsandwich>



const OFFSET_LAST_HIT_GROUP 75;

const 
XTRA_LINUX_OFFS 5;



public 
plugin_init( )

{

    
register_plugin"Hitzones Test""1.0.0""Shupiro" );

    

    
RegisterHamHam_TakeDamage"player""Fwd_TakeDamage_Pre");

}



public 
Fwd_TakeDamage_PreiVictim )

{

    if ( 
get_pdata_intiVictimOFFSET_LAST_HIT_GROUPXTRA_LINUX_OFFS ) == HIT_HEAD )

    {

        
// Daño en la cabeza.

    
}





Hitzones disponibles:



Código PHP:
Originally Posted by amxconst.inc

/* Parts of body for hits */

#define HIT_GENERIC     0    /* none */

#define HIT_HEAD     1

#define HIT_CHEST     2

#define HIT_STOMACH     3

#define HIT_LEFTARM     4

#define HIT_RIGHTARM     5

#define HIT_LEFTLEG     6

#define HIT_RIGHTLEG     7 
Responder


Salto de foro:


Usuarios navegando en este tema: 1 invitado(s)