Instead of using
Code:
RegisterHam( Ham_Item_AddToPlayer, "weapon_knife", "OnAddToPlayerKnife", .Post = true );
I just tested
Code:
public plugin_precache( )
{
register_message( get_user_msgid( "WeaponList" ), "msgWeaponList" );
}
public msgWeaponList( msgID, msgDest, id )
{
if( get_msg_arg_int( 8 ) == CSW_C4 )
{
set_msg_arg_string( 1, "weapon_tripmine" );
set_msg_arg_int( 3, ARG_BYTE, get_pcvar_num( g_pTripMax ) );
}
}
And it works the same way. Is there a reason why you chose to hook Ham_AddToPlayer and send message as opposed to changing the args in WeaponList itself?
Also, WeaponList seems to only be called once when map loads. Message can be unregistered in plugin_init