Updated to v1.2:
Code:
. Fixed the damage block (sometimes it wasn't blocking)
. Fixed the deathmsg message (it shows now the weapon icon).
. Changed the way to set sv_maxvelocity in the plugin, sometimes it wasn't setting the value.
Observation:
I figured out that when you catch the death of anyone, with Ham_Killed or DeathMsg, sometimes the weapon id is not passed, so, I recommend to use get_user_weapon() to get the killer's weapon ID.
Like:
1. DeathMsg
PHP Code:
register_event("DeathMsg", "event_DeathMsg", "a")
PHP Code:
public event_DeathMsg()
{
new iKiller = read_data(1), szWeapon[32]
get_weaponname(get_user_weapon(iKiller), szWeapon, charsmax(szWeapon))
log_amx("iKillerID: %d, iVictimID: %d, Killer's WeaponName: %s", iKiller, read_data(2), szWeapon[7])
}
Output:
Code:
iKillerID: 1, iVictimID: 6, Killer's WeaponName: ak47
2. Ham_Killed
PHP Code:
RegisterHam(Ham_Killed, "player", "ham_PlayerKilled")
PHP Code:
public ham_PlayerKilled(iVictim, iKiller, iShouldGib)
{
new szWeapon[32]
get_weaponname(get_user_weapon(iKiller), szWeapon, charsmax(szWeapon))
log_amx("iKillerID: %d, iVictimID: %d, Killer's WeaponName: %s", iKiller, read_data(2), szWeapon[7])
}
Output:
Code:
[bulletSpeed.amxx] iKillerID: 1, iVictimID: 28, Killer's WeaponName: ak47
So, both works. And I know that the player can throw a nade, change to AK47, kill the enemy with the HE, and it'll pass the weapon ID as AK47 (due the get_user_weapon() native), but, that barely happens. For now, it's the best way.
__________________