What's new

Welcome to HvH Forum!

SignUp Now! Download Free HvH CS2/CS:GO Cheats, CFG, LUA/JS Scripts, And More!


SignUp Now!
Expert HvHer
User ID
43664
Messages
21
Reactions
239
Level
11
This is a repost of a topic from another forum, I believe that this is the correct code and someone will need it, so I am reposting to this forum.


Thread credit: @william1337

class:
class c_base_grenade_projectile {
public:
    DWORD* dword0{};
private:
    char gap4[ 168 ];
public:
    c_vec3 m_local_origin{};
private:
    char gapB8[ 10476 ];
public:
    c_glow_object* m_glow_object{};
private:
    char gap29A8[ 96 ];
public:
    c_vec3 m_last_trail_line_pos{};
    float m_next_trail_line_time{};
};


hook:
//module: client.dll; sig: 55 8B EC 83 E4 F8 83 EC 68 56 8B F1 8B 4D
void __fastcall hooks::hk_create_grenade_trail( void* ecx, void* edx ) {
    const auto this_pointer = static_cast< c_base_grenade_projectile* >( ecx );
    if ( !ctx::local( ) || !this_pointer )
        return;

    if ( this_pointer->m_next_trail_line_time > i::m_globals->m_current_time )
        return;

    qangle_t grenade_traj_angles;
    c_vec3 temp_orientation = ( this_pointer->m_last_trail_line_pos - this_pointer->m_local_origin );
    math::vector_angles( temp_orientation, grenade_traj_angles );

    static const auto sv_grenade_trajectory_thickness = i::m_cvar->find_var( _( "sv_grenade_trajectory_thickness" ) );
    static const auto sv_grenade_trajectory_dash = i::m_cvar->find_var( _( "sv_grenade_trajectory_dash" ) );
    static const auto sv_grenade_trajectory_time_spectator = i::m_cvar->find_var( _( "sv_grenade_trajectory_time_spectator" ) );

    const auto grenade_traj_thickness = sv_grenade_trajectory_thickness->get_float( );
    const auto grenade_traj_min = c_vec3{ 0.0f, -grenade_traj_thickness, -grenade_traj_thickness };
    const auto grenade_traj_max = c_vec3{ temp_orientation.length( ), grenade_traj_thickness, grenade_traj_thickness };

    const auto team = *reinterpret_cast< int* >( reinterpret_cast< std::uintptr_t >( this_pointer->dword0 ) + 0xF4 );
    
    c_color trace_color;
    trace_color.set_color( team == team_ct ? 114, 155, 221 : 224, 175, 86 );

    if ( sv_grenade_trajectory_dash->get_int( ) && std::fmod( i::m_globals->m_current_time, 0.1f ) < 0.05f ) {
        trace_color[ 0 ] /= 10;
        trace_color[ 1 ] /= 10;
        trace_color[ 2 ] /= 10;
    }

    i::m_glow_manager->add_glow_box( this_pointer->m_local_origin, grenade_traj_angles, grenade_traj_min, grenade_traj_max, trace_color, sv_grenade_trajectory_time_spectator->get_float( ), i::m_globals->m_current_time );
    this_pointer->m_last_trail_line_pos = this_pointer->m_local_origin;
    this_pointer->m_next_trail_line_time = i::m_globals->m_current_time + 0.05f;
}

 
I'm not Plisskien
Administrator
User ID
1
Messages
1,408
Reactions
3,891
Level
99
This is a repost of a topic from another forum, I believe that this is the correct code and someone will need it, so I am reposting to this forum.


Thread credit: @william1337

class:
class c_base_grenade_projectile {
public:
    DWORD* dword0{};
private:
    char gap4[ 168 ];
public:
    c_vec3 m_local_origin{};
private:
    char gapB8[ 10476 ];
public:
    c_glow_object* m_glow_object{};
private:
    char gap29A8[ 96 ];
public:
    c_vec3 m_last_trail_line_pos{};
    float m_next_trail_line_time{};
};


hook:
//module: client.dll; sig: 55 8B EC 83 E4 F8 83 EC 68 56 8B F1 8B 4D
void __fastcall hooks::hk_create_grenade_trail( void* ecx, void* edx ) {
    const auto this_pointer = static_cast< c_base_grenade_projectile* >( ecx );
    if ( !ctx::local( ) || !this_pointer )
        return;

    if ( this_pointer->m_next_trail_line_time > i::m_globals->m_current_time )
        return;

    qangle_t grenade_traj_angles;
    c_vec3 temp_orientation = ( this_pointer->m_last_trail_line_pos - this_pointer->m_local_origin );
    math::vector_angles( temp_orientation, grenade_traj_angles );

    static const auto sv_grenade_trajectory_thickness = i::m_cvar->find_var( _( "sv_grenade_trajectory_thickness" ) );
    static const auto sv_grenade_trajectory_dash = i::m_cvar->find_var( _( "sv_grenade_trajectory_dash" ) );
    static const auto sv_grenade_trajectory_time_spectator = i::m_cvar->find_var( _( "sv_grenade_trajectory_time_spectator" ) );

    const auto grenade_traj_thickness = sv_grenade_trajectory_thickness->get_float( );
    const auto grenade_traj_min = c_vec3{ 0.0f, -grenade_traj_thickness, -grenade_traj_thickness };
    const auto grenade_traj_max = c_vec3{ temp_orientation.length( ), grenade_traj_thickness, grenade_traj_thickness };

    const auto team = *reinterpret_cast< int* >( reinterpret_cast< std::uintptr_t >( this_pointer->dword0 ) + 0xF4 );
   
    c_color trace_color;
    trace_color.set_color( team == team_ct ? 114, 155, 221 : 224, 175, 86 );

    if ( sv_grenade_trajectory_dash->get_int( ) && std::fmod( i::m_globals->m_current_time, 0.1f ) < 0.05f ) {
        trace_color[ 0 ] /= 10;
        trace_color[ 1 ] /= 10;
        trace_color[ 2 ] /= 10;
    }

    i::m_glow_manager->add_glow_box( this_pointer->m_local_origin, grenade_traj_angles, grenade_traj_min, grenade_traj_max, trace_color, sv_grenade_trajectory_time_spectator->get_float( ), i::m_globals->m_current_time );
    this_pointer->m_last_trail_line_pos = this_pointer->m_local_origin;
    this_pointer->m_next_trail_line_time = i::m_globals->m_current_time + 0.05f;
}

cool, ty for post
 
Rookie HvHer
User ID
17369
Messages
36
Reactions
21
Level
5
WHY DO PEOPLE REPOST YOUGAME THREADS JUST USE YOUGAME
 
Newbie HvHer
User ID
12344
Messages
2
Reactions
0
Level
1
Hooking any game's nade projection function for this is far away from being proper.
Trace it on your own.
 

Create an account or login to comment

You must be a member in order to leave a comment

Create account

Create an account on our community. It's easy!

Log in

Already have an account? Log in here.

Top