#include "hack.h" #include "../menu.h" struct CMD_TOGGLE { const char* name; const char* desc; SETTING& var; }; void hack_toggle( CMD_TOGGLE cmd ) { con_clear(); cmd.var = !cmd.var; menu_pages[menu_page].page_fn(); show_paging( menu_page ); } #define gcon_match( name ) !strncmp( buf + 1, name, strlen( name ) ) #define gcon_var( string ) { 0, strlen( string ) + 1, ( void* )string } void __cdecl game_hack_toggle( VECTOR> args ) { static SETTING& bhop_active = *settings.find( "bhop_active"fnv ); static SETTING& chams_active = *settings.find( "chams_active"fnv ); static SETTING& glow_active = *settings.find( "glow_active"fnv ); static SETTING& nightmode_active = *settings.find( "nightmode_active"fnv ); static SETTING& noflash_active = *settings.find( "noflash_active"fnv ); static SETTING& clantag_active = *settings.find( "clantag_active"fnv ); static SETTING& aim_active = *settings.find( "aim_active"fnv ); static SETTING& crosshair_active = *settings.find( "crosshair_active"fnv ); static SETTING& rcs_active = *settings.find( "rcs_active"fnv ); static SETTING& triggerteam_active = *settings.find( "triggerteam_active"fnv ); char buf[512]{}; for( auto& it : args ) sprintf( buf, "%s\n%s", buf, it.data ); CMD_TOGGLE cmd_toggle[10] = { { "hg_bhop" , "toggles aim assist", bhop_active }, { "hg_chams" , "toggles bhop", chams_active }, { "hg_glow" , "toggles chams", glow_active }, { "hg_night" , "toggles clantag", nightmode_active }, { "hg_flash" , "toggles no flash", noflash_active }, { "hg_clan" , "toggles glow", clantag_active }, { "hg_aim" , "toggles nightmode", aim_active }, { "hg_xhair" , "toggles standalone rcs", crosshair_active }, { "hg_rcs" , "toggles team triggerbot", rcs_active }, { "hg_triggerteam", "toggles recoil crosshair", triggerteam_active } }; for( const auto& cmd : cmd_toggle ) { if( gcon_match( cmd.name ) ) { hack_toggle( cmd ); return; } } if( gcon_match( "hg_help" ) ) { const HWND hconsole = FindWindowA( "Valve001", 0 ); if( !hconsole ) return; u_sleep( 1 * T_SEC / 5 ); for( auto& cmd : cmd_toggle ) { sprintf( buf, "echo \"%s : %s\"", cmd.name, cmd.desc ); COPYDATASTRUCT hconsole_out; hconsole_out.cbData = strlen( buf ) + 1; hconsole_out.dwData = 0; hconsole_out.lpData = ( void* )buf; SendMessageA( hconsole, WM_COPYDATA, 0, ( LPARAM )&hconsole_out ); u_sleep( 1 * T_SEC / 20 ); } return; } const HWND hconsole = FindWindowA( "Valve001", 0 ); if( !hconsole ) return; COPYDATASTRUCT hconsole_out; hconsole_out.cbData = strlen( "echo \"invalid cmd, use \'hg_help\' for cmd list\"" ) + 1; hconsole_out.dwData = 0; hconsole_out.lpData = ( void* )"echo \"invalid cmd, use \'hg_help\' for cmd list\""; SendMessageA( hconsole, WM_COPYDATA, 0, ( LPARAM )&hconsole_out ); return; }