Модератор раздела «Создание читов CS2»
-
Автор темы
- #1
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
C++:
namespace hack::cs2 {
struct events_t {
// xref: client.dll & 4C 8B F0 8B CE ("cs_pre_restart")
CS2_INLINE const char* get_name( ) noexcept { return VFUNC( const char*, 1u, this ); }
CS2_INLINE bool get_bool( const std::string_view token_name ) noexcept {
key_string_t token( token_name.data( ), -1 );
return VFUNC( bool, 6u, this, &token, false );
}
// xref: client.dll & 89 85 08 0B 00 00 ("damage_taken")
CS2_INLINE int get_int_from_hash( const std::string_view token_name ) noexcept {
key_string_t token( token_name.data( ), -1 );
return VFUNC( int, 7u, this, &token, 0 );
}
// xref: client.dll & 4C 8B A8 80 00 00 00 ("killer")
CS2_INLINE player_controller_t* get_player_controller( const std::string_view token_name ) noexcept {
key_string_t token( token_name.data( ), -1 );
return VFUNC( entity::player_controller_t*, 16u, this, &token );
}
CS2_INLINE float get_float( const std::string_view token_name ) noexcept {
key_string_t token( token_name.data( ), -1 );
return VFUNC( float, 9u, this, &token, 0.0f );
}
// xref: client.dll & 48 89 54 24 10 48 89 4C 24 08 55 53 56 57 41 55 41 56 41 57 48 8D AC 24 D0 DF FF FF ("weapon")
CS2_INLINE const char* get_string( const std::string_view token_name ) noexcept {
key_string_t token( token_name.data( ), -1 );
return VFUNC( const char*, 10u, this, &token, nullptr );
}
void* get_player_pawn_from_id( std::string_view event_name ) noexcept;
/* output (name | int):
team: 2
dmg_health: 21
entityid: 316
defindex: 49
radius: 1100
*/
std::int64_t get_int( std::string_view event_name ) noexcept;
void* get_pointer_from_id( const std::string_view event_name ) noexcept;
};
inline namespace interfaces {
// todo: you can use this instead of hooking like you did it in csgo (input ur listeners), but that's a task for the reader.
// client.dll; 48 89 05 ?? ?? ?? ?? E8 ?? ?? ?? ?? 48 8D 8B E0 00 00 00
struct event_manager_t {
CS2_INLINE void init_event( /*C_CSPlayerPawnBase*/ void* player_pawn_base,
const std::string_view event_name, void* unk = nullptr ) noexcept {
// (*(*g_pGameEventManager + 24i64))(g_pGameEventManager, a1 + 4680, "round_end", 0i64);
return VFUNC( void, 6u, this, player_pawn_base, event_name.data( ), unk );
}
};
} // namespace interfaces
} // namespace hack::cs2
C++:
namespace hack::cs2 {
std::int64_t events_t::get_int( const std::string_view event_name ) noexcept {
// client.dll; 48 89 5C 24 08 48 89 74 24 10 48 89 7C 24 18 41 56 48 83 EC 30 48 8B 01 41 8B F0 4C 8B F1 41 B0 01 48 8D 4C 24 20 48 8B DA 48 8B 78
static const auto fn{ CLIENT::m_get_event_int.as< std::int64_t( CS2_FASTCALL* )( void*, const char* ) >( ) };
return fn( this, event_name.data( ) );
}
void* events_t::get_player_pawn_from_id( const std::string_view event_name ) noexcept {
// client.dll; 48 89 5C 24 08 48 89 74 24 10 57 48 83 EC 30 48 8B 01 48 8B F1 41 B0 01 48 8D 4C 24 20 48 8B FA 48 8B 98
static const auto fn{
CLIENT::m_get_player_event_pawn_from_id.as< void*( CS2_FASTCALL* ) ( void*, const char*, std::int64_t ) >( )
};
return fn( this, event_name.data( ), 0 );
}
void* events_t::get_pointer_from_id( const std::string_view event_name ) noexcept {
// used: "userid", "attackerid"
std::int64_t id{ };
{
// client.dll; 48 89 5C 24 08 48 89 6C 24 10 48 89 74 24 18 57 48 83 EC 30 48 8B 01 49
static const auto fn{ CLIENT::m_get_export_event_value
.as< std::int64_t( CS2_FASTCALL* )( void*, std::int64_t*, const char* ) >( ) };
fn( this, &id, event_name.data( ) );
}
if ( id == -1 )
return { };
// xref: "player_disconnect"
// client.dll; E8 ?? ?? ?? ?? 48 8B 0D ?? ?? ?? ?? 48 8B D8 48 85 C9
static const auto fn{ CLIENT::m_get_event_pointer_from_id.as< void*( CS2_FASTCALL* ) ( std::int64_t ) >( ) };
return fn( id );
}
} // namespace hack::cs2
C++:
// client.dll; 40 55 53 41 55 41 57 48 8D AC 24 ?? ?? ?? ?? 48 81 EC ?? ?? ?? ?? 48 8B 02
// xref: "winpanel-basic-round-result-visible"
void CS2_FASTCALL c_hooks::client_t::handle_events( void* rcx, cs2::events_t* const event ) {
static const auto original{ /* input ur stff */ };
switch ( const char* event_name{ event->get_name( ) }; HASH( event_name ) ) {
case HASH( "player_hurt" ): {
if ( const cs2::player_controller_t* local_controller{ cs2::entity::get_local_player_controller( ) } ) {
if ( const cs2::player_controller_t* controller{ event->get_player_controller( "attacker" ) };
controller == local_controller ) {
const std::int64_t value{ event->get_int( "dmg_health" ) };
// todo: do whatever you want to do here now, enjoy it.
}
}
} break;
default:
break;
}
original( pawn, event );
}
Последнее редактирование: