其他分享
首页 > 其他分享> > 植物大战僵尸无限阳光,无冷缩

植物大战僵尸无限阳光,无冷缩

作者:互联网

C++植物大战僵尸无限阳光,无冷缩

免责声明:本代码只允许对C++编程研究,切勿用在其他非法用途
先上效果:

效果

适合的游戏版本
植物大战僵尸年度版(来自同学的优盘emmmmm)
下载:游戏
下载:外挂

代码部分
环境visual studio 2019 编译直接用

#include <iostream>
#include <windows.h>
#include <thread>
#define Ver Ver2.0
using namespace std;
DWORD DPid{ 0 };

//菜单函数 每次输入完指令都会调用它 重新打印下菜单
void menu() {
    cout << "***********************" << endl;
    cout << "**** 1、修改阳光值 ****" << endl;
    cout << "**** 2、全员无冷却 ****" << endl;
    cout << "**** 0、退出本程序 ****" << endl;
    cout << "***********************" << endl;
    cout << "请输入相关指令:" << endl;
}
//修改阳光函数
void yG(DWORD pid) {
    HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, DPid);
    if (hProcess == NULL)
    {
        printf("你当前尚未进入关卡!请进入游戏关卡:自动获取阳光");
    }
    DWORD YGJZ{ 0x00755E0C }; //静态基址
    DWORD YGJZValue{ 0 };
    DWORD nSize{ 0 };
    BOOL ok = ReadProcessMemory(hProcess, (LPVOID)YGJZ, &YGJZValue, sizeof(DWORD), &nSize);
    DWORD YGjz2{ 0x868 }; //一级偏移
    DWORD YGjz2Value{ 0 };
    BOOL ok2 = ReadProcessMemory(hProcess, (LPVOID)(YGJZValue + YGjz2), &YGjz2Value, sizeof(DWORD), &nSize);
    DWORD YGJZ3{ 0x5578 }; //二级偏移
    DWORD YGJZ3Value{ 0 };
    BOOL OK3 = ReadProcessMemory(hProcess, (LPVOID)(YGjz2Value + YGJZ3), &YGJZ3Value, sizeof(DWORD), &nSize);
    cout << "当前阳光值:[ " << YGJZ3Value << " ] \n请输入要修改的阳光值:\n";  //最终及地址
    int edit;
    cin >> edit;
    BOOL wri = WriteProcessMemory(hProcess, (LPVOID)(YGjz2Value + YGJZ3), &edit, sizeof(edit), &nSize);
    if (wri == true)
    {
        cout << "写入成功!" << endl;
    }
}

//修改冷缩函数
void lS(DWORD pid) {
    HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, DPid);
    DWORD kc1{ 0x00755E0C };
    DWORD kc1Value{ 0 };
    ReadProcessMemory(hProcess, (LPVOID)kc1, &kc1Value, sizeof(DWORD), NULL);
    DWORD kc2{ 0x868 };
    DWORD kc2Value{ 0 };
    ReadProcessMemory(hProcess, (LPVOID)(kc1Value + kc2), &kc2Value, sizeof(DWORD), NULL);
    DWORD kc3{ 0x15C };
    DWORD kc3Value{ 0 };
    ReadProcessMemory(hProcess, (LPVOID)(kc2Value + kc3), &kc3Value, sizeof(DWORD), NULL);
    DWORD kc4{ 0x70 };
    DWORD kc4Value{ 0 };
    ReadProcessMemory(hProcess, (LPVOID)(kc3Value + kc4), &kc4Value, sizeof(DWORD), NULL);
    int t = 1;
    BOOL OK = WriteProcessMemory(hProcess, (LPVOID)(kc3Value + kc4), &t, sizeof(t), NULL);
    if (OK == true)
    {
        cout << "全员无冷却成功!" << endl;
        while (true)
        {
            WriteProcessMemory(hProcess, (LPVOID)(kc3Value + kc4), &t, sizeof(t), NULL);
            for (int i = 20; i <= 20 * 9; i += 20)
            {
                WriteProcessMemory(hProcess, (LPVOID)(kc3Value + (kc4 + ((0x4) * i))), &t, sizeof(t), NULL);
            }
        }
    }
}

int main()
{
    system("mode con cols=32 lines=18  ");//设置控制台大小

    system("color a");                      //设置控制台字体颜色
    SetConsoleTitle(L"ZomKill Ver2.0");   //设置控制台标题
    cout << "多线程加持已注入......\n我赌你的枪里没有子弹" << endl;
    int z;
    z = MessageBox(GetForegroundWindow(), L"更新:\n新增植物卡槽无冷却功能\n燕双鹰附着加持事半功倍\n\n使用方法:无脑用\n小辛QQ:913499532\n官网:www.xinux.top ", L"欢迎使用辅助Ver2.0", 1);
    //弹框

    system("cls");
    HWND hGame = FindWindow(L"MainWindow", L"Plants vs. Zombies");
    int select;
    while (true)
    {
        if (hGame == NULL)
        {
            cout << "游戏未运行,请打开游戏再运行本辅助\n本程序仅支持\<\<植物大战僵尸年度版\>\>有效:游戏下载地址:\n http://www.xinux.top" << endl;
            return 0;
        }
        else
        {
            GetWindowThreadProcessId(hGame, &DPid); //拿出进程ID
            cout << "+++++++++++++++++++++++++++++\n当前游戏进程ID:" << DPid << endl;
        }
        menu();
        cin >> select;
        switch (select)
        {
        case 1:
            yG(DPid);
            break;
        case 2:
        {thread tls(lS, DPid);
        tls.detach();
        }
        break;
        case 0:
            //system("cls");
            cout << "Bye! 谢谢支持,ZomKill将带给你全新的游戏体验" << endl;
            system("pause");
            system("cls");
            return 0;
            break;
        default:
            break;
        }
        system("pause");
        system("cls");
    }
}

免责声明

本代码只允许对C++编程研究,切勿用在其他非法用途如有违反与代码作者无关。

标签:case,cout,edit,冷缩,大战,C++,DPid,include,僵尸
来源: https://www.cnblogs.com/xinux/p/16273013.html