Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //FireEvent Stuff
- if ( !strcmp( pEvent->GetName( ), "round_prestart" ) ) {
- EventInfo.flBuytimeEnd = I::Globals->curtime + 35.f;
- EventInfo.BuyInfo.clear( );
- }
- if ( !strcmp( pEvent->GetName( ), "round_end" ) )
- EventInfo.BuyInfo.clear( );
- if ( !strcmp( pEvent->GetName( ), "item_purchase" ) )
- LogItemsEvent( pEvent );
- //Structs
- struct BuyInfo_t
- {
- int iEntityIndex = 0;
- std::string szName = "";
- std::vector< std::string > szWeaponsBought{ };
- };
- struct EventInfo_t
- {
- float flHitmarkerAlpha = 0.f;
- float flBuytimeEnd = 0.f;
- std::vector< BuyInfo_t > BuyInfo{ };
- };
- class CGameEvents
- {
- public:
- EventInfo& GetEventInfo(){
- return EventInfo;
- }
- private:
- EventInfo_t EventInfo;
- BuyInfo_t BuyInfo;
- }
- void CGameEvents::LogItemsEvent( IGameEvent* pEvent )
- {
- CBaseEntity* pLocal = I::ClientEntList->GetClientEntity( I::Engine->GetLocalPlayer( ) );
- CBaseEntity* pEntity = I::ClientEntList->GetClientEntity( I::Engine->GetPlayerForUserID( pEvent->GetInt( "userid" ) ) );
- player_info_t pInfo;
- if ( pLocal && pEntity )
- {
- if ( pEntity->Team( ) != pLocal->Team( ) )
- {
- I::Engine->GetPlayerInfo( pEntity->Index( ), &pInfo );
- BuyInfo.iEntityIndex = pEntity->Index( );
- BuyInfo.szName = pInfo.name;
- for ( auto& it : EventInfo.BuyInfo )
- {
- if ( it.iEntityIndex == BuyInfo.iEntityIndex )
- {
- it.szWeaponsBought.push_back( FixName( pEvent->GetString( "weapon" ) ) );
- return;
- }
- }
- BuyInfo.szWeaponsBought.clear( );
- BuyInfo.szWeaponsBought.push_back( FixName( pEvent->GetString( "weapon" ) ) );
- EventInfo.BuyInfo.push_back( BuyInfo );
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement