PHP Code:
#include <amxmodx>
public plugin_init()
{
register_plugin( "Weapon and Kill" , "1.0" , "bugsy" );
register_event( "CurWeapon" , "fw_EvCurWeapon" , "be" , "1=1" );
register_event( "DeathMsg" , "fw_EvDeathMsg" , "a" );
}
public fw_EvCurWeapon( id )
{
static iWeapon , iPrevWeapon;
static szWeapon[ 20 ];
iWeapon = read_data( 2 );
if ( iWeapon != iPrevWeapon )
{
get_weaponname( iWeapon , szWeapon , 19 );
client_print( id , print_chat , "* You are now using %s" , szWeapon[ 7 ] );
iPrevWeapon = iWeapon;
}
}
public fw_EvDeathMsg( )
{
static iKiller; iKiller = read_data( 1 );
static iVictim; iVictim = read_data( 2 );
static iWasHeadshot; iWasHeadshot = read_data( 3 );
static szWeaponUsed[ 20 ]; read_data( 4 , szWeaponUsed , 19 );
static szKiller[ 33 ] , szVictim[ 33 ];
//You could also perform this if-statement via adding condition in the register_event function
//which will make it only be called if a player kills another player [not called on suicide\slay etc]
//register_event( "DeathMsg" , "fw_EvDeathMsg" , "a" , "1>0" , "2>0" );
if ( iKiller && iVictim )
{
get_user_name( iKiller , szKiller , 32 );
get_user_name( iVictim , szVictim , 32 );
client_print( 0 , print_chat , "* %s killed %s with %s%s" , szKiller , szVictim, szWeaponUsed , iWasHeadshot ? " [HEADSHOT]" : "" );
}
}
__________________