Quote:
Originally Posted by Buckshot
PHP Code:
#include < amxmodx >
#include < hamsandwich >
public plugin_init( ) {
register_plugin( "Death Message", "1.0", "BuckShot" )
RegisterHam( Ham_Killed, "player", "Fwd_Ham_Killed_Post", 1 )
}
public Fwd_Ham_Killed_Post( iVictim, iAttacker ) {
new szAttackername[ 32 ]
new szVictimname[ 32 ]
get_user_name( iAttacker, szAttackername, charsmax( szAttackername ) )
get_user_name( iVictim, szVictimname, charsmax( szVictimname ) )
client_print( 0, print_chat, "%s was killed by %s", szVictimname, szAttackername )
}
Example. Will display a message saying "Player was killed by player" when a player dies.
|
why use hamsandwich when you can use DeatMsg directly ?
This code will show an meesage to a victim and one msg to the victim
if headshot the message of the victim will be :
Code:
You have been headshoted !
if is not headshot the meesage of the victim will be :
Code:
You have been normal killed (without headshot)
if is headshot the message of the attacker will be :
Code:
You give headshot to other player
if is not headshot the meesage of the attacker will be :
Code:
You normal kill the player (without headshot)
The source code :
PHP Code:
#include <amxmodx>
public plugin_init()
{
register_event("DeathMsg", "death_msg_function", "a");
}
public death_msg_function()
{
new victim = read_data( 2 );
new attacker = read_data( 1 );
new hs = read_data( 3 );
if(hs)
{
client_print(victim , print_chat, "You have been headshoted !")
client_print(attacker , print_chat, "You give headshot to other player");
}
else
{
client_print(victim , print_chat, "You have been normal killed (without headshot) ");
client_print(attacker , print_chat, "You normal kill the player (without headshot) ");
}
}