Assault Cube的简单外部黑客出错?

时间:2013-08-11 19:00:01

标签: c++

所以我正在关注一个关于为Assault Cube制作简单外部黑客的Youtube教程。 我到达了教程的第6部分并且......责备。我的编译器给了我错误:

  

[错误]'}'令牌之前的预期声明

所以我补充一点。它只是重复。 我正在使用Orwells Dev C ++并且不知道我哪里出错了。 苛刻的批评欢迎,包括那些“你超越自己跳跃。尝试更简单的事情。”等等

// Youtube Console Trainer Tutorial -- Trainer for Assault Cube
#include <iostream>
#include <windows.h>
#include <string>
#include <ctime>

std::string GameName = "AssaultCube";
LPCSTR LGameWindow = "AssaultCube";
std::string GameStatus;

bool IsGameAvail;
bool UpdateOnNextRun;

//Ammo Variables
bool AmmoStatus;
BYTE AmmoValue[] = {0xA3, 0X1C, 0X0, 0X0};
DWORD AmmoBaseAddress = {0x004DF73C};
DWORD AmmoOffsets[] = {0x378, 0x14, 0x0};

//Health Variables
bool HealthStatus;
BYTE HealthValue[] = {0x39, 0X5, 0X0, 0X0};
DWORD HealthBaseAddress = {0x004DF73C};
DWORD HealthOffsets[] = {0xF4};

int main()
{
HWND hGameWindow = NULL;
int timeSinceLastUpdate = clock();
int GameAvailTMR = clock();
int onePressTMR = clock();
DWORD dwProcID = NULL;
HANDLE hProcHandle = NULL;
UpdateOnNextRun = true;
std::string sAmmoStatus = "OFF";
std::string sHealthStatus = "OFF";

while(!GetAsyncKeyState(VK_INSERT))
{
    if(clock() - GameAvailTMR > 100)
    {
        GameAvailTMR = clock();
        IsGameAvail = false;

        hGameWindow = FindWindow(NULL,LGameWindow);
        if (hGameWindow)
        {
            GetWindowThreadProcessId( hGameWindow, &dwProcID);
            if(dwProcID != 0);
            {
                hProcHandle =     
                   OpenProcess(PROCESS_ALL_ACCESS,         FALSE, dwProcID);
                if(hProcHandle == INVALID_HANDLE_VALUE || hProcHandle == NULL )
                {
                    GameStatus = "Failed to open process for valid handle";

                }
                else{
                    GameStatus = "AssaultCube Ready To Hack";
                    IsGameAvail = true;
                }

                else{
                    GameStatus = "Failed to get process ID";

                }

                else {
                    GameStatus = "AssaultCube NOT FOUND";
                }


                if(UpdateOnNextRun || clock() - timeSinceLastUpdate > 5000 )

                    system("cls");
                    std::cout << "-------------------------------------"<< std::endl;
                    std::cout << "      AssaultCube memory hacker" << std::endl;std::endl;
                    std::cout << "-------------------------------------"<< std::endl;
                    std::cout << "GAME STATUS:" << GameStatus << std::endl << std::endl;
                    std::cout << "[F1] Unlimited Ammo -> " << sAmmoStatus << " <- " << std::endl << std::endl;
                    std::cout << "[F2] Unlimited Health -> " << sHealthStatus << " <- " << std::endl << std::endl;
                }

                }
            }
        }
    }
}

}

3 个答案:

答案 0 :(得分:1)

缺少{here:

if(UpdateOnNextRun || clock() - timeSinceLastUpdate > 5000 )

GameStatus = "AssaultCube Ready To Hack";行之后还有另外两个else没有if。删除/评论他们。

下一次,更好的缩进!

答案 1 :(得分:0)

问题是,当else子句应该在各自的if子句之外时,它们是嵌套的。让我们围绕一些括号:

hGameWindow = FindWindow(NULL,LGameWindow);
if (hGameWindow)
{
    GetWindowThreadProcessId( hGameWindow, &dwProcID);
    if(dwProcID != 0);
    {
        hProcHandle =     
           OpenProcess(PROCESS_ALL_ACCESS,         FALSE, dwProcID);
        if(hProcHandle == INVALID_HANDLE_VALUE || hProcHandle == NULL )
        {
            GameStatus = "Failed to open process for valid handle";

        }
        else{
            GameStatus = "AssaultCube Ready To Hack";
            IsGameAvail = true;
        }
    }
    else{
        GameStatus = "Failed to get process ID";

    }
}
else {
    GameStatus = "AssaultCube NOT FOUND";
}


if(UpdateOnNextRun || clock() - timeSinceLastUpdate > 5000 )
{
    system("cls");
    std::cout << "-------------------------------------"<< std::endl;
    std::cout << "      AssaultCube memory hacker" << std::endl;std::endl;
    std::cout << "-------------------------------------"<< std::endl;
    std::cout << "GAME STATUS:" << GameStatus << std::endl << std::endl;
    std::cout << "[F1] Unlimited Ammo -> " << sAmmoStatus << " <- " << std::endl << std::endl;
    std::cout << "[F2] Unlimited Health -> " << sHealthStatus << " <- " << std::endl << std::endl;
}

答案 2 :(得分:0)

GetWindowThreadProcessId( hGameWindow, &dwProcID);
if(dwProcID != 0);
{

它应该是:

GetWindowThreadProcessId( hGameWindow, &dwProcId);
if(dwProcID != 0);
{
它有点儿了。在dwProcID