Загрузка данных
#include <Windows.h>
#include <string>
#define CROSSHAIR_ADDR 0x110B5314
HANDLE hProcess = NULL;
bool triggerEnabled = true;
void Shoot() {
mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0);
Sleep(10);
mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
}
LRESULT CALLBACK MenuWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) {
switch (msg) {
case WM_CREATE: {
CreateWindowW(L"BUTTON", L"ON", WS_VISIBLE | WS_CHILD | BS_PUSHBUTTON,
50, 70, 80, 35, hwnd, (HMENU)1, GetModuleHandle(NULL), NULL);
CreateWindowW(L"BUTTON", L"OFF", WS_VISIBLE | WS_CHILD | BS_PUSHBUTTON,
160, 70, 80, 35, hwnd, (HMENU)2, GetModuleHandle(NULL), NULL);
break;
}
case WM_COMMAND: {
if (LOWORD(wParam) == 1) {
triggerEnabled = true;
InvalidateRect(hwnd, NULL, TRUE);
}
if (LOWORD(wParam) == 2) {
triggerEnabled = false;
InvalidateRect(hwnd, NULL, TRUE);
}
break;
}
case WM_PAINT: {
PAINTSTRUCT ps;
HDC hdc = BeginPaint(hwnd, &ps);
RECT rect;
GetClientRect(hwnd, &rect);
std::wstring title = L"Rutube: https://rutube.ru/channel/43805541";
SetBkMode(hdc, TRANSPARENT);
DrawTextW(hdc, title.c_str(), title.length(), &rect, DT_CENTER | DT_TOP);
std::wstring status = triggerEnabled ? L"STATUS: ON" : L"STATUS: OFF";
DrawTextW(hdc, status.c_str(), status.length(), &rect, DT_CENTER | DT_BOTTOM);
HPEN pen = CreatePen(PS_SOLID, 2, RGB(100, 100, 200));
SelectObject(hdc, pen);
Rectangle(hdc, 10, 10, rect.right - 10, rect.bottom - 10);
DeleteObject(pen);
EndPaint(hwnd, &ps);
break;
}
case WM_DESTROY: {
PostQuitMessage(0);
break;
}
default:
return DefWindowProcW(hwnd, msg, wParam, lParam);
}
return 0;
}
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) {
// Регистрация окна (Unicode)
WNDCLASSEXW wc = {};
wc.cbSize = sizeof(WNDCLASSEXW);
wc.style = CS_HREDRAW | CS_VREDRAW;
wc.lpfnWndProc = MenuWndProc;
wc.hInstance = hInstance;
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
wc.lpszClassName = L"TriggerMenu";
RegisterClassExW(&wc);
int screenX = GetSystemMetrics(SM_CXSCREEN);
int screenY = GetSystemMetrics(SM_CYSCREEN);
int winW = 300, winH = 160;
HWND menuWindow = CreateWindowExW(
WS_EX_TOPMOST,
L"TriggerMenu",
L"Trigger Bot CS 1.6",
WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_VISIBLE,
(screenX - winW) / 2, (screenY - winH) / 2,
winW, winH,
NULL, NULL, hInstance, NULL
);
// Основной цикл триггер-бота
while (true) {
HWND gameWnd = FindWindowW(NULL, L"Counter-Strike");
if (gameWnd && !hProcess) {
DWORD pid;
GetWindowThreadProcessId(gameWnd, &pid);
hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, pid);
}
if (hProcess) {
DWORD exitCode;
GetExitCodeProcess(hProcess, &exitCode);
if (exitCode != STILL_ACTIVE) {
CloseHandle(hProcess);
hProcess = NULL;
}
}
if (triggerEnabled && hProcess) {
int value = 0;
ReadProcessMemory(hProcess, (LPCVOID)CROSSHAIR_ADDR, &value, sizeof(int), NULL);
if (value == 2) {
static int lastShot = 0;
int now = GetTickCount();
if (now - lastShot > 100) {
Shoot();
lastShot = now;
}
}
}
MSG msg;
while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
Sleep(10);
}
return 0;
}