upd
This commit is contained in:
@@ -0,0 +1,116 @@
|
||||
#include "../../../cs2/entity/C_CSPlayerPawn/C_CSPlayerPawn.h"
|
||||
#include "../../../templeware/interfaces/CGameEntitySystem/CGameEntitySystem.h"
|
||||
#include "../../../templeware/interfaces/interfaces.h"
|
||||
#include "../../../templeware/hooks/hooks.h"
|
||||
#include "../../../templeware/config/config.h"
|
||||
#include "../../../templeware/features/aim/aim.h"
|
||||
#include <Windows.h>
|
||||
#include <cmath>
|
||||
|
||||
// Симуляция нажатия ЛКМ
|
||||
void SimulateLMBClick() {
|
||||
INPUT input = { 0 };
|
||||
input.type = INPUT_MOUSE;
|
||||
input.mi.dwFlags = MOUSEEVENTF_LEFTDOWN;
|
||||
SendInput(1, &input, sizeof(INPUT));
|
||||
ZeroMemory(&input, sizeof(INPUT));
|
||||
input.type = INPUT_MOUSE;
|
||||
input.mi.dwFlags = MOUSEEVENTF_LEFTUP;
|
||||
SendInput(1, &input, sizeof(INPUT));
|
||||
}
|
||||
|
||||
void SimulateLMBDown() {
|
||||
INPUT input = { 0 };
|
||||
input.type = INPUT_MOUSE;
|
||||
input.mi.dwFlags = MOUSEEVENTF_LEFTDOWN;
|
||||
SendInput(1, &input, sizeof(INPUT));
|
||||
}
|
||||
void SimulateLMBUp() {
|
||||
INPUT input = { 0 };
|
||||
input.type = INPUT_MOUSE;
|
||||
input.mi.dwFlags = MOUSEEVENTF_LEFTUP;
|
||||
SendInput(1, &input, sizeof(INPUT));
|
||||
}
|
||||
|
||||
static DWORD lastShotTime = 0;
|
||||
void Triggerbot() {
|
||||
static DWORD lastShotTime = 0;
|
||||
static bool lmbHeld = false;
|
||||
static bool firstShot = true;
|
||||
if (!Config::triggerbot)
|
||||
return;
|
||||
if (!Config::always_on_triggerbot && Config::triggerbot_key && !(GetAsyncKeyState(Config::triggerbot_key) & 0x8000))
|
||||
return;
|
||||
if (GetAsyncKeyState(VK_LBUTTON) & 0x8000) {
|
||||
if (lmbHeld) {
|
||||
SimulateLMBUp();
|
||||
lmbHeld = false;
|
||||
}
|
||||
firstShot = true;
|
||||
return;
|
||||
}
|
||||
C_CSPlayerPawn* lp = H::oGetLocalPlayer(0);
|
||||
if (!lp || lp->getHealth() <= 0) { firstShot = true; return; }
|
||||
int crosshairIdx = *(int*)((uintptr_t)lp + 0x1458); // m_iIDEntIndex
|
||||
//g_DebugString = "debug: " + std::to_string(crosshairIdx);
|
||||
if (crosshairIdx <= 0) {
|
||||
if (lmbHeld) {
|
||||
SimulateLMBUp();
|
||||
lmbHeld = false;
|
||||
}
|
||||
firstShot = true;
|
||||
return;
|
||||
}
|
||||
auto target = I::GameEntity->Instance->Get<C_CSPlayerPawn>(crosshairIdx);
|
||||
if (!target) {
|
||||
if (lmbHeld) {
|
||||
SimulateLMBUp();
|
||||
lmbHeld = false;
|
||||
}
|
||||
firstShot = true;
|
||||
return;
|
||||
}
|
||||
if (target->getHealth() <= 0) {
|
||||
if (lmbHeld) {
|
||||
SimulateLMBUp();
|
||||
lmbHeld = false;
|
||||
}
|
||||
firstShot = true;
|
||||
return;
|
||||
}
|
||||
if (Config::team_check && target->getTeam() == lp->getTeam()) {
|
||||
if (lmbHeld) {
|
||||
SimulateLMBUp();
|
||||
lmbHeld = false;
|
||||
}
|
||||
firstShot = true;
|
||||
return;
|
||||
}
|
||||
DWORD64 now = GetTickCount64();
|
||||
if (!Config::triggerbot_hold_lmb) {
|
||||
if (now - lastShotTime < static_cast<DWORD64>(Config::triggerbot_delay)) {
|
||||
if (lmbHeld) {
|
||||
SimulateLMBUp();
|
||||
lmbHeld = false;
|
||||
}
|
||||
firstShot = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (Config::triggerbot_hold_lmb) {
|
||||
if (firstShot) {
|
||||
SimulateLMBClick();
|
||||
firstShot = false;
|
||||
lastShotTime = now;
|
||||
return;
|
||||
} else if (!lmbHeld) {
|
||||
SimulateLMBDown();
|
||||
lmbHeld = true;
|
||||
}
|
||||
lastShotTime = now;
|
||||
return;
|
||||
}
|
||||
SimulateLMBClick();
|
||||
lastShotTime = now;
|
||||
firstShot = true;
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
#pragma once
|
||||
|
||||
void Triggerbot();
|
||||
Reference in New Issue
Block a user