(FS) TextDraw Captcha

Готовые решения скриптов, filterScript

Moderator: SJplayer

Avatar
Topic author
SJplayer M
Модератор
Модератор
Posts: 191
With us: 7 years 4 months

(FS) TextDraw Captcha

Post #1by SJplayer » 3 Jul 2013, 19:11

(FS) TextDraw Captcha
Автор: OKStyle

Image Image


Каптча на текстдравах


  • Никаких диалогов, только текстдравы.
  • Текстдравы персональные, удаляются при перезаходе сами.
  • Система на PVar'ах, исключено перекрестное заполнение массивов.
  • При правильном вводе каптчи Вас пустит на сервер.
  • При неправильном вводе - сменит каптчу.
  • До момента ввода правильной каптчи нельзя писать в чат, юзать команды и спавниться (дорабатывайте по своим нуждам).

Код

Code: Select all

#include <a_samp>
// TextDraw Captcha by O.K.Style™
new PlayerText:Captcha[40], TextArray[] = "1234567890QWERTYUIOPASDFGHJKLZXCVBNM";
public 
OnPlayerConnect(playerid)
{
    for(new 
0cindex 0sizeof(Captcha); i++)
    {
        if(
== 0Captcha[i] = CreatePlayerTextDraw(playerid269.0139.0"Anti-bot captcha:");
        if(
== 1)
        {
            new 
cstring[24];
            
format(cstringsizeof(cstring), "%c%c%c%c%c"TextArray[random(sizeof(TextArray))], TextArray[random(sizeof(TextArray))], TextArray[random(sizeof(TextArray))], TextArray[random(sizeof(TextArray))], TextArray[random(sizeof(TextArray))]);
            
Captcha[i] = CreatePlayerTextDraw(playerid422.0139.0cstring);
            
SetPVarString(playerid"CaptchaCode"cstring);
        }
        if(
== 2Captcha[i] = CreatePlayerTextDraw(playerid285.0174.0"Please repeat:");
        if(
== 3Captcha[i] = CreatePlayerTextDraw(playerid427.0178.0"-----");
        if(
3)
        {
            new 
string[4];
            
format(stringsizeof(string), "%c"TextArray[4]);
            if(
>= 4Captcha[i] = CreatePlayerTextDraw(playerid158.0 + (41.0 cindex), 218.0string);
            if(
== 14cindex 0Captcha[i] = CreatePlayerTextDraw(playerid158.0 + (41.0 cindex), 259.0string);
            if(
14Captcha[i] = CreatePlayerTextDraw(playerid158.0 + (41.0 cindex), 259.0string);
            if(
== 24cindex 0Captcha[i] = CreatePlayerTextDraw(playerid178.0 + (41.0 cindex), 300.0string);
            if(
24Captcha[i] = CreatePlayerTextDraw(playerid178.0 + (41.0 cindex), 300.0string);
            if(
== 33cindex 0Captcha[i] = CreatePlayerTextDraw(playerid220.0 + (41.0 cindex), 341.0string);
            if(
33Captcha[i] = CreatePlayerTextDraw(playerid220.0 + (41.0 cindex), 341.0string);
            
PlayerTextDrawUseBox(playeridCaptcha[i], 1);
            
PlayerTextDrawBoxColor(playeridCaptcha[i], 0x000000AA);
            
PlayerTextDrawTextSize(playeridCaptcha[i], 29.029.0);
            
PlayerTextDrawSetSelectable(playeridCaptcha[i], 1);
            
cindex++;
        }
        
PlayerTextDrawLetterSize(playeridCaptcha[i], 0.633.4);
        
PlayerTextDrawAlignment(playeridCaptcha[i], 2);
        
PlayerTextDrawSetOutline(playeridCaptcha[i], 1);
        
PlayerTextDrawShow(playeridCaptcha[i]);
        
SelectTextDraw(playerid0xFDE39DFF);
    }
    return 
1;
}
public 
OnPlayerClickTextDraw(playeridText:clickedid)
{
    if(!(
_:clickedid 0xFFFF)) return SelectTextDraw(playerid0xFDE39DFF);
    return 
1;
}
public 
OnPlayerClickPlayerTextDraw(playeridPlayerText:playertextid)
{
    for(new 
4sizeof(Captcha); i++)
    {
        if(
playertextid == Captcha[i])
        {
            new 
step GetPVarInt(playerid"CaptchaStep"), sstring[96];
            
GetPVarString(playerid"CaptchaText"sstringsizeof(sstring));
            switch(
step)
            {
                case 
0format(sstringsizeof(sstring), "%c"TextArray[4]), strcat(sstring"----"), SetPVarString(playerid"CaptchaText"sstring);
                case 
1format(sstringsizeof(sstring), "%s%c"sstringTextArray[4]), strdel(sstring15), strcat(sstring"---"), SetPVarString(playerid"CaptchaText"sstring);
                case 
2format(sstringsizeof(sstring), "%s%c"sstringTextArray[4]), strdel(sstring25), strcat(sstring"--"), SetPVarString(playerid"CaptchaText"sstring);
                case 
3format(sstringsizeof(sstring), "%s%c"sstringTextArray[4]), strdel(sstring35), strcat(sstring"-"), SetPVarString(playerid"CaptchaText"sstring);
                case 
4:
                {
                    
strdel(sstring45);
                    
format(sstringsizeof(sstring), "%s%c"sstringTextArray[4]);
                    
PlayerTextDrawSetString(playeridCaptcha[3], sstring);
                    new 
cstring[24];
                    
GetPVarString(playerid"CaptchaCode"cstringsizeof(cstring));
                    if(
strcmp(cstringsstring) != 0)
                    {
                        
format(cstringsizeof(cstring), "%c%c%c%c%c"TextArray[random(sizeof(TextArray) - 1)], TextArray[random(sizeof(TextArray) - 1)], TextArray[random(sizeof(TextArray) - 1)], TextArray[random(sizeof(TextArray) - 1)], TextArray[random(sizeof(TextArray) - 1)]);
                        
PlayerTextDrawSetString(playeridCaptcha[1], cstring);
                        
SetPVarString(playerid"CaptchaCode"cstring);
                        
PlayerTextDrawSetString(playeridCaptcha[3], "-----");
                        
SendClientMessage(playerid0xFF0000FF"Wrong anti-bot capthcha! Try again...");
                        
DeletePVar(playerid"CaptchaStep");
                        
DeletePVar(playerid"CaptchaText");
                        return 
1;
                    }
                    else
                    {
                        for(new 
0sizeof(Captcha); l++) PlayerTextDrawHide(playeridCaptcha[l]);
                        
DeletePVar(playerid"CaptchaStep");
                        
DeletePVar(playerid"CaptchaCode");
                        
DeletePVar(playerid"CaptchaText");
                        
SetPVarInt(playerid"CaptchaPass"1);
                        
CancelSelectTextDraw(playerid);
                        
SendClientMessage(playerid0x00FF00FF"OK! You are not a bot. Welcome!");
                        return 
1;
                    }
                }
            }
            
SetPVarInt(playerid"CaptchaStep"step 1);
            
PlayerTextDrawSetString(playeridCaptcha[3], sstring);
        }
    }
    return 
1;
}
public 
OnPlayerText(playeridtext[])
{
    if(
GetPVarInt(playerid"CaptchaPass") != 1) return 0;
    return 
1;
}
public 
OnPlayerCommandText(playeridcmdtext[])
{
    if(
GetPVarInt(playerid"CaptchaPass") != 1) return 0;
    return 
1;
}
public 
OnPlayerRequestSpawn(playerid)
{
    if(
GetPVarInt(playerid"CaptchaPass") != 1) return 0;
    return 
1;
}
// etc. 

! ! !


  • Similar Topics
    Replies
    Views
    Last post

Return to “Скрипты / FS”

Who is online

Users browsing this forum: 1 guest