pawn Код:
/*stock CreateSecurityTextDraw(playerid)
{
if(CheckingBot{playerid})
{
for(new i = 0, cindex = 0; i < sizeof(Captcha); i++)
{
if(i == 0) Captcha[i] = CreatePlayerTextDraw(playerid, 269.0, 139.0, "Anti-bot captcha:");
if(i == 1)
{
new cstring[24];
format(cstring, sizeof(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(playerid, 422.0, 139.0, cstring);
SetPVarString(playerid, "CaptchaCode", cstring);
}
if(i == 2) Captcha[i] = CreatePlayerTextDraw(playerid, 285.0, 174.0, "Please repeat:");
if(i == 3) Captcha[i] = CreatePlayerTextDraw(playerid, 427.0, 178.0, "-----");
if(i > 3)
{
new string[4];
format(string, sizeof(string), "%c", TextArray[i - 4]);
if(i >= 4) Captcha[i] = CreatePlayerTextDraw(playerid, 158.0 + (41.0 * cindex), 218.0, string);
if(i == 14) cindex = 0, Captcha[i] = CreatePlayerTextDraw(playerid, 158.0 + (41.0 * cindex), 259.0, string);
if(i > 14) Captcha[i] = CreatePlayerTextDraw(playerid, 158.0 + (41.0 * cindex), 259.0, string);
if(i == 24) cindex = 0, Captcha[i] = CreatePlayerTextDraw(playerid, 178.0 + (41.0 * cindex), 300.0, string);
if(i > 24) Captcha[i] = CreatePlayerTextDraw(playerid, 178.0 + (41.0 * cindex), 300.0, string);
if(i == 33) cindex = 0, Captcha[i] = CreatePlayerTextDraw(playerid, 220.0 + (41.0 * cindex), 341.0, string);
if(i > 33) Captcha[i] = CreatePlayerTextDraw(playerid, 220.0 + (41.0 * cindex), 341.0, string);
PlayerTextDrawUseBox(playerid, Captcha[i], 1);
PlayerTextDrawBoxColor(playerid, Captcha[i], 0x000000AA);
PlayerTextDrawTextSize(playerid, Captcha[i], 29.0, 29.0);
PlayerTextDrawSetSelectable(playerid, Captcha[i], 1);
cindex++;
}
PlayerTextDrawLetterSize(playerid, Captcha[i], 0.63, 3.4);
PlayerTextDrawAlignment(playerid, Captcha[i], 2);
PlayerTextDrawSetOutline(playerid, Captcha[i], 1);
PlayerTextDrawShow(playerid, Captcha[i]);
SelectTextDraw(playerid, 0xFDE39DFF);
}
}
}
public OnPlayerClickPlayerTextDraw(playerid, PlayerText:playertextid)
{
//new str[500];
if(CheckingBot{playerid})
{
for(new i = 4; i < sizeof(Captcha); i++)
{
if(playertextid == Captcha[i])
{
new step = GetIntVar(playerid, "CaptchaStep"), sstring[96];
GetPVarString(playerid, "CaptchaText", sstring, sizeof(sstring));
switch(step)
{
case 0: format(sstring, sizeof(sstring), "%c", TextArray[i - 4]), strcat(sstring, "----"), SetPVarString(playerid, "CaptchaText", sstring);
case 1: format(sstring, sizeof(sstring), "%s%c", sstring, TextArray[i - 4]), strdel(sstring, 1, 5), strcat(sstring, "---"), SetPVarString(playerid, "CaptchaText", sstring);
case 2: format(sstring, sizeof(sstring), "%s%c", sstring, TextArray[i - 4]), strdel(sstring, 2, 5), strcat(sstring, "--"), SetPVarString(playerid, "CaptchaText", sstring);
case 3: format(sstring, sizeof(sstring), "%s%c", sstring, TextArray[i - 4]), strdel(sstring, 3, 5), strcat(sstring, "-"), SetPVarString(playerid, "CaptchaText", sstring);
case 4:
{
strdel(sstring, 4, 5);
format(sstring, sizeof(sstring), "%s%c", sstring, TextArray[i - 4]);
PlayerTextDrawSetString(playerid, Captcha[3], sstring);
new cstring[24];
GetPVarString(playerid, "CaptchaCode", cstring, sizeof(cstring));
if(strcmp(cstring, sstring) != 0)
{
format(cstring, sizeof(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(playerid, Captcha[1], cstring);
SetStringVar(playerid, "CaptchaCode", cstring);
PlayerTextDrawSetString(playerid, Captcha[3], "-----");
//If they we're wrong
SendClientMessage(playerid, 0xFF0000FF, "You have entered a wrong captcha || Please re-try inorder to proceed to the registeration/login panel.");
//If they we're wrong
RemoveVar(playerid, "CaptchaStep");
RemoveVar(playerid, "CaptchaText");
return 1;
}
else
{
for(new l = 0; l < sizeof(Captcha); l++) PlayerTextDrawHide(playerid, Captcha[l]);
RemoveVar(playerid, "CaptchaStep");
RemoveVar(playerid, "CaptchaCode");
RemoveVar(playerid, "CaptchaText");
SetIntVar(playerid, "CaptchaPass", 1);
CancelSelectTextDraw(playerid);
CheckingBot{playerid} = false;
SendClientMessage(playerid, COLOR_WHITE, "");
SendClientMessage(playerid, COLOR_WHITE, "");
SendClientMessage(playerid, COLOR_WHITE, "Welcome to United RP || You have sucessfully passed through the Anti-Bot detection.");
SetIntVar(playerid, "RegisterPart", 1);
if(gPlayerLogged[playerid] == 0)
{
switch(gPlayerAccount[playerid])
{
case 0: DisplayDialogForPlayer(playerid, 2); //register
case 1: DisplayDialogForPlayer(playerid, 1); //login
}
}
ShowArea(playerid);
ShowGUI(playerid);
TextDrawShowForPlayer(playerid, Website);
FadeColorForPlayer(playerid,0,0,0,255,0,0,0,0,15,0);
SetupPlayerForClassSelection(playerid);
return 1;
}
}
}
SetIntVar(playerid, "CaptchaStep", step + 1);
PlayerTextDrawSetString(playerid, Captcha[3], sstring);
}
}
}
return 1;
}*/