From 7ccb819f867493f8ec202ea3b39c94c198c64584 Mon Sep 17 00:00:00 2001 From: JustSomePwner Date: Thu, 30 Aug 2018 14:01:54 +0200 Subject: first --- tf2/listener.cpp | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 tf2/listener.cpp (limited to 'tf2/listener.cpp') diff --git a/tf2/listener.cpp b/tf2/listener.cpp new file mode 100644 index 0000000..c48b900 --- /dev/null +++ b/tf2/listener.cpp @@ -0,0 +1,42 @@ +#include "listener.hpp" +#include "interfaces.h" +#include "base_cheat.h" +#include "ctx.hpp" +#include "settings.h" +#undef PlaySound + +//how can you listen if youre deaf + +generic_listener_t::generic_listener_t( const char* name, void( *function )( IGameEvent* ) ) : + m_function( function ), m_name( name ) { } + +generic_listener_t::~generic_listener_t( ) { + if( m_registered ) + cl.m_event_mgr( )->RemoveListener( this ); + +} + +void generic_listener_t::init( ) { + cl.m_event_mgr( )->AddListener( this, m_name, false ); + m_registered = true; +} + +namespace listeners +{ + + void player_hurt( IGameEvent* e ) { + if( !cl.m_panic && e ) { + int user_id = e->GetInt( xors( "userid" ) ); + int attacker = e->GetInt( xors( "attacker" ) ); + int attacker_id = cl.m_engine( )->GetPlayerForUserID( attacker ); + int player_id = cl.m_engine( )->GetPlayerForUserID( user_id ); + + + //if( attacker_id == cl.m_engine( )->GetLocalPlayer( ) && user_id != attacker_id ) { + g_cheat.visuals.store_hit( ); + + //} + } + } + +} \ No newline at end of file -- cgit v1.2.3