1. Cum se foloseste:
I. Introducerea lui in plugin_init
In codul de mai sus, observam ca sunt 3 argumente.public plugin_init( )
{
register_event( "DeathMsg", "eDeathMsg", "a" );
}
La flag, avem:1. "DeathMsg"
2. "eDeathMsg" - Numele publicului unde se executa event`ul.
3. "a" - Flag`ul
Code: Select all
"a" - global event.
"b" - specified.
"c" - send only once when repeated to other players.
"d" - call if is send to dead player.
"e" - to alive.
II. Cum il folosim in pluginuri.
Un exemplu simplu, sa zicem ca vrem dupa ce moare un jucator, sa ii de`a kick. (mai simplu, victima.)
Code: Select all
#include < amxmodx >
public plugin_init( )
{
register_event( "DeathMsg", "eDeathMsg", "a" );
}
public eDeathMsg( )
{
new v_Victim = read_data( 2 ); // Victima.
server_cmd( "kick #%d", get_user_userid( v_Victim ) ); // Luam ID`ul jucatorului care tocmai a murit(victimei), si ii da`m kick.
}
Code: Select all
new v_Victim = read_data( 2 ); // Victima.
new tAttacker = read_data( 1 ) // Atacatorul
new tAttackerName[ 32 ];
get_user_name( tAttacker, tAttackerName, 31 ); // Aflam numele atacatorului
new tGun[ 32 ];
read_data( 4, tGun, sizeof( tGun ) -1 ); // Arma cu care a fost ucisa victima
new h_Headshot = read_data( 3 ); // OnlyHeadshot
#include < amxmodx >
public plugin_init( )
{
register_event( "DeathMsg", "eDeathMsg", "a" );
}
public eDeathMsg( )
{
new v_Victim = read_data( 2 ); // Victima.
new tAttacker = read_data( 1 ) // Atacatorul
new tGun[ 32 ];
read_data( 4, tGun, sizeof( tGun ) -1 ); // Arma cu care a fost ucisa victima
new tAttackerName[ 32 ];
get_user_name( tAttacker, tAttackerName, 31 ); // Aflam numele atacatorului
new h_Headshot = read_data( 3 ); // OnlyHeadshot
client_print( v_Victim, print_chat, "Atacatorul: %s | Arma: %s | HitPlace: %s", tAttackerName, tGun, h_Headshot );
}