|
You last visited: Today at 18:36
Advertisement
[REQUEST] 🔥 Speed Counter Macro
Discussion on [REQUEST] 🔥 Speed Counter Macro within the S4 League forum part of the Shooter category.
01/03/2017, 19:14
|
#1
|
elite*gold: 80
Join Date: Dec 2013
Posts: 434
Received Thanks: 327
|
[REQUEST] 🔥 Speed Counter Macro
Hi,
I am searching a Dagger Cancel Macro Script.
It should cancel the dagger hit obv. . It doesnt need to be especially for the Mouse.
I only need the Script, or the speed for each function.
Please share if you have one, because everyone I do is to fast or to slow.
Thanks.
|
|
|
01/04/2017, 18:34
|
#2
|
elite*gold: 225
Join Date: Sep 2014
Posts: 334
Received Thanks: 460
|
Here's a little "script":
key_codes
key_codes.hpp
Code:
#pragma once
#include <string>
extern const char* arr[ ];
class VirtualKeyParser
{
public:
static std::string parse_virtual_key( int key_code );
};
key_codes.cpp
Code:
#include "key_codes.hpp"
const char* arr[ ] = {
0,
"Left mouse button",
"Right mouse button",
"Control-break",
"Middle mouse button",
"X1 mouse button (ext.)",
"X2 mouse button (ext.)",
0,
"Backspace",
"Tab",
0,
0,
"Clear",
"Enter/Return",
0,
0,
"Shift",
"Control",
"Alt",
"Pause",
"Caps lock",
0,
0,
0,
0,
0,
0,
0,
0,
0,
"Escape",
0,
0,
0,
0,
"Spacebar",
"Page up",
"Page down",
"End",
"Home",
"Left arrow",
"Up arrow",
"Right arrow",
"Down arrow",
"Select",
"Print",
"Execute",
"Print screen",
"Insert",
"Delete",
"Help",
"0", "1", "2", "3", "4", "5", "6", "7", "8", "9",
0,0,0,0,0,0,0,
"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P",
"Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z",
"Left Windows key",
"Right Windows key",
"Applications key",
0,
"Sleep key",
"Num0", "Num1", "Num2", "Num3", "Num4", "Num5", "Num6", "Num7", "Num8", "Num9",
"Multiply key",
"Add key",
"Separator key",
"Subtract key",
"Decimal key",
"Divide key",
"F1", "F2", "F3", "F4", "F5", "F6", "F7", "F8", "F9", "F10", "F11", "F12", "F13",
"F14", "F15", "F16", "F17", "F18", "F19", "F20", "F21", "F22", "F23", "F24",
0, 0, 0, 0, 0, 0, 0, 0,
"Num lock",
"Scroll lock",
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
"Left shift",
"Right shift",
"Left control",
"Right control",
"Left alt",
"Right alt"
};
std::string VirtualKeyParser::parse_virtual_key( int key_code )
{
return arr[ key_code ];
}
utils
utils.hpp
Code:
#pragma once
#include <Windows.h>
#include <string>
namespace utils
{
HWND get_proc_hwnd( );
bool keys_released( );
bool get_pressed_key( uint32_t& key );
bool button_clicked( uint32_t key );
void key_down_up( INPUT& input, uint32_t key, uint32_t delay );
}
utils.cpp
Code:
#include "utils.hpp"
namespace utils
{
HWND tmp = 0;
BOOL CALLBACK enumProc( __in HWND hWnd, __in LPARAM lParam )
{
DWORD proc_id = 0;
if ( GetWindowThreadProcessId( hWnd, &proc_id ) == GetCurrentProcessId( ) )
tmp = hWnd;
return TRUE;
}
HWND get_proc_hwnd( )
{
auto status = EnumWindows( enumProc, 0 );
if ( status )
return tmp;
return 0;
}
bool keys_released( )
{
for ( int i = 0; i <= 0xFE; i++ )
if ( GetAsyncKeyState( i ) )
return false;
return true;
}
bool get_pressed_key( uint32_t& key )
{
for ( int i = 0; i <= 0xFE; i++ )
{
if ( GetAsyncKeyState( i ) )
{
key = i;
return true;
}
}
return false;
}
bool button_clicked( uint32_t key )
{
static bool isDown = false, isClicked = false;
static uint32_t oldKey = key;
if ( oldKey != key )
isDown = false, isClicked = false;
if ( GetAsyncKeyState( key ) )
isDown = true;
else if ( isDown )
{
isDown = false;
isClicked = true;
}
else
{
isDown = false;
isClicked = false;
}
return isClicked;
}
void key_down_up( INPUT& input, uint32_t key, uint32_t delay )
{
input.ki.wVk = key;
input.ki.dwFlags = 0;
SendInput( 1, &input, sizeof( INPUT ) );
Sleep( delay );
input.ki.dwFlags = KEYEVENTF_KEYUP;
SendInput( 1, &input, sizeof( INPUT ) );
Sleep( delay );
}
}
main
common_includes.hpp
Code:
#pragma once
#include <Windows.h>
#include <cstdint>
#include <process.h>
#include <TlHelp32.h>
#include <string>
#include <algorithm>
#include <iostream>
#include <boost/algorithm/string.hpp>
#include <memory>
main.cpp
Code:
#include "common_includes.hpp"
#include "key_codes.hpp"
#include "utils.hpp"
std::string gen_random_string( std::size_t length )
{
std::string alpha_lower = "abcdefghijklmnopqrstuvwxyz", ret;
auto alpha_upper = boost::to_upper_copy( alpha_lower );
for ( decltype( length ) i = 0; i < length; i++ )
{
auto what_to_choose_from = ( rand( ) % 2 == 0 ) ? alpha_lower : alpha_upper;
ret += what_to_choose_from[ rand( ) % what_to_choose_from.length( ) ];
}
return ret;
}
struct sc_bot_arglist
{
uint32_t cs_slot, delay, button;
};
void sc_bot( void* arglist )
{
auto args = static_cast< sc_bot_arglist* >( arglist );
uint32_t cs_slot_key = 0;
switch ( args->cs_slot )
{
case 1:
cs_slot_key = 0x31;
break;
case 2:
cs_slot_key = 0x32;
break;
case 3:
cs_slot_key = 0x33;
break;
default:
std::cout << "wat?" << std::endl;
}
INPUT input_keyboard;
input_keyboard.type = INPUT_KEYBOARD;
input_keyboard.ki.wScan = 0;
input_keyboard.ki.time = 0;
input_keyboard.ki.dwExtraInfo = 0;
bool isDown = false, isClicked = false;
while ( true )
{
if ( GetAsyncKeyState( args->button ) )
isDown = true;
else if ( isDown )
{
isDown = false;
isClicked = true;
}
else
{
isDown = false;
isClicked = false;
}
if ( isClicked )
{
utils::key_down_up( input_keyboard, cs_slot_key, args->delay );
utils::key_down_up( input_keyboard, VK_SPACE, args->delay );
input_keyboard.ki.wVk = 'A';
input_keyboard.ki.dwFlags = 0;
SendInput( 1, &input_keyboard, sizeof( INPUT ) );
input_keyboard.ki.wVk = VK_SPACE;
input_keyboard.ki.dwFlags = 0;
SendInput( 1, &input_keyboard, sizeof( INPUT ) );
Sleep( args->delay );
input_keyboard.ki.wVk = VK_SPACE;
input_keyboard.ki.dwFlags = KEYEVENTF_KEYUP;
SendInput( 1, &input_keyboard, sizeof( INPUT ) );
input_keyboard.ki.wVk = 'A';
input_keyboard.ki.dwFlags = KEYEVENTF_KEYUP;
SendInput( 1, &input_keyboard, sizeof( INPUT ) );
Sleep( args->delay );
input_keyboard.ki.wVk = VK_RBUTTON;
input_keyboard.ki.dwFlags = 0;
SendInput( 1, &input_keyboard, sizeof( INPUT ) );
Sleep( 400 );
input_keyboard.ki.wVk = VK_RBUTTON;
input_keyboard.ki.dwFlags = KEYEVENTF_KEYUP;
SendInput( 1, &input_keyboard, sizeof( INPUT ) );
}
Sleep( 10 );
}
}
int main( )
{
uint32_t cs_slot, delay, macro_button;
srand( static_cast< unsigned int >( time( nullptr ) ) );
SetConsoleTitleA( gen_random_string( 44 ).c_str( ) );
std::cout << "CS Slot (1-3): ";
std::cin >> cs_slot;
if ( cs_slot < 1 || cs_slot > 3 )
{
std::cout << "Inavlid slot id." << std::endl;
Sleep( 1000 );
TerminateProcess( GetCurrentProcess( ), 0 );
}
std::cout << "Delay (in ms): ";
std::cin >> delay;
std::cout << "Assign button (Press any button): ";
while ( !utils::keys_released( ) )
Sleep( 10 );
while ( !utils::get_pressed_key( macro_button ) )
Sleep( 10 );
std::cout << VirtualKeyParser::parse_virtual_key( macro_button ) << std::endl;
std::cout << "\nMacro successfully setup. Go ingame now. (Press F3 to terminate)\n\n";
ShowWindow( utils::get_proc_hwnd( ), SW_MINIMIZE );
auto args = std::shared_ptr<sc_bot_arglist>( new sc_bot_arglist( ) );
args->cs_slot = cs_slot;
args->delay = delay;
args->button = macro_button;
_beginthread( sc_bot, 0, args.get( ) );
bool isDown = false, isClicked = false;
while ( true )
{
if ( GetAsyncKeyState( VK_F3 ) )
isDown = true;
else if ( isDown )
{
isDown = false;
isClicked = true;
}
else
{
isDown = false;
isClicked = false;
}
if ( isClicked )
{
TerminateProcess( GetCurrentProcess( ), 0 );
}
Sleep( 10 );
}
}
|
|
|
01/04/2017, 21:25
|
#3
|
elite*gold: 80
Join Date: Dec 2013
Posts: 434
Received Thanks: 327
|
Quote:
Originally Posted by Cyrex'
Here's a little "script":
key_codes
key_codes.hpp
Code:
#pragma once
#include <string>
extern const char* arr[ ];
class VirtualKeyParser
{
public:
static std::string parse_virtual_key( int key_code );
};
key_codes.cpp
Code:
#include "key_codes.hpp"
const char* arr[ ] = {
0,
"Left mouse button",
"Right mouse button",
"Control-break",
"Middle mouse button",
"X1 mouse button (ext.)",
"X2 mouse button (ext.)",
0,
"Backspace",
"Tab",
0,
0,
"Clear",
"Enter/Return",
0,
0,
"Shift",
"Control",
"Alt",
"Pause",
"Caps lock",
0,
0,
0,
0,
0,
0,
0,
0,
0,
"Escape",
0,
0,
0,
0,
"Spacebar",
"Page up",
"Page down",
"End",
"Home",
"Left arrow",
"Up arrow",
"Right arrow",
"Down arrow",
"Select",
"Print",
"Execute",
"Print screen",
"Insert",
"Delete",
"Help",
"0", "1", "2", "3", "4", "5", "6", "7", "8", "9",
0,0,0,0,0,0,0,
"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P",
"Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z",
"Left Windows key",
"Right Windows key",
"Applications key",
0,
"Sleep key",
"Num0", "Num1", "Num2", "Num3", "Num4", "Num5", "Num6", "Num7", "Num8", "Num9",
"Multiply key",
"Add key",
"Separator key",
"Subtract key",
"Decimal key",
"Divide key",
"F1", "F2", "F3", "F4", "F5", "F6", "F7", "F8", "F9", "F10", "F11", "F12", "F13",
"F14", "F15", "F16", "F17", "F18", "F19", "F20", "F21", "F22", "F23", "F24",
0, 0, 0, 0, 0, 0, 0, 0,
"Num lock",
"Scroll lock",
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
"Left shift",
"Right shift",
"Left control",
"Right control",
"Left alt",
"Right alt"
};
std::string VirtualKeyParser::parse_virtual_key( int key_code )
{
return arr[ key_code ];
}
utils
utils.hpp
Code:
#pragma once
#include <Windows.h>
#include <string>
namespace utils
{
HWND get_proc_hwnd( );
bool keys_released( );
bool get_pressed_key( uint32_t& key );
bool button_clicked( uint32_t key );
void key_down_up( INPUT& input, uint32_t key, uint32_t delay );
}
utils.cpp
Code:
#include "utils.hpp"
namespace utils
{
HWND tmp = 0;
BOOL CALLBACK enumProc( __in HWND hWnd, __in LPARAM lParam )
{
DWORD proc_id = 0;
if ( GetWindowThreadProcessId( hWnd, &proc_id ) == GetCurrentProcessId( ) )
tmp = hWnd;
return TRUE;
}
HWND get_proc_hwnd( )
{
auto status = EnumWindows( enumProc, 0 );
if ( status )
return tmp;
return 0;
}
bool keys_released( )
{
for ( int i = 0; i <= 0xFE; i++ )
if ( GetAsyncKeyState( i ) )
return false;
return true;
}
bool get_pressed_key( uint32_t& key )
{
for ( int i = 0; i <= 0xFE; i++ )
{
if ( GetAsyncKeyState( i ) )
{
key = i;
return true;
}
}
return false;
}
bool button_clicked( uint32_t key )
{
static bool isDown = false, isClicked = false;
static uint32_t oldKey = key;
if ( oldKey != key )
isDown = false, isClicked = false;
if ( GetAsyncKeyState( key ) )
isDown = true;
else if ( isDown )
{
isDown = false;
isClicked = true;
}
else
{
isDown = false;
isClicked = false;
}
return isClicked;
}
void key_down_up( INPUT& input, uint32_t key, uint32_t delay )
{
input.ki.wVk = key;
input.ki.dwFlags = 0;
SendInput( 1, &input, sizeof( INPUT ) );
Sleep( delay );
input.ki.dwFlags = KEYEVENTF_KEYUP;
SendInput( 1, &input, sizeof( INPUT ) );
Sleep( delay );
}
}
main
common_includes.hpp
Code:
#pragma once
#include <Windows.h>
#include <cstdint>
#include <process.h>
#include <TlHelp32.h>
#include <string>
#include <algorithm>
#include <iostream>
#include <boost/algorithm/string.hpp>
#include <memory>
main.cpp
Code:
#include "common_includes.hpp"
#include "key_codes.hpp"
#include "utils.hpp"
std::string gen_random_string( std::size_t length )
{
std::string alpha_lower = "abcdefghijklmnopqrstuvwxyz", ret;
auto alpha_upper = boost::to_upper_copy( alpha_lower );
for ( decltype( length ) i = 0; i < length; i++ )
{
auto what_to_choose_from = ( rand( ) % 2 == 0 ) ? alpha_lower : alpha_upper;
ret += what_to_choose_from[ rand( ) % what_to_choose_from.length( ) ];
}
return ret;
}
struct sc_bot_arglist
{
uint32_t cs_slot, delay, button;
};
void sc_bot( void* arglist )
{
auto args = static_cast< sc_bot_arglist* >( arglist );
uint32_t cs_slot_key = 0;
switch ( args->cs_slot )
{
case 1:
cs_slot_key = 0x31;
break;
case 2:
cs_slot_key = 0x32;
break;
case 3:
cs_slot_key = 0x33;
break;
default:
std::cout << "wat?" << std::endl;
}
INPUT input_keyboard;
input_keyboard.type = INPUT_KEYBOARD;
input_keyboard.ki.wScan = 0;
input_keyboard.ki.time = 0;
input_keyboard.ki.dwExtraInfo = 0;
bool isDown = false, isClicked = false;
while ( true )
{
if ( GetAsyncKeyState( args->button ) )
isDown = true;
else if ( isDown )
{
isDown = false;
isClicked = true;
}
else
{
isDown = false;
isClicked = false;
}
if ( isClicked )
{
utils::key_down_up( input_keyboard, cs_slot_key, args->delay );
utils::key_down_up( input_keyboard, VK_SPACE, args->delay );
input_keyboard.ki.wVk = 'A';
input_keyboard.ki.dwFlags = 0;
SendInput( 1, &input_keyboard, sizeof( INPUT ) );
input_keyboard.ki.wVk = VK_SPACE;
input_keyboard.ki.dwFlags = 0;
SendInput( 1, &input_keyboard, sizeof( INPUT ) );
Sleep( args->delay );
input_keyboard.ki.wVk = VK_SPACE;
input_keyboard.ki.dwFlags = KEYEVENTF_KEYUP;
SendInput( 1, &input_keyboard, sizeof( INPUT ) );
input_keyboard.ki.wVk = 'A';
input_keyboard.ki.dwFlags = KEYEVENTF_KEYUP;
SendInput( 1, &input_keyboard, sizeof( INPUT ) );
Sleep( args->delay );
input_keyboard.ki.wVk = VK_RBUTTON;
input_keyboard.ki.dwFlags = 0;
SendInput( 1, &input_keyboard, sizeof( INPUT ) );
Sleep( 400 );
input_keyboard.ki.wVk = VK_RBUTTON;
input_keyboard.ki.dwFlags = KEYEVENTF_KEYUP;
SendInput( 1, &input_keyboard, sizeof( INPUT ) );
}
Sleep( 10 );
}
}
int main( )
{
uint32_t cs_slot, delay, macro_button;
srand( static_cast< unsigned int >( time( nullptr ) ) );
SetConsoleTitleA( gen_random_string( 44 ).c_str( ) );
std::cout << "CS Slot (1-3): ";
std::cin >> cs_slot;
if ( cs_slot < 1 || cs_slot > 3 )
{
std::cout << "Inavlid slot id." << std::endl;
Sleep( 1000 );
TerminateProcess( GetCurrentProcess( ), 0 );
}
std::cout << "Delay (in ms): ";
std::cin >> delay;
std::cout << "Assign button (Press any button): ";
while ( !utils::keys_released( ) )
Sleep( 10 );
while ( !utils::get_pressed_key( macro_button ) )
Sleep( 10 );
std::cout << VirtualKeyParser::parse_virtual_key( macro_button ) << std::endl;
std::cout << "\nMacro successfully setup. Go ingame now. (Press F3 to terminate)\n\n";
ShowWindow( utils::get_proc_hwnd( ), SW_MINIMIZE );
auto args = std::shared_ptr<sc_bot_arglist>( new sc_bot_arglist( ) );
args->cs_slot = cs_slot;
args->delay = delay;
args->button = macro_button;
_beginthread( sc_bot, 0, args.get( ) );
bool isDown = false, isClicked = false;
while ( true )
{
if ( GetAsyncKeyState( VK_F3 ) )
isDown = true;
else if ( isDown )
{
isDown = false;
isClicked = true;
}
else
{
isDown = false;
isClicked = false;
}
if ( isClicked )
{
TerminateProcess( GetCurrentProcess( ), 0 );
}
Sleep( 10 );
}
}
|
Ich meine ein Script sowas wie AutoHotkey xd
|
|
|
01/05/2017, 11:00
|
#4
|
elite*gold: 225
Join Date: Sep 2014
Posts: 334
Received Thanks: 460
|
Quote:
Originally Posted by Shin..
Ich meine ein Script sowas wie AutoHotkey xd
|
Wieso? Das hier funktioniert genauso gut.
|
|
|
01/05/2017, 15:23
|
#5
|
elite*gold: 80
Join Date: Dec 2013
Posts: 434
Received Thanks: 327
|
Quote:
Originally Posted by Cyrex'
Wieso? Das hier funktioniert genauso gut. 
|
Wenn er undetected ist und ich verstehen könnte was du programmiert hast, brauche halt nur ein Script für das Logitech Programm oder AutoHotkey.
Aber sonst danke
|
|
|
01/05/2017, 15:50
|
#6
|
elite*gold: 225
Join Date: Sep 2014
Posts: 334
Received Thanks: 460
|
Quote:
Originally Posted by Shin..
Wenn er undetected ist und ich verstehen könnte was du programmiert hast, brauche halt nur ein Script für das Logitech Programm oder AutoHotkey.
Aber sonst danke
|
Einfach in ein Visual Studio Projekt pasten, Boost libraries einbinden und Strg+Shift+B drücken.
Kannst aber auch jeden anderen C++11 compiler verwenden.
|
|
|
01/05/2017, 20:09
|
#7
|
elite*gold: 80
Join Date: Dec 2013
Posts: 434
Received Thanks: 327
|
Quote:
Originally Posted by Cyrex'
Einfach in ein Visual Studio Projekt pasten, Boost libraries einbinden und Strg+Shift+B drücken.
Kannst aber auch jeden anderen C++11 compiler verwenden.
|
Danke habe Visual Studio aber verstehe trz nichts.
Würdest du das machen XDDD
Musst du aber nicht.
|
|
|
01/05/2017, 23:21
|
#8
|
elite*gold: 150
Join Date: Mar 2012
Posts: 144
Received Thanks: 119
|
Hier ein simples AHK Script Für SC (kann man natürlich auch für Maus Tastatur ETC benutzen)
LAlt::
Send [Space Down]
Sleep
Send [Space Up]
Sleep
Send [D Down]
Sleep
Send [RButton Down]
Sleep
Send [Space Down]
Sleep
Send [Space Up]
Sleep
Send [D Up]
Sleep
Send [RButton Up]
Sleep
Return
|
|
|
All times are GMT +1. The time now is 18:38.
|
|