JasperM

Captcha.pwn by MafiaOink

Mar 10th, 2015
416
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 8.62 KB | None | 0 0
  1. #include <a_samp>
  2. #include <text>
  3.  
  4. stock KickPlayer(playerid)
  5. {
  6.     SetTimerEx("stockkp", 1000, false, "i", playerid);
  7.     return 1;
  8. }
  9.  
  10. forward stockkp(playerid);
  11.  
  12. new PlayerText:Textdraw0[MAX_PLAYERS];
  13. new PlayerText:Textdraw1[MAX_PLAYERS];
  14. new PlayerText:Textdraw2[MAX_PLAYERS];
  15. new PlayerText:Textdraw3[MAX_PLAYERS];
  16. new PlayerText:Textdraw4[MAX_PLAYERS];
  17. new PlayerText:Textdraw5[MAX_PLAYERS];
  18. new PlayerText:Textdraw6[MAX_PLAYERS];
  19.  
  20. #define DIALOG_CAPTCHA 9259
  21.  
  22. new Captcha[MAX_PLAYERS];
  23. new CaptchaDone[MAX_PLAYERS];
  24. new StoreItDude[9999];
  25.  
  26. new RandomWord[] = // RANDOM WORDS SHOULDN'T BE TOO BIG
  27. {
  28.     "me-transfer25",
  29.     "i-ampro",
  30.     "watchnnlearn",
  31.     "nooboots192",
  32.     "2k15pro",
  33.     "bangdang bee 9",
  34.     "mafiapro hitler",
  35.     "hitandkilljuba",
  36.     "tormerfav",
  37.     "2nsatws5hi"
  38. };
  39.  
  40. public stockkp(playerid)
  41. {
  42.     Kick(playerid);
  43. }
  44.  
  45.  
  46. public OnFilterScriptInit()
  47. {
  48.     print("\n--------------------------------------");
  49.     print("MafiaOink(ZombieNest) Captcha System is now Loaded");
  50.     print("--------------------------------------\n");
  51.     return 1;
  52. }
  53.  
  54. public OnFilterScriptExit()
  55. {
  56.     print("\n--------------------------------------");
  57.     print("MafiaOink(ZombieNest) Captcha System is now unloaded");
  58.     print("--------------------------------------\n");
  59.     return 1;
  60. }
  61.  
  62. public OnPlayerConnect(playerid)
  63. {
  64. Textdraw0[playerid] = CreatePlayerTextDraw(playerid, 0.000000, 0.000000, "LD_SPAC:white");
  65. PlayerTextDrawLetterSize(playerid, Textdraw0[playerid], 0.000000, 0.000000);
  66. PlayerTextDrawTextSize(playerid, Textdraw0[playerid], 640.000000, 448.000000);
  67. PlayerTextDrawAlignment(playerid, Textdraw0[playerid], 1);
  68. PlayerTextDrawColor(playerid, Textdraw0[playerid], -5963521);
  69. PlayerTextDrawSetShadow(playerid, Textdraw0[playerid], 0);
  70. PlayerTextDrawSetOutline(playerid, Textdraw0[playerid], 0);
  71. PlayerTextDrawFont(playerid, Textdraw0[playerid], 4);
  72.  
  73. Textdraw1[playerid] = CreatePlayerTextDraw(playerid, 119.999961, 24.639997, "~b~HUMAN CAPTCHA~n~(PROVE YOURSELF)");
  74. PlayerTextDrawLetterSize(playerid, Textdraw1[playerid], 1.194800, 12.344535);
  75. PlayerTextDrawAlignment(playerid, Textdraw1[playerid], 1);
  76. PlayerTextDrawColor(playerid, Textdraw1[playerid], -1);
  77. PlayerTextDrawSetShadow(playerid, Textdraw1[playerid], 0);
  78. PlayerTextDrawSetOutline(playerid, Textdraw1[playerid], 1);
  79. PlayerTextDrawBackgroundColor(playerid, Textdraw1[playerid], 51);
  80. PlayerTextDrawFont(playerid, Textdraw1[playerid], 1);
  81. PlayerTextDrawSetProportional(playerid, Textdraw1[playerid], 1);
  82.  
  83. Textdraw2[playerid] = CreatePlayerTextDraw(playerid, 98.400009, 247.893203, "~g~PLEASE CLICK THE BUTTON AND TYPE IN THE WORD YOU SEE");
  84. PlayerTextDrawLetterSize(playerid, Textdraw2[playerid], 0.437199, 4.295465);
  85. PlayerTextDrawAlignment(playerid, Textdraw2[playerid], 1);
  86. PlayerTextDrawColor(playerid, Textdraw2[playerid], -1);
  87. PlayerTextDrawSetShadow(playerid, Textdraw2[playerid], 0);
  88. PlayerTextDrawSetOutline(playerid, Textdraw2[playerid], 1);
  89. PlayerTextDrawBackgroundColor(playerid, Textdraw2[playerid], 51);
  90. PlayerTextDrawFont(playerid, Textdraw2[playerid], 1);
  91. PlayerTextDrawSetProportional(playerid, Textdraw2[playerid], 1);
  92.  
  93. Textdraw3[playerid] = CreatePlayerTextDraw(playerid, 245.600006, 346.453399, "LD_BEAT:circle");
  94. PlayerTextDrawLetterSize(playerid, Textdraw3[playerid], 0.028000, 0.350933);
  95. PlayerTextDrawTextSize(playerid, Textdraw3[playerid], 117.599998, 83.626647);
  96. PlayerTextDrawAlignment(playerid, Textdraw3[playerid], 1);
  97. PlayerTextDrawColor(playerid, Textdraw3[playerid], -1);
  98. PlayerTextDrawSetShadow(playerid, Textdraw3[playerid], 0);
  99. PlayerTextDrawSetOutline(playerid, Textdraw3[playerid], 0);
  100. PlayerTextDrawFont(playerid, Textdraw3[playerid], 4);
  101. PlayerTextDrawSetSelectable(playerid, Textdraw3[playerid], true);
  102.  
  103. Textdraw4[playerid] = CreatePlayerTextDraw(playerid, 202.399932, 297.920013, "randomword appears here");
  104. PlayerTextDrawLetterSize(playerid, Textdraw4[playerid], 0.449999, 1.600000);
  105. PlayerTextDrawAlignment(playerid, Textdraw4[playerid], 1);
  106. PlayerTextDrawColor(playerid, Textdraw4[playerid], -1);
  107. PlayerTextDrawSetShadow(playerid, Textdraw4[playerid], 0);
  108. PlayerTextDrawSetOutline(playerid, Textdraw4[playerid], 1);
  109. PlayerTextDrawBackgroundColor(playerid, Textdraw4[playerid], 51);
  110. PlayerTextDrawFont(playerid, Textdraw4[playerid], 1);
  111. PlayerTextDrawSetProportional(playerid, Textdraw4[playerid], 1);
  112.  
  113. Textdraw5[playerid] = CreatePlayerTextDraw(playerid, 450.000061, 295.686645, "usebox");
  114. PlayerTextDrawLetterSize(playerid, Textdraw5[playerid], 0.000000, 2.489257);
  115. PlayerTextDrawTextSize(playerid, Textdraw5[playerid], 197.199920, 0.000000);
  116. PlayerTextDrawAlignment(playerid, Textdraw5[playerid], 1);
  117. PlayerTextDrawColor(playerid, Textdraw5[playerid], 0);
  118. PlayerTextDrawUseBox(playerid, Textdraw5[playerid], true);
  119. PlayerTextDrawBoxColor(playerid, Textdraw5[playerid], 102);
  120. PlayerTextDrawSetShadow(playerid, Textdraw5[playerid], 0);
  121. PlayerTextDrawSetOutline(playerid, Textdraw5[playerid], 0);
  122. PlayerTextDrawFont(playerid, Textdraw5[playerid], 0);
  123.  
  124. Textdraw6[playerid] = CreatePlayerTextDraw(playerid, 111.999893, 286.719879, "~g~Captcha >>~n~~r~Space is allowed+important");
  125. PlayerTextDrawLetterSize(playerid, Textdraw6[playerid], 0.375599, 3.892264);
  126. PlayerTextDrawAlignment(playerid, Textdraw6[playerid], 1);
  127. PlayerTextDrawColor(playerid, Textdraw6[playerid], -1);
  128. PlayerTextDrawSetShadow(playerid, Textdraw6[playerid], 0);
  129. PlayerTextDrawSetOutline(playerid, Textdraw6[playerid], 1);
  130. PlayerTextDrawBackgroundColor(playerid, Textdraw6[playerid], 51);
  131. PlayerTextDrawFont(playerid, Textdraw6[playerid], 1);
  132. PlayerTextDrawSetProportional(playerid, Textdraw6[playerid], 1);
  133.  
  134. PlayerTextDrawShow(playerid, Textdraw0[playerid]);
  135. PlayerTextDrawShow(playerid, Textdraw1[playerid]);
  136. PlayerTextDrawShow(playerid, Textdraw2[playerid]);
  137. PlayerTextDrawShow(playerid, Textdraw3[playerid]);
  138. PlayerTextDrawShow(playerid, Textdraw4[playerid]);
  139. PlayerTextDrawShow(playerid, Textdraw5[playerid]);
  140. PlayerTextDrawShow(playerid, Textdraw6[playerid]);
  141.  
  142. Captcha[playerid] = 1;
  143. CaptchaDone[playerid] = 0;
  144. SelectTextDraw(playerid, 0x00FF00FF);
  145. SendClientMessage(playerid, -1, "PRESS 'YES(Y)' TO GET THE CURSOR BACK IF QUITED");
  146. PlayerTextDrawSetString(playerid, Textdraw4[playerid], RandomWord[random(10)]);
  147. return 1;
  148. }
  149.  
  150. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  151. {
  152.     if(newkeys == KEY_YES)
  153.     {
  154.         if(Captcha[playerid] == 1)
  155.         {
  156.             SelectTextDraw(playerid, 0x00FF00FF);
  157.         }
  158.     }
  159.     return 1;
  160. }
  161.  
  162. public OnPlayerSpawn(playerid)
  163. {
  164.     if(CaptchaDone[playerid] == 0) return SendClientMessage(playerid, -1, "You have bypassed the security, Kicking player."), Kick(playerid);
  165.     return 1;
  166. }
  167.  
  168. public OnPlayerCommandText(playerid, cmdtext[])
  169. {
  170.     if(CaptchaDone[playerid] == 0) return SendClientMessage(playerid, -1, "You are not allowed to use commands if not done Captcha, Kicking player."), Kick(playerid);
  171.     return 0;
  172. }
  173.  
  174. public OnPlayerRequestSpawn(playerid)
  175. {
  176.     if(CaptchaDone[playerid] == 0) return SendClientMessage(playerid, -1, "You have bypassed the security, Kicking player."), Kick(playerid);
  177.     return 1;
  178. }
  179.  
  180. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  181. {
  182.     if(dialogid == DIALOG_CAPTCHA)
  183.     {
  184.         if(response)
  185.         {
  186.             if (!strcmp(inputtext, PlayerTextDrawGetText(Textdraw4[playerid]), true))
  187.             {
  188.                 CaptchaDone[playerid] = 1;
  189.                 Captcha[playerid] = 0;
  190.                 PlayerTextDrawHide(playerid, Textdraw0[playerid]);
  191.                 PlayerTextDrawHide(playerid, Textdraw1[playerid]);
  192.                 PlayerTextDrawHide(playerid, Textdraw2[playerid]);
  193.                 PlayerTextDrawHide(playerid, Textdraw3[playerid]);
  194.                 PlayerTextDrawHide(playerid, Textdraw4[playerid]);
  195.                 PlayerTextDrawHide(playerid, Textdraw5[playerid]);
  196.                 PlayerTextDrawHide(playerid, Textdraw6[playerid]);
  197.                 SendClientMessage(playerid, -1, "CAPTCHA DONE - HUMAN STATUS VERIFIED!");
  198.             }
  199.             else
  200.             {
  201.                 SendClientMessage(playerid, -1, "CAPTCHA WRONG - HUMAN STATUS CANCELED! - KICKING PLAYER");
  202.                 Kick(playerid);
  203.             }
  204.         }
  205.         else
  206.         {
  207.             SendClientMessage(playerid, -1, "You MUST complete the captcha and now fuck off!");
  208.             Kick(playerid);
  209.         }
  210.         return 1;
  211.     }
  212.  
  213.     return 0;
  214. }
  215.  
  216. public OnPlayerClickPlayerTextDraw(playerid, PlayerText:playertextid)
  217. {
  218.     if(playertextid == Textdraw3[playerid])
  219.     {
  220.          ShowPlayerDialog(playerid, DIALOG_CAPTCHA, DIALOG_STYLE_INPUT, "Server Captcha", "Please insert the words you see in the captcha box to verify as human!", "Try my luck", "Shi' Wanna quit");
  221.          CancelSelectTextDraw(playerid);
  222.     }
  223.     return 1;
  224. }
Add Comment
Please, Sign In to add comment