View Single Post
vitorrossi
Senior Member
Join Date: Apr 2012
Location: NY, USA
Old 08-09-2017 , 15:03   Re: [TUT] Custom Weapon Hud Sprites + Slot Redirection
Reply With Quote #93

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

Last edited by vitorrossi; 08-09-2017 at 15:21.
vitorrossi is offline