-3

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

[错误] '}' 标记之前的预期声明

所以我补充说。它只是重复。我正在使用 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;
                }

                }
            }
        }
    }
}

}

4

3 回答 3

1

缺少 { 这里:

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

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

下一次,更好的缩进!

于 2013-08-11T19:02:08.930 回答
1

问题是您的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;
}
于 2013-08-11T21:25:09.817 回答
0
GetWindowThreadProcessId( hGameWindow, &dwProcID);
if(dwProcID != 0);
{

它应该是:

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

有点d。在 dwProcID

于 2014-06-15T20:17:35.283 回答