summaryrefslogtreecommitdiff
path: root/internal_rewrite/extra.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'internal_rewrite/extra.cpp')
-rw-r--r--internal_rewrite/extra.cpp25
1 files changed, 13 insertions, 12 deletions
diff --git a/internal_rewrite/extra.cpp b/internal_rewrite/extra.cpp
index d67b0d7..fa0882a 100644
--- a/internal_rewrite/extra.cpp
+++ b/internal_rewrite/extra.cpp
@@ -4,6 +4,7 @@
#include "math.hpp"
#include "hooks.hpp"
#include "interface.hpp"
+#include "detours.h"
#undef min
@@ -109,8 +110,9 @@ namespace features
break;
}
+ static bool enabled = false;
auto clientstate = g_csgo.m_global_state->get_client_state( );
- if( clientstate ) {
+ if( clientstate && !enabled ) {
// TODO: Change this to the non-homosexual way of hooking CNetChan functions.
// Actually, I'm too lazy. You can do this if you want.
/*
@@ -123,14 +125,8 @@ namespace features
*/
auto netchannel = clientstate->m_netchannel;
if( netchannel ) {
- auto old_netchannel = g_csgo.m_net_channel( );
-
- if( old_netchannel != netchannel ||
- ( old_netchannel &&
- g_csgo.m_net_channel->get_function< void* >( 46 ) != &hooks::send_datagram ) ) {
- g_csgo.m_net_channel( netchannel );
- g_csgo.m_net_channel->hook( 46, &hooks::send_datagram );
- }
+ hooks::send_datagram_o = memory::detours.create_hook( &hooks::send_datagram, g_csgo.m_net_channel->get_old_function< void* >( 46 ) );
+ enabled = true;
}
}
}
@@ -232,11 +228,16 @@ namespace features
int def_index = weapon->m_iItemDefinitionIndex( );
if( def_index != WEAPON_R8REVOLVER ) return;
- if( !g_ctx.m_local->can_attack( ) ) {
+ static float next_time = 0.f;
+
+ auto time = g_ctx.pred_time( );
+ if( g_ctx.m_local->can_attack( ) && next_time >= time ) {
+ g_ctx.m_revolver_shot = false;
cmd->m_buttons |= IN_ATTACK;
}
- else if( !g_cheat.m_lagmgr.get_sent( ) ) {
- g_cheat.m_lagmgr.set_state( true );
+ else {
+ next_time = time + 0.234375f;
+ g_ctx.m_revolver_shot = true;
}
}