所以我试图用c ++来练习CS的基本触发程序 一切正常,直到尝试编译为止都没有错误。
我的代码
Triggerbot.cc
#include "ProcMem.h"
#include "csgo.hpp"
#include <ctime>
#include <chrono>
#include <iostream>
#include <Windows.h>
#include "triggerbot.h"
using namespace hazedumper;
using namespace signatures;
using namespace netvars;
ProcMem Memory;
DWORD ClientDLL;
DWORD localPlayer;
const DWORD teamOffset = 0xF4;
const DWORD hpOffset = 0x100;
const DWORD ELD = 0x10;
int mainProcess() {
char process[9] = "csgo.exe";
char module[20] = "client_panorama.dll";
Memory.Process(process);
ClientDLL = Memory.Module(module);
localPlayer = Memory.Read<DWORD>(ClientDLL + dwLocalPlayer);
while (true)
{
Shoot();
Sleep(1);
}
}
void Shoot()
{
DWORD activeWeapon = Memory.Read<DWORD>(localPlayer + m_hActiveWeapon);
DWORD entID = activeWeapon & 0xFFF;
DWORD weapID = Memory.Read<DWORD>(ClientDLL + dwEntityList + (entID - 1) * 0x10);
int myWeapID = Memory.Read<int>(weapID + m_iItemDefinitionIndex);
bool scopedIn = Memory.Read<bool>(localPlayer + m_bIsScoped);
int myTeam = Memory.Read<int>(localPlayer + teamOffset);
int crossEnt = Memory.Read<int>(localPlayer + m_iCrosshairId);
DWORD Entity = Memory.Read<DWORD>(ClientDLL + dwEntityList + (crossEnt - 1) * 0x10);
int enemyHP = Memory.Read<int>(Entity + hpOffset);
int enemyTeam = Memory.Read<int>(Entity + teamOffset);
if (GetKeyState(VK_LMENU) && 0x8000 && enemyTeam != myTeam && enemyHP > 0);
bool weapon = (myWeapID == 9) || (myWeapID == 40) || (myWeapID == 38) || (myWeapID == 11);
if ((weapon && scopedIn) || !weapon) {
Sleep(1);
Memory.Write<int>(ClientDLL + dwForceAttack, 5);
Sleep(18);
Memory.Write<int>(ClientDLL + dwForceAttack, 4);
Sleep(350);
}
}
错误
Error C3861 'Shoot': identifier not found
为什么即使在下面声明了标识符“ Shoot”也找不到
void Shoot()
请告诉我我做错了什么。
答案 0 :(得分:0)
将Shoot
函数移至mainProcess
上方:
void Shoot() {
//...
}
int mainProcess() {
//...
}
或者在Shoot
上方向前声明mainProcess
:
void Shoot(); // forward declaration
int mainProcess() {
//...
}
void Shoot() {
//...
}
还要确保将ProcMem.cpp
作为源文件添加到您的项目中。
答案 1 :(得分:0)
您需要转发声明函数void Shoot()
。编译器会自上而下地解析文件,包括尚未发现的所有信息,未知的信息。