15-10-2023, 20:56
(Modification du message : 15-10-2023, 21:00 par LPH Mikl32#0121.)
Nouvelle mise a jour du Tool
#include "pch.h"
#include <Windows.h>
#include <stdio.h>
#include <iostream>
#include <thread>
#include <chrono>
#include <Windows.h>
#include "HSV.h"
#include "Screen.h"
#include <iostream>
bool run_bot_thread = true;
#define VK_XBUTTON1 0x05
#ifdef _WIN32
#include <io.h>
#define access _access_s
#else
#include <unistd.h>
#endif
#define INAME L"VALORANT "
using namespace std;
int colorMode = 1;
HWND deeznuts;
#define isDown 0x8000
int get_screen_width(void) {
return GetSystemMetrics(SM_CXSCREEN);
}
int get_screen_height(void) {
return GetSystemMetrics(SM_CYSCREEN);
}
struct point {
double x;
double y;
point(double x, double y) : x(x), y(y) {}
};
inline bool is_color(int red, int green, int blue) {
if (colorMode == 1) { // Jaune
// Utilisez un tableau de plages de couleurs pour simplifier la vérification
static const int colorRanges[][6] = {
{170, 200, 165, 215, 25, 110},
{145, 170, 140, 165, 5, 55},
{200, 230, 200, 230, 0, 90},
{230, 255, 230, 255, 90, 190}
};
for (const auto& range : colorRanges) {
if (red >= range[0] && red <= range[1] &&
green >= range[2] && green <= range[3] &&
blue >= range[4] && blue <= range[5]) {
return true;
}
}
}
return false;
}
BYTE* screenData = nullptr;
bool run_threads = true;
const int screen_width = get_screen_width(), screen_height = get_screen_height();
void bot_thread(int w, int h) {
auto t_start = std::chrono::high_resolution_clock::now();
auto t_end = std::chrono::high_resolution_clock::now();
std::this_thread::sleep_for(std::chrono::milliseconds(1));
HDC hScreen = GetDC(NULL);
HBITMAP hBitmap = CreateCompatibleBitmap(hScreen, w, h);
screenData = (BYTE*)malloc(4 * w * h); // Utilisez 4 au lieu de 5 pour les octets par pixel (32 bits)
HDC hDC = CreateCompatibleDC(hScreen);
point middle_screen(screen_width / 2, screen_height / 2);
BITMAPINFOHEADER bmi = { 0 };
bmi.biSize = sizeof(BITMAPINFOHEADER);
bmi.biPlanes = 1;
bmi.biBitCount = 32;
bmi.biWidth = w;
bmi.biHeight = -h;
bmi.biCompression = BI_RGB;
bmi.biSizeImage = 0;
while (run_threads) {
Sleep(6);
HGDIOBJ old_obj = SelectObject(hDC, hBitmap);
BOOL bRet = BitBlt(hDC, 0, 0, w, h, hScreen, middle_screen.x - (w / 2), middle_screen.y - (h / 2), SRCCOPY);
SelectObject(hDC, old_obj);
GetDIBits(hDC, hBitmap, 0, h, screenData, (BITMAPINFO*)&bmi, DIB_RGB_COLORS);
for (int j = 0; j < h; ++j) {
for (int i = 0; i < w; ++i) { // Supprimez la multiplication par 4 ici
int index = (i + j * w) * 4; // Calculez l'index une seule fois
int red = screenData[index + 2];
int green = screenData[index + 1];
int blue = screenData[index];
if ((GetAsyncKeyState(VK_XBUTTON1) & isDown) && !(GetAsyncKeyState(VK_LBUTTON) & isDown)) {
if (is_color(red, green, blue)) {
if (GetAsyncKeyState('Z') & isDown) {
PostMessage(deeznuts, WM_KEYDOWN, 'S', 0);
PostMessage(deeznuts, WM_KEYDOWN, VK_LSHIFT, 0);
PostMessage(deeznuts, WM_LBUTTONDOWN, MK_LBUTTON, MAKELPARAM(0, 0));
Sleep(120);
PostMessage(deeznuts, WM_LBUTTONUP, 0, MAKELPARAM(0, 0));
PostMessage(deeznuts, WM_KEYUP, VK_LSHIFT, 0);
Sleep(0.01);;
PostMessage(deeznuts, WM_KEYUP, 'S', 0);
}
else if (GetAsyncKeyState('Q') & isDown) {
PostMessage(deeznuts, WM_KEYDOWN, 'D', 0);
PostMessage(deeznuts, WM_KEYDOWN, VK_LSHIFT, 0);
PostMessage(deeznuts, WM_LBUTTONDOWN, MK_LBUTTON, MAKELPARAM(0, 0));
Sleep(120);
PostMessage(deeznuts, WM_LBUTTONUP, 0, MAKELPARAM(0, 0));
PostMessage(deeznuts, WM_KEYUP, VK_LSHIFT, 0);
Sleep(0.01);
PostMessage(deeznuts, WM_KEYUP, 'D', 0);
}
else if (GetAsyncKeyState('D') & isDown) {
PostMessage(deeznuts, WM_KEYDOWN, 'Q', 0);
PostMessage(deeznuts, WM_KEYDOWN, VK_LSHIFT, 0);
PostMessage(deeznuts, WM_LBUTTONDOWN, MK_LBUTTON, MAKELPARAM(0, 0));
Sleep(120);
PostMessage(deeznuts, WM_LBUTTONUP, 0, MAKELPARAM(0, 0));
PostMessage(deeznuts, WM_KEYUP, VK_LSHIFT, 0);
Sleep(0.01);
PostMessage(deeznuts, WM_KEYUP, 'Q', 0);
}
else {
// Si aucune des touches Z, Q ou D n'est enfoncée, exécutez votre code existant ici
PostMessage(deeznuts, WM_KEYDOWN, VK_LSHIFT, 0);
Sleep(0.1);
PostMessage(deeznuts, WM_LBUTTONDOWN, MK_LBUTTON, MAKELPARAM(0, 0));
Sleep(120);
PostMessage(deeznuts, WM_LBUTTONUP, 0, MAKELPARAM(0, 0));
PostMessage(deeznuts, WM_KEYUP, VK_LSHIFT, 0);
Sleep(0.01);
}
}
}
else {
// Autre traitement si nécessaire
}
}
}
}
}
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) {
deeznuts = FindWindowW(NULL, INAME);
HDC nDC = GetDC(deeznuts);
string color;
int mode = 1;
AllocConsole();
AttachConsole(GetCurrentProcessId());
auto w_f = freopen("CON", "w", stdout);
auto r_f = freopen("CON", "r", stdin);
const int TARGET_FPS = 144;
const int FRAME_DELAY_MS = 1000 / TARGET_FPS;
int w = 9, h = 4;
auto prevTime = std::chrono::high_resolution_clock::now();
std::thread botThread(bot_thread, w, h);
while (true) {
auto currentTime = std::chrono::high_resolution_clock::now();
auto deltaTime = std::chrono::duration_cast<std::chrono::milliseconds>(currentTime - prevTime).count();
if (deltaTime >= FRAME_DELAY_MS) {
prevTime = currentTime;
run_bot_thread = false;
botThread.join();
break;
}
// Utilisez une temporisation efficace pour éviter une utilisation excessive du processeur
std::this_thread::sleep_for(std::chrono::milliseconds(10));
}
if (screenData != nullptr) {
free(screenData);
screenData = nullptr;
}
return 0;
}
Pour ceux qui ne savent pas comment installer il vous faudra Visual studio c++
et des bases en C++
Je ne souhaite pas partager le .exe ici car il sera patch au pire en mp discord : lph_mika
#include "pch.h"
#include <Windows.h>
#include <stdio.h>
#include <iostream>
#include <thread>
#include <chrono>
#include <Windows.h>
#include "HSV.h"
#include "Screen.h"
#include <iostream>
bool run_bot_thread = true;
#define VK_XBUTTON1 0x05
#ifdef _WIN32
#include <io.h>
#define access _access_s
#else
#include <unistd.h>
#endif
#define INAME L"VALORANT "
using namespace std;
int colorMode = 1;
HWND deeznuts;
#define isDown 0x8000
int get_screen_width(void) {
return GetSystemMetrics(SM_CXSCREEN);
}
int get_screen_height(void) {
return GetSystemMetrics(SM_CYSCREEN);
}
struct point {
double x;
double y;
point(double x, double y) : x(x), y(y) {}
};
inline bool is_color(int red, int green, int blue) {
if (colorMode == 1) { // Jaune
// Utilisez un tableau de plages de couleurs pour simplifier la vérification
static const int colorRanges[][6] = {
{170, 200, 165, 215, 25, 110},
{145, 170, 140, 165, 5, 55},
{200, 230, 200, 230, 0, 90},
{230, 255, 230, 255, 90, 190}
};
for (const auto& range : colorRanges) {
if (red >= range[0] && red <= range[1] &&
green >= range[2] && green <= range[3] &&
blue >= range[4] && blue <= range[5]) {
return true;
}
}
}
return false;
}
BYTE* screenData = nullptr;
bool run_threads = true;
const int screen_width = get_screen_width(), screen_height = get_screen_height();
void bot_thread(int w, int h) {
auto t_start = std::chrono::high_resolution_clock::now();
auto t_end = std::chrono::high_resolution_clock::now();
std::this_thread::sleep_for(std::chrono::milliseconds(1));
HDC hScreen = GetDC(NULL);
HBITMAP hBitmap = CreateCompatibleBitmap(hScreen, w, h);
screenData = (BYTE*)malloc(4 * w * h); // Utilisez 4 au lieu de 5 pour les octets par pixel (32 bits)
HDC hDC = CreateCompatibleDC(hScreen);
point middle_screen(screen_width / 2, screen_height / 2);
BITMAPINFOHEADER bmi = { 0 };
bmi.biSize = sizeof(BITMAPINFOHEADER);
bmi.biPlanes = 1;
bmi.biBitCount = 32;
bmi.biWidth = w;
bmi.biHeight = -h;
bmi.biCompression = BI_RGB;
bmi.biSizeImage = 0;
while (run_threads) {
Sleep(6);
HGDIOBJ old_obj = SelectObject(hDC, hBitmap);
BOOL bRet = BitBlt(hDC, 0, 0, w, h, hScreen, middle_screen.x - (w / 2), middle_screen.y - (h / 2), SRCCOPY);
SelectObject(hDC, old_obj);
GetDIBits(hDC, hBitmap, 0, h, screenData, (BITMAPINFO*)&bmi, DIB_RGB_COLORS);
for (int j = 0; j < h; ++j) {
for (int i = 0; i < w; ++i) { // Supprimez la multiplication par 4 ici
int index = (i + j * w) * 4; // Calculez l'index une seule fois
int red = screenData[index + 2];
int green = screenData[index + 1];
int blue = screenData[index];
if ((GetAsyncKeyState(VK_XBUTTON1) & isDown) && !(GetAsyncKeyState(VK_LBUTTON) & isDown)) {
if (is_color(red, green, blue)) {
if (GetAsyncKeyState('Z') & isDown) {
PostMessage(deeznuts, WM_KEYDOWN, 'S', 0);
PostMessage(deeznuts, WM_KEYDOWN, VK_LSHIFT, 0);
PostMessage(deeznuts, WM_LBUTTONDOWN, MK_LBUTTON, MAKELPARAM(0, 0));
Sleep(120);
PostMessage(deeznuts, WM_LBUTTONUP, 0, MAKELPARAM(0, 0));
PostMessage(deeznuts, WM_KEYUP, VK_LSHIFT, 0);
Sleep(0.01);;
PostMessage(deeznuts, WM_KEYUP, 'S', 0);
}
else if (GetAsyncKeyState('Q') & isDown) {
PostMessage(deeznuts, WM_KEYDOWN, 'D', 0);
PostMessage(deeznuts, WM_KEYDOWN, VK_LSHIFT, 0);
PostMessage(deeznuts, WM_LBUTTONDOWN, MK_LBUTTON, MAKELPARAM(0, 0));
Sleep(120);
PostMessage(deeznuts, WM_LBUTTONUP, 0, MAKELPARAM(0, 0));
PostMessage(deeznuts, WM_KEYUP, VK_LSHIFT, 0);
Sleep(0.01);
PostMessage(deeznuts, WM_KEYUP, 'D', 0);
}
else if (GetAsyncKeyState('D') & isDown) {
PostMessage(deeznuts, WM_KEYDOWN, 'Q', 0);
PostMessage(deeznuts, WM_KEYDOWN, VK_LSHIFT, 0);
PostMessage(deeznuts, WM_LBUTTONDOWN, MK_LBUTTON, MAKELPARAM(0, 0));
Sleep(120);
PostMessage(deeznuts, WM_LBUTTONUP, 0, MAKELPARAM(0, 0));
PostMessage(deeznuts, WM_KEYUP, VK_LSHIFT, 0);
Sleep(0.01);
PostMessage(deeznuts, WM_KEYUP, 'Q', 0);
}
else {
// Si aucune des touches Z, Q ou D n'est enfoncée, exécutez votre code existant ici
PostMessage(deeznuts, WM_KEYDOWN, VK_LSHIFT, 0);
Sleep(0.1);
PostMessage(deeznuts, WM_LBUTTONDOWN, MK_LBUTTON, MAKELPARAM(0, 0));
Sleep(120);
PostMessage(deeznuts, WM_LBUTTONUP, 0, MAKELPARAM(0, 0));
PostMessage(deeznuts, WM_KEYUP, VK_LSHIFT, 0);
Sleep(0.01);
}
}
}
else {
// Autre traitement si nécessaire
}
}
}
}
}
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) {
deeznuts = FindWindowW(NULL, INAME);
HDC nDC = GetDC(deeznuts);
string color;
int mode = 1;
AllocConsole();
AttachConsole(GetCurrentProcessId());
auto w_f = freopen("CON", "w", stdout);
auto r_f = freopen("CON", "r", stdin);
const int TARGET_FPS = 144;
const int FRAME_DELAY_MS = 1000 / TARGET_FPS;
int w = 9, h = 4;
auto prevTime = std::chrono::high_resolution_clock::now();
std::thread botThread(bot_thread, w, h);
while (true) {
auto currentTime = std::chrono::high_resolution_clock::now();
auto deltaTime = std::chrono::duration_cast<std::chrono::milliseconds>(currentTime - prevTime).count();
if (deltaTime >= FRAME_DELAY_MS) {
prevTime = currentTime;
run_bot_thread = false;
botThread.join();
break;
}
// Utilisez une temporisation efficace pour éviter une utilisation excessive du processeur
std::this_thread::sleep_for(std::chrono::milliseconds(10));
}
if (screenData != nullptr) {
free(screenData);
screenData = nullptr;
}
return 0;
}
Pour ceux qui ne savent pas comment installer il vous faudra Visual studio c++
et des bases en C++
Je ne souhaite pas partager le .exe ici car il sera patch au pire en mp discord : lph_mika