C/C++ 學習日記4:反恐精英(單機)的敵我陣營遍歷器 源碼

此處省去過程,直接上代碼

#include "GameCheater.h"// 自己寫個封裝函數庫,供自己調用
#include <stdio.h>
#include <stdlib.h>

// 人物屬性結構體
struct Character{
    long float blood;  //  血
    long float x, y , z ;  //  三維座標
    long float AC;  //  護甲
};

// 遍歷敵我陣營所有人的偏移  同時遍歷出他們的座標。返回偏移數組
DWORD* EnemyAddress(HANDLE PID)
{
    DWORD ePass = 0x1B250000;  // amxmodx_mm.dll 模塊地址
    DWORD ePasser = 0x97000;  //  偏移
    DWORD Add; // 計算地址
    DWORD AddPress;  // 返回地址
    DWORD AddPress2[30];
    Character my;
    int i=0;

    while (ePasser <= 0x99FFF) {
        Add = ePass + ePasser;

        ReadProcessMemory(PID, LPVOID(Add), &AddPress, sizeof(DWORD),NULL);
        ReadProcessMemory(PID, LPVOID(AddPress + 0x7c), &AddPress, sizeof(DWORD), NULL);
        ReadProcessMemory(PID, LPVOID(AddPress + 0x04), &AddPress, sizeof(DWORD), NULL);

        my.x = nc_dxsx(PID, LPVOID(AddPress + 0x8));
        my.y = nc_dxsx(PID, LPVOID(AddPress + 0xC));
        my.z = nc_dxsx(PID, LPVOID(AddPress + 0x10));
        my.blood = nc_dxsx(PID, LPVOID(AddPress + 0x160));
        my.AC = nc_dxsx(PID, LPVOID(AddPress + 0x160 + 0x5C));

        if (my.blood == 100) {
            AddPress2[ i ] = ePasser;
            printf("Ace提示    報告Boss,已找到地址:%X\n", AddPress2[i]);
            i += 1;
        }
        ePasser += 0x01;
    }
    return AddPress2;
}

int main()
{
    HANDLE PID;

    PID=GetProcessID2(_T("hl.exe"));// 封裝函數庫裏的

    EnemyAddress(PID);

    system("pause");
    return 0;
}
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章