c++做游戏
最近有人問我能不能破解防沉迷系統?
我當時不太知道防沉迷系統具體是什么東西,只知道它好像是限制未成年人玩游戲的一個措施
所以我就上百度查了一下,具體自己看吧
這個系統破解是肯定不行的,雖然網上也有很多視頻,但這些明確肯定是假的,這個系統
一出臺,檢查是很嚴格的,不可能能破解
但是,破解不了,還不能自己做一個嗎?
1.首先要解決的就是年齡問題,這個比較簡單,從身份中號中獲取就可以
2.其次是姓名。這個可以搞出來,但是需要登錄注冊一個網站才可以,因為作者比較懶,作者知道大家都不想搞得那么麻煩,所以就不做姓名了。
3.最重要的是時間,我做的系統沒有那么嚴格,每天的20:00——21:00可以進入游戲。所以只需要獲取時間。先獲取自1970年1月1日到現在的總秒數,在通過一系列簡單復雜的代碼,轉化成類似于9019這樣的時間,這就相當于9:19,0是占位用的,因為9、1、9在這里是分別明確的3個數字,我們要把十位減去字符0(轉化成int形)*10再加個位,就是24時格式化的時間。然后再判斷小時是不是20,因為20就是晚上8點以后。
4.再寫一個檢查:檢查時間有沒有超過20,也就是!=20
上代碼!
#include <iostream> #include <string> #include <iomanip> #include <time.h> #include<stdlib.h> #include<windows.h> #include<cstring> #include<conio.h> using namespace std;int sfz() {int a[18],i,n,b; printf("當前未進行認證\n");printf("請輸入身份證號:");for(i=0;i<18;i++)scanf("%1d",&a[i]);n=a[6]*1000+a[7]*100+a[8]*10+a[9];b=2022-n;if(b<18)return 0;elsereturn 1; }int huoqu() {time_t now_time;now_time = time(NULL);struct tm *local;local=localtime(&now_time); //獲取當前系統時間char buf[80];strftime(buf,80,"%H0%M",local);if ((buf[0]-'0')*10+(buf[2]-'0')==20){return 1;}else{return 0;} }int jiancha() {time_t now_time;now_time = time(NULL);struct tm *local;local=localtime(&now_time); //獲取當前系統時間char buf[80];strftime(buf,80,"%H0%M",local);if ((buf[0]-'0')*10+(buf[2]-'0')!=20){return 0;} }int main() {system("color F0");if (sfz()==0){if (huoqu()==1){start:cout<<" 21點"<<endl;cout<<"----------------------"<<endl;cout<<"輸入1開始"<<endl;int n;cin>>n;if (n==1){system("cls");cout<<"開始"<<endl;//輸入昵稱 string name1,name2;cout<<"請輸入玩家1昵稱"<<endl;cin>>name1;cout<<"請輸入玩家2昵稱"<<endl;cin>>name2;/**/string op1,op2;int n1=0,n2=0;int s1=0,s2=0;//玩家1 cout<<"請玩家1拿牌"<<endl;while (true){cout<<"是否繼續拿?(y/n)"<<endl;cin>>op1;if (op1=="y"){srand(time(NULL));s1 += (rand()%(7-1+1)+1);cout<<"你的牌一共有"<<s1<<endl; n1++;if (jiancha()==0){cout<<"\n騰訊成長守護提醒您:\n根據國家防沉迷通知的相關要求和騰訊最新強化的防沉迷策略,由于您是未成年玩家,僅能在\n周五、周六、和法定節假日每日20時至21時登錄游戲,在上述時間段外無法游戲,請注\n意休息。\n";Sleep(1000);exit(0);}}else if (op1=="n"){cout<<"你一共拿了"<<n1<<"張牌";if (jiancha()==0){cout<<"\n騰訊成長守護提醒您:\n根據國家防沉迷通知的相關要求和騰訊最新強化的防沉迷策略,由于您是未成年玩家,僅能在\n周五、周六、和法定節假日每日20時至21時登錄游戲,在上述時間段外無法游戲,請注\n意休息。\n";Sleep(1000);exit(0);}break;}else{cout<<"請不要亂輸!"; if (jiancha()==0){cout<<"\n騰訊成長守護提醒您:\n根據國家防沉迷通知的相關要求和騰訊最新強化的防沉迷策略,由于您是未成年玩家,僅能在\n周五、周六、和法定節假日每日20時至21時登錄游戲,在上述時間段外無法游戲,請注\n意休息。\n";Sleep(1000);exit(0);}}if (jiancha()==0){cout<<"\n騰訊成長守護提醒您:\n根據國家防沉迷通知的相關要求和騰訊最新強化的防沉迷策略,由于您是未成年玩家,僅能在\n周五、周六、和法定節假日每日20時至21時登錄游戲,在上述時間段外無法游戲,請注\n意休息。\n";Sleep(1000);exit(0);}}Sleep(3000);system("cls");//玩家2 cout<<"請玩家2拿牌"<<endl;while (true){cout<<"是否繼續拿?(y/n)"<<endl;cin>>op2;if (op2=="y"){srand(time(NULL));s2 += (rand()%(7-1+1)+1);cout<<"你的牌一共有"<<s2<<endl;n2++;if (jiancha()==0){cout<<"\n騰訊成長守護提醒您:\n根據國家防沉迷通知的相關要求和騰訊最新強化的防沉迷策略,由于您是未成年玩家,僅能在\n周五、周六、和法定節假日每日20時至21時登錄游戲,在上述時間段外無法游戲,請注\n意休息。\n";Sleep(1000);exit(0);}}else if (op1=="n"){cout<<"你一共拿了"<<n2<<"張牌";if (jiancha()==0){cout<<"\n騰訊成長守護提醒您:\n根據國家防沉迷通知的相關要求和騰訊最新強化的防沉迷策略,由于您是未成年玩家,僅能在\n周五、周六、和法定節假日每日20時至21時登錄游戲,在上述時間段外無法游戲,請注\n意休息。\n";Sleep(1000);exit(0);}break;}else{cout<<"請不要亂輸!"; if (jiancha()==0){cout<<"\n騰訊成長守護提醒您:\n根據國家防沉迷通知的相關要求和騰訊最新強化的防沉迷策略,由于您是未成年玩家,僅能在\n周五、周六、和法定節假日每日20時至21時登錄游戲,在上述時間段外無法游戲,請注\n意休息。\n";Sleep(1000);exit(0);}}if (jiancha()==0){cout<<"\n騰訊成長守護提醒您:\n根據國家防沉迷通知的相關要求和騰訊最新強化的防沉迷策略,由于您是未成年玩家,僅能在\n周五、周六、和法定節假日每日20時至21時登錄游戲,在上述時間段外無法游戲,請注\n意休息。\n";Sleep(1000);exit(0);}}Sleep(3000);system("cls");cout<<"正在統計....."<<endl;Sleep(1000);cout<<"玩家1總分數:"<<s1<<endl;cout<<"玩家2總分數:"<<s2<<endl;if (s1<=21 && s2<=21){if (s1>s2) {cout<<"【"<<name1<<"】"<<"is the winner!!!";cout<<"\n按a重來";int chch = _getch();if (chch==97) goto start;}if (s1==s2) {cout<<"【"<<name1<<"】"<<"and"<<"【"<<name2<<"】"<<"come out even!!!";cout<<"\n按a重來";int chch = _getch();if (chch==97) goto start;} if (s1<s2) {cout<<"【"<<name2<<"】"<<"is the winner!!!";cout<<"\n按a重來";int chch = _getch();if (chch==97) goto start;} }if(s1>21 && s2>21){cout<<"兩方都超過21分,"<<"【"<<name1<<"】"<<"and"<<"【"<<name2<<"】"<<"come out even!!!";cout<<"\n按a重來";int chch = _getch();if (chch==97) goto start;}if (s1>21 && s2<=21) {cout<<"【"<<name2<<"】"<<"is the winner!!!";cout<<"\n按a重來\n";int chch = _getch();if (chch==97) goto start;}if (s2>21 && s1<=21) {cout<<"【"<<name1<<"】"<<"is the winner!!!";cout<<"\n按a重來";int chch = _getch();if (chch==97) goto start;}}}if (huoqu()==0){cout<<"\n騰訊成長守護提醒您:\n根據國家防沉迷通知的相關要求和騰訊最新強化的防沉迷策略,由于您是未成年玩家,僅能在\n周五、周六、和法定節假日每日20時至21時登錄游戲,在上述時間段外無法游戲,請注\n意休息。\n";Sleep(3000);exit(0);}}if (sfz()==1){start1:cout<<" 21點"<<endl;cout<<"----------------------"<<endl;cout<<" 輸入1開始"<<endl;int n;cin>>n;if (n==1){system("cls");cout<<"開始"<<endl;//輸入昵稱 string name1,name2;cout<<"請輸入玩家1昵稱"<<endl;cin>>name1;cout<<"請輸入玩家2昵稱"<<endl;cin>>name2;/**/string op1,op2;int n1=0,n2=0;int s1=0,s2=0;//玩家1 cout<<"請玩家1拿牌"<<endl;while (true){cout<<"是否繼續拿?(y/n)"<<endl;cin>>op1;if (op1=="y"){srand(time(NULL));s1 += (rand()%(7-1+1)+1);cout<<"你的牌一共有"<<s1<<endl; n1++;}else if (op1=="n"){cout<<"你一共拿了"<<n1<<"張牌";break;}else{cout<<"請不要亂輸!"; }}Sleep(3000);system("cls");//玩家2 cout<<"請玩家2拿牌"<<endl;while (true){cout<<"是否繼續拿?(y/n)"<<endl;cin>>op2;if (op2=="y"){srand(time(NULL));s2 += (rand()%(7-1+1)+1);cout<<"你的牌一共有"<<s2<<endl;n2++;}else if (op1=="n"){cout<<"你一共拿了"<<n2<<"張牌";break;}else{cout<<"請不要亂輸!"; }}Sleep(3000);system("cls");cout<<"正在統計....."<<endl;Sleep(1000);cout<<"玩家1總分數:"<<s1<<endl;cout<<"玩家2總分數:"<<s2<<endl;if (s1<=21 && s2<=21){if (s1>s2) {cout<<"【"<<name1<<"】"<<"is the winner!!!";cout<<"\n按a重來\n";int chch = _getch();if (chch==97) goto start1;} if (s1==s2){cout<<"【"<<name1<<"】"<<"and"<<"【"<<name2<<"】"<<"come out even!!!";cout<<"\n按a重來\n";int chch = _getch();if (chch==97) goto start1;} if (s1<s2){cout<<"【"<<name2<<"】"<<"is the winner!!!";cout<<"\n按a重來\n";int chch = _getch();if (chch==97) goto start1;} }if(s1>21 && s2>21){cout<<"兩方都超過21分,"<<"【"<<name1<<"】"<<"and"<<"【"<<name2<<"】"<<"come out even!!!";cout<<"\n按a重來\n";int chch = _getch();if (chch==97) goto start1;}if (s1>21 && s2<=21) {cout<<"【"<<name2<<"】"<<"is the winner!!!";cout<<"\n按a重來\n";int chch = _getch();if (chch==97) goto start1;}if (s2>21 && s1<=21) {cout<<"【"<<name1<<"】"<<"is the winner!!!";cout<<"\n按a重來\n";int chch = _getch();if (chch==97) goto start1;}}}return 0;}下面有驚喜!
有獎競猜:最后, 猜猜這是什么游戲,評論區留言
總結
- 上一篇: 微软提前发新版音乐播放器 阻击苹果新iP
- 下一篇: CSS盒子坍塌(高度坍塌)(以及解决办法