Advertisement
Guest User

BaRRyS3R.mp3

a guest
Apr 1st, 2010
1,258
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 2.33 KB | None | 0 0
  1. /*
  2. SA-MP Captcha by BaRRyS3R.mp3
  3. Release Version: 1.0
  4. Date: 31.03.2010
  5. */
  6.  
  7. #include <a_samp>
  8.  
  9. new CaptchSymb[36][] = {"1","2","3","4","5","6","7","8","9","0","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"};
  10. new Pcaptcha[MAX_PLAYERS][128];
  11.  
  12. forward CreateCaptcha(playerid);
  13.  
  14. public OnFilterScriptInit()
  15. {
  16.         print("  SA-MP Capcha by BaRRyS3R.mp3");
  17.         return 1;
  18. }
  19.  
  20. public OnPlayerConnect(playerid)
  21. {
  22.     CreateCaptcha(playerid);
  23.         return 1;
  24. }
  25.  
  26. public CreateCaptcha(playerid)
  27. {
  28.         new Symb1 = random(sizeof(CaptchSymb)),
  29.             Symb2 = random(sizeof(CaptchSymb)),
  30.             Symb3 = random(sizeof(CaptchSymb)),
  31.             Symb4 = random(sizeof(CaptchSymb)),
  32.             Symb5 = random(sizeof(CaptchSymb));
  33.  
  34.         new string[64];
  35.         format(Pcaptcha[playerid], 64,"%s%s%s%s%s", CaptchSymb[Symb1],CaptchSymb[Symb2],CaptchSymb[Symb3],CaptchSymb[Symb4],CaptchSymb[Symb5]);
  36.         format(string, 128, "Type the characters:\n%s", Pcaptcha[playerid]);
  37.         ShowPlayerDialog(playerid, 32425, 1, "SA-MP Captcha", string, "OK", "Cancel");
  38.         return 1;
  39. }
  40.  
  41. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  42. {
  43.         if(dialogid == 32425)
  44.         {
  45.                 if(!response)
  46.                 {
  47.                         SendClientMessage(playerid, 0xFFFFFF, "Pressed cancel. [Kick]");
  48.                         Kick(playerid);
  49.                 }
  50.                 else
  51.                 {
  52.                         if (!strcmp(inputtext, " "))
  53.                         {
  54.                                 SendClientMessage(playerid, 0xFFFFFF, "Captcha typed incorrectly.");
  55.                                 Kick(playerid);
  56.                         }
  57.                         if(!strcmp(inputtext, Pcaptcha[playerid]))
  58.                                         {
  59.                                                 SendClientMessage(playerid, 0xFFFFFF, "Captcha typed correctly.");
  60.                                         }
  61.                         else
  62.                                         {
  63.                                 SendClientMessage(playerid, 0xFFFFFF, "Captcha typed incorrectly.");
  64.                                 Kick(playerid);
  65.                         }
  66.                         }
  67.         }
  68.     return 0;
  69. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement