In the weapon:
- Code: Select all
void CEX_Bolter::BroadcastMode(bool IsRapid)
{
#ifdef CLIENT_DLL
IGameEvent * pEvt = gameeventmanager->CreateEvent( "ex_bolter_mode" );
if ( pEvt )
{
pEvt->SetBool( "IsRapid", IsRapid );
gameeventmanager->FireEvent( pEvt );
}
#endif
};
In the HUD element:
- Code: Select all
void C_EX_HumanHUD::FireGameEvent( IGameEvent *event )
{
if ( FStrEq( event->GetName(), "ex_bolter_mode" ))
{
if( event->GetBool( "IsRapid" ) )
{
pModeIndicatorImage->SetImage( "ex/imp_rapid_mode.vmt" );
} else {
pModeIndicatorImage->SetImage( "ex/imp_basic_mode.vmt" );
}
}
};
90% of the time it work, just occasionally it crashed the client back to the desktop. Can anyone see what i'm doing wrong here?