From 7ccb819f867493f8ec202ea3b39c94c198c64584 Mon Sep 17 00:00:00 2001 From: JustSomePwner Date: Thu, 30 Aug 2018 14:01:54 +0200 Subject: first --- gmod/create_move.cpp | 87 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 gmod/create_move.cpp (limited to 'gmod/create_move.cpp') diff --git a/gmod/create_move.cpp b/gmod/create_move.cpp new file mode 100644 index 0000000..c25d0c5 --- /dev/null +++ b/gmod/create_move.cpp @@ -0,0 +1,87 @@ +#include + +#include "hooks.hpp" +#include "mem.hpp" +#include "interface.hpp" +#include "context.hpp" +#include "input_system.hpp" +#include "math.hpp" + +#include "base_cheat.hpp" + + +bool __fastcall hooks::create_move( void* ecx_, void* edx_, float input_sample_frametime, user_cmd_t* ucmd ) { + static auto create_move_o = g_gmod.m_clientmode->get_old_function< decltype( &hooks::create_move ) >( 21 ); + + // call from CInput::ExtraMouseSample with dummy cmd. + if( !ucmd->m_cmd_nr || !ucmd->m_tick_count || g_gmod.m_panic ) + return create_move_o( ecx_, 0, input_sample_frametime, ucmd ); + + // for interfacing with lua related stuff. + g_ctx.m_lua = g_gmod.m_lua_shared( )->GetLuaInterface( LUA_CLIENT ); + if( !g_ctx.m_lua ) + return create_move_o( ecx_, 0, input_sample_frametime, ucmd ); + + // random_seed isn't generated in ClientMode::CreateMove yet (since CInput::CreateMove handles that), we must generate it ourselves. + ucmd->m_random_seed = math::md5_pseudorandom( ucmd->m_cmd_nr ) & 0x7fffffff; + + //get sendpacket off the stack + stack_t stack( get_baseptr( ) ); + byte *send_packet = stack.next( ).next( ).next( ).local< byte* >( 0x1 ); + + g_ctx.create_snapshot( ucmd ); + + //return create_move_o( ecx_, 0, input_sample_frametime, ucmd ); + + /* + g_cheat.m_extra.update_netchannel( ); + g_cheat.m_identity( ); + */ + + if( g_ctx.run_frame( ) && g_ctx.m_local->is_alive( ) ) { + static int last_frame = g_gmod.m_globals->m_framecount; + if( last_frame != g_gmod.m_globals->m_framecount ) + g_ctx.m_has_fired_this_frame = false; + + last_frame = g_gmod.m_globals->m_framecount; + + // hook fire bullets for spread compensation. + if( !fire_bullets_o ) { + fire_bullets_o = decltype( &hooks::fire_bullets )( c_vmt::hook_method( g_ctx.m_local, 16, hooks::fire_bullets ) ); + } + + g_cheat.m_prediction( ucmd ); + g_cheat.m_movement( ucmd ); + + g_cheat.m_lagmgr( ucmd, send_packet ); + + g_cheat.m_aimbot( ucmd ); + + //if( auto weapon = g_ctx.m_local->get_weapon( ) ) { + // if( auto c_class = weapon->ce( )->GetClientClass( ) ) { + // g_con->print( "%s\n", c_class->m_name ); + // } + //} + + g_cheat.m_extra.use_spammer( ucmd ); + + if( g_cheat.m_lagmgr.get_choked( ) > 15 ) { + g_cheat.m_lagmgr.set_state( true ); + } + + g_cheat.m_lagmgr.on_cmove_end( ); + + g_ctx.on_cmove_end( ucmd ); + + ucmd->clamp( ); + // call original *after* any changes due to anticheats detecting changes between this and any changes after. + create_move_o( ecx_, 0, input_sample_frametime, ucmd ); + + g_cheat.m_aimbot.silent( ); + } + else { + create_move_o( ecx_, 0, input_sample_frametime, ucmd ); + } + + return false; +} -- cgit v1.2.3