Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- new Flood[MAX_PLAYERS];
- new Answer[MAX_PLAYERS][10];
- new ChatText[MAX_PLAYERS][256];
- new bool:DialogPower[MAX_PLAYERS];
- public OnFilterScriptInit(){
- for(new i=0; i<MAX_PLAYERS; i++)
- if(IsPlayerConnected(i)&&!IsPlayerNPC(i))
- Flood[i]=GetTickCount()+1000;
- return 1;}
- public OnPlayerText(playerid, text[]){
- if(DialogPower[playerid]) return 0;
- if(Flood[playerid]+1000>GetTickCount()){
- new str[256];
- format(Answer[playerid],10,"%c%c%c%c",mathrandom(65,90),mathrandom(65,90),mathrandom(65,90),mathrandom(65,90));
- format(str, 256, "Ââåäèòå êîä %s: ", Answer[playerid]);
- format(ChatText[playerid], 256, "%s", text);
- ShowPlayerDialog(playerid, 99, DIALOG_STYLE_INPUT, "Captcha", str, "Ââåñòè", "Êèêíóòüñÿ");
- DialogPower[playerid]=true;
- return 0;}
- Flood[playerid]=GetTickCount();
- return 1;}
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]){
- if(dialogid==99) if(response){
- if(!strcmp(inputtext, Answer[playerid])){
- SendPlayerMessageToAll(playerid, ChatText[playerid]);
- Flood[playerid]=GetTickCount();
- DialogPower[playerid]=false;}
- else{
- DialogPower[playerid]=true;
- format(Answer[playerid],10,"%c%c%c%c",mathrandom(65,90),mathrandom(65,90),mathrandom(65,90),mathrandom(65,90));
- new str[256]; format(str, 256, "Ââåäèòå êîä %s: ", Answer[playerid]);
- ShowPlayerDialog(playerid, 99, DIALOG_STYLE_INPUT, "Captcha", str, "Ââåñòè", "Ïîëó÷èòü äðóãóþ");}
- }else{
- DialogPower[playerid]=true;
- format(Answer[playerid],10,"%c%c%c%c",mathrandom(65,90),mathrandom(65,90),mathrandom(65,90),mathrandom(65,90));
- new str[256]; format(str, 256, "Ââåäèòå êîä %s: ", Answer[playerid]);
- ShowPlayerDialog(playerid, 99, DIALOG_STYLE_INPUT, "Captcha", str, "Ââåñòè", "Ïîëó÷èòü äðóãóþ");}
- return 1;}
- stock mathrandom(min,max) {
- new g=random(max);
- while(g<min) g=random(max);
- return g;}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement