Advertisement
Guest User

zBlock Anti-Cheat ( SAMP )

a guest
Jun 6th, 2014
1,732
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 36.89 KB | None | 0 0
  1. #define FILTERSCRIPT
  2.  
  3. #define COLOR_NOTES 0x2894FFFF
  4. #define COLOR_NOTES2 0xFF0000AA
  5.  
  6. #define WEBSITE "www.google.com"
  7. #define BOT_NAME "zBlock"
  8.  
  9. #define DIALOG_LOCKMODE 1
  10. #define DIALOG_SETTINGS 2
  11. #define DIALOG_SUSPECTS 3
  12.  
  13. #define ResetMoneyBar ResetPlayerMoney
  14. #define UpdateMoneyBar GivePlayerMoney
  15.  
  16. #include <a_samp>
  17. #include <zcmd>
  18. #include <sscanf2>
  19. #include <foreach>
  20.  
  21. #if defined FILTERSCRIPT
  22.  
  23. new DB:zBlock;
  24. new
  25.     datestring[ 24 ],
  26.     timestring[ 24 ]
  27. ;
  28. new
  29.     bool: Muted[ MAX_PLAYERS char ],
  30.     bool: ACDetected[ MAX_PLAYERS char ],
  31.     bool: FirstSpawn[ MAX_PLAYERS char ],
  32.     bool: AdminImmunity[ MAX_PLAYERS char ],
  33.     bool: LoggedIn[ MAX_PLAYERS char ],
  34.     AntiSpam[ MAX_PLAYERS ],
  35.     MutedTimes[ MAX_PLAYERS ],
  36.     ACTimesDetected[ MAX_PLAYERS ],
  37.     WarnForAdvert[ MAX_PLAYERS ],
  38.     RCONLoginFails[ MAX_PLAYERS ],
  39.     Cash[ MAX_PLAYERS ]
  40. ;
  41. new
  42.     DefaultPass = 1,
  43.     ServerLocked = 0,
  44.     BanForMoneyHack = 0,
  45.     BanForSpeedHack = 1
  46. ;
  47. public OnFilterScriptInit()
  48. {
  49.     print("--------------------------------------");
  50.     print("Loading zBlock Anti-Cheat. . .");
  51.     print("--------------------------------------\n");
  52.    
  53.     zBlock = db_open("zBlock.db");
  54.     db_query(zBlock, "CREATE TABLE IF NOT EXISTS `BANNED` (`NAME`, `IP`, `REASON`, `ADMIN`, `DATE`, `TIME`)");
  55.    
  56.     if(!fexist("/zblock"))
  57.     {
  58.         print("WARNING: folder 'zblock' at 'scriptfiles' does NOT exist");
  59.         print("ERROR: server has crashed due to a missing folder (scriptfiles/zblock)");
  60.     }
  61.     if(!fexist("/zblock/password.txt"))
  62.     {
  63.         print("WARNING: 'password.txt' does NOT exist at the 'scriptfiles/zblock' folder");
  64.         print("NOTIFICATION: attempting to create 'password.txt'");
  65.         SetTimer("CheckForFile", 5000, false);
  66.         fcreate("/zblock/password.txt");
  67.     }
  68.     else
  69.     {
  70.         new
  71.             File: zBlockstuff = fopen("/zblock/password.txt", io_read),
  72.             string[50]
  73.         ;
  74.         if(zBlockstuff)
  75.         {
  76.             if (!fread(zBlockstuff, string))
  77.             {
  78.                 new
  79.                     File: zBlockstuff2 = fopen("/zblock/password.txt", io_write)
  80.                 ;
  81.                 fwrite(zBlockstuff2, "defaultpassword5791");
  82.                 fclose(zBlockstuff2);
  83.                 DefaultPass = 1;
  84.                 print("** zBlock: 'password.txt' was empty, default password was writen");
  85.             }
  86.             else
  87.             {
  88.                 if(!strcmp(string, "defaultpassword5791", true))
  89.                 {
  90.                     DefaultPass = 1;
  91.                     print("** zBlock: Server is using the default password\n** zBlock: Please change it for your own safety.");
  92.                 }
  93.                 else
  94.                 {
  95.                     DefaultPass = 0;
  96.                     print("** zBlock: Server is NOT using the default password\n** zBlock: The 'CP' is ready for use.");
  97.                 }
  98.             }
  99.             fclose(zBlockstuff);
  100.         }
  101.         return 1;
  102.     }
  103.     SetTimer("AntiCheat", 6500, true);
  104.     foreach(Player, i)
  105.     {
  106.         ResetInfo(i);
  107.     }
  108.     ServerLocked = 0;
  109.     BanForMoneyHack = 0;
  110.     BanForSpeedHack = 1;
  111.     return 1;
  112. }
  113.  
  114. public OnFilterScriptExit()
  115. {
  116.     print("\n--------------------------------------");
  117.     print("zBlock Anti-Cheat has been disabled. . .");
  118.     print("--------------------------------------\n");
  119.     return 1;
  120. }
  121.  
  122. #endif
  123.  
  124. public OnPlayerConnect(playerid)
  125. {
  126.     if(ServerLocked == 1)
  127.     {
  128.         SendClientMessage(playerid, COLOR_NOTES2, "zBlock: The server is in 'Lock-Mode #1', you can't connect.");
  129.         SetTimerEx("KickTimer", 100, false, "i", playerid);
  130.     }
  131.     else
  132.     {
  133.         new Query[120], DBResult:Result, day, month, year, second, minute, hour, reason[20] = "Ban Evade";
  134.         getdate(day, month, year);
  135.         gettime(hour, minute, second);
  136.  
  137.         format(Query, sizeof(Query), "SELECT `NAME` FROM `BANNED` WHERE `NAME` = '%s'", DB_Escape(GetName(playerid)));
  138.         Result = db_query(zBlock, Query);
  139.         if(db_num_rows(Result))
  140.         {
  141.             ShowPlayerDialog(playerid, 0, DIALOG_STYLE_MSGBOX, "{FC4949}Ban detected.", "{FFFFFF}Our system has detected that your username is banned.\nIf you think this is a mistake visit our website.\n"WEBSITE"", "Close", "");
  142.             printf(">> %s has been kicked from OnPlayerConnect - Username ban detection", GetName(playerid));
  143.             SetTimerEx("KickTimer", 100, false, "i", playerid);
  144.  
  145.             format(Query, sizeof(Query), "SELECT `IP` FROM `BANNED` WHERE `IP` = '%s'", DB_Escape(PlayerIP(playerid)));
  146.             Result = db_query(zBlock, Query);
  147.             if(!db_num_rows(Result))
  148.             {
  149.                 format(datestring, sizeof(datestring), "%i-%i-%i", day, month, year);
  150.                 format(timestring, sizeof(timestring), "%i:%i:%i", hour, minute, second);
  151.  
  152.                 format(Query, sizeof(Query), "INSERT INTO `BANNED` (`NAME`, `IP`, `REASON`, `ADMIN`, `DATE`, `TIME`) VALUES ('%s', '%s', '%s', '%s', '%s', '%s')", DB_Escape(GetName(playerid)), DB_Escape(PlayerIP(playerid)), reason, BOT_NAME, datestring, timestring);
  153.                 Result = db_query(zBlock, Query);
  154.             }
  155.         }
  156.         else
  157.         {
  158.             format(Query, sizeof(Query), "SELECT `IP` FROM `BANNED` WHERE `IP` = '%s'", DB_Escape(PlayerIP(playerid)));
  159.             Result = db_query(zBlock, Query);
  160.             if(db_num_rows(Result))
  161.             {
  162.                 ShowPlayerDialog(playerid, 0, DIALOG_STYLE_MSGBOX, "{FC4949}Ban detected.", "{FFFFFF}Our system has detected that your ip is banned.\nIf you think this is a mistake visit our website.\n"WEBSITE"", "Close", "");
  163.                 printf(">> %s has been kicked from OnPlayerConnect - IP ban detection", GetName(playerid));
  164.                 SetTimerEx("KickTimer", 100, false, "i", playerid);
  165.  
  166.                 format(Query, sizeof(Query), "SELECT `NAME` FROM `BANNED` WHERE `NAME` = '%s'", DB_Escape(GetName(playerid)));
  167.                 Result = db_query(zBlock, Query);
  168.                 if(!db_num_rows(Result))
  169.                 {
  170.                     format(datestring, sizeof(datestring), "%i-%i-%i", day, month, year);
  171.                     format(timestring, sizeof(timestring), "%i:%i:%i", hour, minute, second);
  172.  
  173.                     format(Query, sizeof(Query), "INSERT INTO `BANNED` (`NAME`, `IP`, `REASON`, `ADMIN`, `DATE`, `TIME`) VALUES ('%s', '%s', '%s', '%s', '%s', '%s')", DB_Escape(GetName(playerid)), DB_Escape(PlayerIP(playerid)), reason, BOT_NAME, datestring, timestring);
  174.                     Result = db_query(zBlock, Query);
  175.                 }
  176.             }
  177.         }
  178.  
  179.         ResetInfo(playerid);
  180.     }
  181.     return 1;
  182. }
  183.  
  184. public OnPlayerDisconnect(playerid, reason)
  185. {
  186.     ResetInfo(playerid);
  187.     return 1;
  188. }
  189. public OnPlayerRequestSpawn(playerid)
  190. {
  191.     if(ServerLocked == 2)
  192.     {
  193.         SendClientMessage(playerid, COLOR_NOTES2, "zBlock: The server is in 'Lock-Mode #2', you can't spawn.");
  194.         return 0;
  195.     }
  196.     return 1;
  197. }
  198. public OnPlayerSpawn(playerid)
  199. {
  200.     if(FirstSpawn{ playerid })
  201.     {
  202.         TogglePlayerControllable(playerid, 0);
  203.         SendClientMessage(playerid, COLOR_NOTES2, "* Please wait for the server to processes you, and sets up data for you.");
  204.         SetTimerEx("EndProcessing", 3500, false, "i", playerid);
  205.     }
  206.     return 1;
  207. }
  208.  
  209. public OnPlayerDeath(playerid, killerid, reason)
  210. {
  211.     return 1;
  212. }
  213.  
  214. public OnPlayerText(playerid, text[])
  215. {
  216.     new stringz[108];
  217.     if(!AdminImmunity{ playerid })
  218.     {
  219.         if(!Muted{ playerid })
  220.         {
  221.             AntiSpam[playerid]++;
  222.             if(AntiSpam[playerid] >= 3 && AntiSpam[playerid] < 4) SendClientMessage(playerid, COLOR_NOTES2, "zBlock: Please stop flooding.");
  223.             else if(AntiSpam[playerid] >= 4)
  224.             {
  225.                 Muted{ playerid } = true;
  226.                 MutedTimes[playerid]++;
  227.                 if(MutedTimes[playerid] < 2)
  228.                 {
  229.                     SendClientMessage(playerid, COLOR_NOTES, "zBlock: You've been muted for 5 seconds due to flooding the chat.");
  230.                     SetTimerEx("Unmute", 5000, false, "i", playerid);
  231.                 }
  232.                 else if(MutedTimes[playerid] < 5 && MutedTimes[playerid] >= 2)
  233.                 {
  234.                     SendClientMessage(playerid, COLOR_NOTES, "zBlock: You've been muted for 20 seconds due to flooding the chat.");
  235.                     SetTimerEx("Unmute", 20000, false, "i", playerid);
  236.                 }
  237.                 else if(MutedTimes[playerid] >= 5)
  238.                 {
  239.                     Muted{ playerid } = false;
  240.                     format(stringz, sizeof(stringz), "zBlock: %s(%d) has been kicked for constant flood ( %d mutes )", GetName(playerid), playerid, MutedTimes[playerid]);
  241.                     SendClientMessageToAll(COLOR_NOTES2, stringz);
  242.  
  243.                     format(stringz, sizeof(stringz), "zBlock: You've been kicked for constant flood ( %d mutes )", MutedTimes[playerid]);
  244.                     SendClientMessage(playerid, COLOR_NOTES2, stringz);
  245.  
  246.                     SetTimerEx("KickTimer", 100, false, "i", playerid);
  247.                 }
  248.             }
  249.         }
  250.         SetTimerEx("ResetAntiSpam", 1700, false, "i", playerid);
  251.     }
  252.    
  253.     if(strfind(text, ":", true) != -1)
  254.     {
  255.         new i_numcount, i_period, i_pos;
  256.         while(text[i_pos])
  257.         {
  258.             if('0' <= text[i_pos] <= '9') i_numcount ++;
  259.             else if(text[i_pos] == '.') i_period ++;
  260.             i_pos++;
  261.         }
  262.         if(i_numcount >= 8 && i_period >= 3)
  263.         {
  264.             WarnForAdvert[playerid]++;
  265.             if(WarnForAdvert[playerid] < 2)
  266.             {
  267.                 format(stringz, sizeof(stringz), "zBlock: Advertising here isn't allowed.. ( %d warnings )", WarnForAdvert[playerid]);
  268.                 SendClientMessage(playerid, COLOR_NOTES2, stringz);
  269.                
  270.                 format(stringz, sizeof(stringz), "zBlock: Player %s(%d) has tried to advertise on the main-chat!", GetName(playerid), playerid);
  271.                 SendMessageToAdmins(COLOR_NOTES2, stringz);
  272.                
  273.                 printf("* zBlock: Advertise attempt by %s, proof: %s", GetName(playerid), text);
  274.                 return 0;
  275.             }
  276.             else if(WarnForAdvert[playerid] >= 2)
  277.             {
  278.                 new Query[240], reason[20] = "Advertisement", day, month, year, second, minute, hour;
  279.                 getdate(day, month, year);
  280.                 gettime(hour, minute, second);
  281.  
  282.                 format(datestring, sizeof(datestring), "%i-%i-%i", day, month, year);
  283.                 format(timestring, sizeof(timestring), "%i:%i:%i", hour, minute, second);
  284.  
  285.                 format(Query, sizeof(Query), "INSERT INTO `BANNED` (`NAME`, `IP`, `REASON`, `ADMIN`, `DATE`, `TIME`) VALUES ('%s', '%s', '%s', '%s', '%s', '%s')", DB_Escape(GetName(playerid)), DB_Escape(PlayerIP(playerid)), reason, BOT_NAME, datestring, timestring);
  286.                 db_query(zBlock, Query);
  287.                 SetTimerEx("KickTimer", 100, false, "i", playerid);
  288.                
  289.                 printf("* zBlock: Ban applied on '%s'\n* zBlock: Reason: Advertisement\n* zBlock: Proof: %s", GetName(playerid), text);
  290.                
  291.                 format(stringz, sizeof(stringz), "zBlock: %s(%d) has been banned for advertising", GetName(playerid), playerid);
  292.                 SendClientMessageToAll(COLOR_NOTES2, stringz);
  293.                 return 0;
  294.             }
  295.         }
  296.     }
  297.     return 1;
  298. }
  299. public OnPlayerCommandPerformed(playerid, cmdtext[], success)
  300. {
  301.     new stringz[72];
  302.     if(strfind(cmdtext, ":", true) != -1)
  303.     {
  304.         new i_numcount, i_period, i_pos;
  305.         while(cmdtext[i_pos])
  306.         {
  307.             if('0' <= cmdtext[i_pos] <= '9') i_numcount ++;
  308.             else if(cmdtext[i_pos] == '.') i_period ++;
  309.             i_pos++;
  310.         }
  311.         if(i_numcount >= 8 && i_period >= 3)
  312.         {
  313.             WarnForAdvert[playerid]++;
  314.             if(WarnForAdvert[playerid] < 2)
  315.             {
  316.                 format(stringz, sizeof(stringz), "zBlock: Advertising here isn't allowed.. ( %d warnings )", WarnForAdvert[playerid]);
  317.                 SendClientMessage(playerid, COLOR_NOTES2, stringz);
  318.                
  319.                 format(stringz, sizeof(stringz), "zBlock: Player %s(%d) has tried to advertise via a command!", GetName(playerid), playerid);
  320.                 SendMessageToAdmins(COLOR_NOTES2, stringz);
  321.                
  322.                 printf("* zBlock: Advertise attempt by %s, proof: %s", GetName(playerid), cmdtext);
  323.                 return 0;
  324.             }
  325.             else if(WarnForAdvert[playerid] >= 2)
  326.             {
  327.                 new Query[240], reason[20] = "Advertisement", day, month, year, second, minute, hour;
  328.                 getdate(day, month, year);
  329.                 gettime(hour, minute, second);
  330.  
  331.                 format(datestring, sizeof(datestring), "%i-%i-%i", day, month, year);
  332.                 format(timestring, sizeof(timestring), "%i:%i:%i", hour, minute, second);
  333.  
  334.                 format(Query, sizeof(Query), "INSERT INTO `BANNED` (`NAME`, `IP`, `REASON`, `ADMIN`, `DATE`, `TIME`) VALUES ('%s', '%s', '%s', '%s', '%s', '%s')", DB_Escape(GetName(playerid)), DB_Escape(PlayerIP(playerid)), reason, BOT_NAME, datestring, timestring);
  335.                 db_query(zBlock, Query);
  336.                 SetTimerEx("KickTimer", 100, false, "i", playerid);
  337.  
  338.                 printf("* zBlock: Ban applied on '%s'\n* zBlock: Reason: Advertisement\n* zBlock: Proof: %s", GetName(playerid), cmdtext);
  339.  
  340.                 format(stringz, sizeof(stringz), "zBlock: %s(%d) has been banned for advertising", GetName(playerid), playerid);
  341.                 SendClientMessageToAll(COLOR_NOTES2, stringz);
  342.                 return 0;
  343.             }
  344.         }
  345.     }
  346.     return 1;
  347. }
  348. CMD:zblock_login(playerid, params[])
  349. {
  350.     new FirstParam[50], string[82];
  351.     if(fexist("/zblock/password.txt"))
  352.     {
  353.         if(!DefaultPass)
  354.         {
  355.             if(sscanf(params, "s[50]", FirstParam)) return SendClientMessage(playerid, COLOR_NOTES, "/zblock_login (password)");
  356.             if(isnull(params)) return SendClientMessage(playerid, COLOR_NOTES2, "* You didn't type anything in the Password 'slot'!");
  357.            
  358.             new
  359.                 File: zBlockstuff = fopen("/zblock/password.txt", io_read)
  360.             ;
  361.             if(zBlockstuff)
  362.             {
  363.                 if(!LoggedIn{ playerid })
  364.                 {
  365.                     fread(zBlockstuff, string);
  366.                     fclose(zBlockstuff);
  367.                     if(!strcmp(FirstParam, string, true))
  368.                     {
  369.                         LoggedIn{ playerid } = true;
  370.                         AdminImmunity{ playerid } = true;
  371.                        
  372.                         format(string, sizeof(string), "zBlock: %s(%d) has logged in the zBlock 'CP', and has received his 'Immunity'", GetName(playerid), playerid);
  373.                         SendMessageToAdmins(COLOR_NOTES, string);
  374.                     }
  375.                     else SendClientMessage(playerid, COLOR_NOTES2, "zBlock: Invalid Password!");
  376.                 }
  377.                 else SendClientMessage(playerid, COLOR_NOTES, "zBlock: You're already logged in!");
  378.             }
  379.             else SendClientMessage(playerid, COLOR_NOTES2, "zBlock: Can't find 'password.txt' file..");
  380.         }
  381.         else SendClientMessage(playerid, COLOR_NOTES2, "zBlock: Server is using Default Password, logging in is forbidden!");
  382.     }
  383.     FirstParam = "\0", string = "\0";
  384.     return 1;
  385. }
  386. CMD:zblock(playerid, params[])
  387. {
  388.     new FirstParam[18], SecondParam[50], messagestring[112], extradialog[240], string[82], hackerstring[148], count = 0;
  389.     if(fexist("/zblock/password.txt"))
  390.     {
  391.         new
  392.             File: zBlockstuff = fopen("/zblock/password.txt", io_read)
  393.         ;
  394.         if(zBlockstuff)
  395.         {
  396.             fread(zBlockstuff, string);
  397.             fclose(zBlockstuff);
  398.         }
  399.         if(LoggedIn{ playerid })
  400.         {
  401.             if(sscanf(params, "s[18]", FirstParam)) return SendClientMessage(playerid, COLOR_NOTES, "/zblock (hackers/changepassword/lock/settings)");
  402.             {
  403.                 if(strcmp(FirstParam, "suspects", true, 8) == 0 || strcmp(FirstParam, "hackers", true, 7) == 0 )
  404.                 {
  405.                     if(AdminImmunity{ playerid })
  406.                     {
  407.                         foreach(Player, i)
  408.                         {
  409.                             if(ACTimesDetected[i] >= 1) count++;
  410.                         }
  411.                         if(count >= 1)
  412.                         {
  413.                             foreach(Player, i)
  414.                             {
  415.                                 if(ACTimesDetected[i] >= 1)
  416.                                 {
  417.                                     format(hackerstring, sizeof(hackerstring), "{FFCC66}%s\n%s(%d) - IP: %s - Has been detected %d times", hackerstring, GetName(i), i, PlayerIP(i), ACTimesDetected[i]);
  418.                                 }
  419.                             }
  420.                             ShowPlayerDialog(playerid, DIALOG_SUSPECTS, DIALOG_STYLE_MSGBOX, "{FF9933}zBlock CP {FF6633}(v1.5)", hackerstring, "Close", "");
  421.                         }
  422.                         else ShowPlayerDialog(playerid, DIALOG_SUSPECTS, DIALOG_STYLE_MSGBOX, "{FF9933}zBlock CP {FF6633}(v1.5)", "{FFCC66}No hackers detected", "Close", "");
  423.                     }
  424.                 }
  425.                 else if(strcmp(FirstParam, "changepassword", true, 14) == 0)
  426.                 {
  427.                     if(IsPlayerAdmin(playerid) && AdminImmunity{ playerid })
  428.                     {
  429.                         if(zBlockstuff)
  430.                         {
  431.                             if(sscanf(params, "s[50]", SecondParam))
  432.                             {
  433.                                 SendClientMessage(playerid, COLOR_NOTES, "/zblock (changepassword) (newpass)");
  434.                             }
  435.                             else
  436.                             {
  437.                                 if(!isnull(SecondParam))
  438.                                 {
  439.                                     SecondParam = "\0";
  440.  
  441.                                     zBlockstuff = fopen("/zblock/password.txt", io_write);
  442.                                     fwrite(zBlockstuff, SecondParam);
  443.                                     fclose(zBlockstuff);
  444.  
  445.                                     format(messagestring, sizeof(messagestring), "zBlock: %s(%d) has changed the password to %s", GetName(playerid), playerid, SecondParam);
  446.                                     SendMessageToAdmins(COLOR_NOTES2, messagestring);
  447.  
  448.                                     printf("* zBlock: PASS CHANGE! %s has changed the password to %s!", GetName(playerid), SecondParam);
  449.                                 }
  450.                             }
  451.                         }
  452.                     }
  453.                     else SendClientMessage(playerid, COLOR_NOTES2, "zBlock: You aren't an RCON admin, or an zBlock 'CP admin'!");
  454.                 }
  455.                 else if(strcmp(FirstParam, "lock", true, 4) == 0)
  456.                 {
  457.                     if(IsPlayerAdmin(playerid) && AdminImmunity{ playerid })
  458.                     {
  459.                         if(zBlockstuff)
  460.                         {
  461.                             if(ServerLocked == 0)
  462.                             {
  463.                                 ShowPlayerDialog(playerid, DIALOG_LOCKMODE, DIALOG_STYLE_LIST, "{FF9933}zBlock CP {FF6633}(v1.5)", "{FF9933}Lock Mode #1 {FF6633}- Disable connections\n{FF9933}Lock Mode #2 {FF6633}- Disable spawning", "Select", "Close");
  464.                             }
  465.                             else if(ServerLocked == 1)
  466.                             {
  467.                                 ShowPlayerDialog(playerid, DIALOG_LOCKMODE, DIALOG_STYLE_LIST, "{FF9933}zBlock CP {FF6633}(v1.5)", "{FF9933}Lock Mode #0 {FF6633}- Disable lock-mode\n{FF9933}Lock Mode #2 {FF6633}- Disable spawning", "Select", "Close");
  468.                             }
  469.                             else if(ServerLocked == 2)
  470.                             {
  471.                                 ShowPlayerDialog(playerid, DIALOG_LOCKMODE, DIALOG_STYLE_LIST, "{FF9933}zBlock CP {FF6633}(v1.5)", "{FF9933}Lock Mode #0 {FF6633}- Disable lock-mode\n{FF9933}Lock Mode #1 {FF6633}- Disable connections", "Select", "Close");
  472.                             }
  473.                         }
  474.                     }
  475.                     else SendClientMessage(playerid, COLOR_NOTES2, "zBlock: You aren't an RCON admin, or an zBlock 'CP admin'!");
  476.                 }
  477.                 else if(strcmp(FirstParam, "settings", true, 8) == 0)
  478.                 {
  479.                     if(AdminImmunity{ playerid })
  480.                     {
  481.                         if(zBlockstuff)
  482.                         {
  483.                             if(!BanForMoneyHack)
  484.                             {
  485.                                 format(extradialog, sizeof(extradialog), "{FF9933}Enable {FF6633}'Ban for Money-Hack'");
  486.                             }
  487.                             else
  488.                             {
  489.                                 format(extradialog, sizeof(extradialog), "{FF9933}Disable {FF6633}'Ban for Money-Hack'");
  490.                             }
  491.                             if(!BanForSpeedHack)
  492.                             {
  493.                                 format(extradialog, sizeof(extradialog), "%s\n{FF9933}Enable {FF6633}'Ban for Speed-Hack'", extradialog);
  494.                             }
  495.                             else
  496.                             {
  497.                                 format(extradialog, sizeof(extradialog), "%s\n{FF9933}Disable {FF6633}'Ban for Speed-Hack'", extradialog);
  498.                             }
  499.                             ShowPlayerDialog(playerid, DIALOG_SETTINGS, DIALOG_STYLE_LIST, "{FF9933}zBlock CP {FF6633}(v1.5)", extradialog, "Select", "Close");
  500.                         }
  501.                     }
  502.                 }
  503.             }
  504.         }
  505.         else SendClientMessage(playerid, COLOR_NOTES2, "zBlock: You have to be logged in via the zBlock 'CP'!");
  506.     }
  507.     else SendClientMessage(playerid, COLOR_NOTES2, "zBlock: File 'password.txt' does NOT exist, zBlock CP is DISABLED.");
  508.    
  509.     FirstParam = "\0", SecondParam = "\0", messagestring = "\0", hackerstring = "\0", string = "\0", extradialog = "\0";
  510.     return 1;
  511. }
  512. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  513. {
  514.     new string[92];
  515.     switch(dialogid)
  516.     {
  517.         case DIALOG_LOCKMODE:
  518.         {
  519.             if(response)
  520.             {
  521.                 if(ServerLocked == 0)
  522.                 {
  523.                     switch(listitem)
  524.                     {
  525.                         case 0:
  526.                         {
  527.                             ServerLocked = 1;
  528.                             format(string, sizeof(string), "zBlock: %s(%d) has enabled Lock-Mode #1 ( Connections will be 'rejected' )", GetName(playerid), playerid);
  529.                             SendClientMessageToAll(COLOR_NOTES2, string);
  530.                             foreach(Player, i)
  531.                             {
  532.                                 PlayerPlaySound(i, 1085, 0.0, 0.0, 0.0);
  533.                             }
  534.                         }
  535.                         case 1:
  536.                         {
  537.                             ServerLocked = 2;
  538.                             format(string, sizeof(string), "zBlock: %s(%d) has enabled Lock-Mode #2 ( Spawning is disabled )", GetName(playerid), playerid);
  539.                             SendClientMessageToAll(COLOR_NOTES2, string);
  540.                             foreach(Player, i)
  541.                             {
  542.                                 PlayerPlaySound(i, 1085, 0.0, 0.0, 0.0);
  543.                             }
  544.                         }
  545.                     }
  546.                 }
  547.                 else if(ServerLocked == 1)
  548.                 {
  549.                     switch(listitem)
  550.                     {
  551.                         case 0:
  552.                         {
  553.                             ServerLocked = 0;
  554.                             format(string, sizeof(string), "zBlock: %s(%d) has disabled Lock-Mode ( Spawning/Connecting is allowed )", GetName(playerid), playerid);
  555.                             SendClientMessageToAll(COLOR_NOTES, string);
  556.                             foreach(Player, i)
  557.                             {
  558.                                 PlayerPlaySound(i, 1083, 0.0, 0.0, 0.0);
  559.                             }
  560.                         }
  561.                         case 1:
  562.                         {
  563.                             ServerLocked = 2;
  564.                             format(string, sizeof(string), "zBlock: %s(%d) has enabled Lock-Mode #2 ( Spawning is disabled )", GetName(playerid), playerid);
  565.                             SendClientMessageToAll(COLOR_NOTES2, string);
  566.                             foreach(Player, i)
  567.                             {
  568.                                 PlayerPlaySound(i, 1085, 0.0, 0.0, 0.0);
  569.                             }
  570.                         }
  571.                     }
  572.                 }
  573.                 else if(ServerLocked == 2)
  574.                 {
  575.                     switch(listitem)
  576.                     {
  577.                         case 0:
  578.                         {
  579.                             ServerLocked = 0;
  580.                             format(string, sizeof(string), "zBlock: %s(%d) has disabled Lock-Mode ( Spawning/Connecting is allowed )", GetName(playerid), playerid);
  581.                             SendClientMessageToAll(COLOR_NOTES, string);
  582.                             foreach(Player, i)
  583.                             {
  584.                                 PlayerPlaySound(i, 1083, 0.0, 0.0, 0.0);
  585.                             }
  586.                         }
  587.                         case 1:
  588.                         {
  589.                             ServerLocked = 1;
  590.                             format(string, sizeof(string), "zBlock: %s(%d) has enabled Lock-Mode #1 ( Connections will be 'rejected' )", GetName(playerid), playerid);
  591.                             SendClientMessageToAll(COLOR_NOTES2, string);
  592.                             foreach(Player, i)
  593.                             {
  594.                                 PlayerPlaySound(i, 1085, 0.0, 0.0, 0.0);
  595.                             }
  596.                         }
  597.                     }
  598.                 }
  599.             }
  600.         }
  601.         case DIALOG_SETTINGS:
  602.         {
  603.             if(response)
  604.             {
  605.                 switch(listitem)
  606.                 {
  607.                     case 0:
  608.                     {
  609.                         if(!BanForMoneyHack)
  610.                         {
  611.                             BanForMoneyHack = 1;
  612.                             format(string, sizeof(string), "zBlock: %s(%d) has enabled the 'Ban for Money-Hack' feature.", GetName(playerid), playerid);
  613.                             SendClientMessageToAll(COLOR_NOTES, string);
  614.                             foreach(Player, i)
  615.                             {
  616.                                 PlayerPlaySound(i, 1085, 0.0, 0.0, 0.0);
  617.                             }
  618.                         }
  619.                         else
  620.                         {
  621.                             BanForMoneyHack = 0;
  622.                             format(string, sizeof(string), "zBlock: %s(%d) has disabled the 'Ban for Money-Hack' feature.", GetName(playerid), playerid);
  623.                             SendClientMessageToAll(COLOR_NOTES2, string);
  624.                             SendMessageToAdmins(COLOR_NOTES2, "zBlock: The hacked money will be removed!");
  625.                             foreach(Player, i)
  626.                             {
  627.                                 PlayerPlaySound(i, 1085, 0.0, 0.0, 0.0);
  628.                             }
  629.                         }
  630.                     }
  631.                     case 1:
  632.                     {
  633.                         if(!BanForSpeedHack)
  634.                         {
  635.                             BanForSpeedHack = 1;
  636.                             format(string, sizeof(string), "zBlock: %s(%d) has enabled the 'Ban for Speed-Hack' feature.", GetName(playerid), playerid);
  637.                             SendClientMessageToAll(COLOR_NOTES, string);
  638.                             foreach(Player, i)
  639.                             {
  640.                                 PlayerPlaySound(i, 1085, 0.0, 0.0, 0.0);
  641.                             }
  642.                         }
  643.                         else
  644.                         {
  645.                             BanForSpeedHack = 0;
  646.                             format(string, sizeof(string), "zBlock: %s(%d) has disabled the 'Ban for Speed-Hack' feature.", GetName(playerid), playerid);
  647.                             SendClientMessageToAll(COLOR_NOTES2, string);
  648.                             foreach(Player, i)
  649.                             {
  650.                                 PlayerPlaySound(i, 1085, 0.0, 0.0, 0.0);
  651.                             }
  652.                         }
  653.                     }
  654.                 }
  655.             }
  656.         }
  657.     }
  658.     return 1;
  659. }
  660. public OnPlayerExitVehicle(playerid, vehicleid)
  661. {
  662.     return 1;
  663. }
  664.  
  665. public OnPlayerStateChange(playerid, newstate, oldstate)
  666. {
  667.     return 1;
  668. }
  669.  
  670. public OnVehicleMod(playerid, vehicleid, componentid)
  671. {
  672.     return 1;
  673. }
  674.  
  675. public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
  676. {
  677.     return 1;
  678. }
  679.  
  680. public OnVehicleRespray(playerid, vehicleid, color1, color2)
  681. {
  682.     return 1;
  683. }
  684.  
  685. public OnRconLoginAttempt(ip[], password[], success)
  686. {
  687.     new stringz[92];
  688.     if(!success)
  689.     {
  690.         foreach(Player, i)
  691.         {
  692.             GetPlayerIp(i, ip, 16);
  693.  
  694.             if(strcmp(PlayerIP(i),ip) == 0)
  695.             {
  696.                 RCONLoginFails[i]++;
  697.                 if(RCONLoginFails[i] <= 2)
  698.                 {
  699.                     SendClientMessage(i, COLOR_NOTES2, "zBlock: Please don't try to get the RCON pass..");
  700.                     return 0;
  701.                 }
  702.                 else
  703.                 {
  704.                     RCONLoginFails[i] = 0;
  705.  
  706.                     new Query[240], DBResult:result, day, month, year, second, minute, hour;
  707.                     new reason[20] = "RCON Login Attempt";
  708.  
  709.                     getdate(day, month, year);
  710.                     gettime(hour, minute, second);
  711.                     format(datestring, sizeof(datestring), "%i-%i-%i", day, month, year);
  712.                     format(timestring, sizeof(timestring), "%i:%i:%i", hour, minute, second);
  713.  
  714.                     format(Query, sizeof(Query), "INSERT INTO `BANNED` (`NAME`, `IP`, `REASON`, `ADMIN`, `DATE`, `TIME`) VALUES ('%s', '%s', '%s', '%s', '%s', '%s')", DB_Escape(GetName(i)), DB_Escape(PlayerIP(i)), reason, BOT_NAME, datestring, timestring);
  715.                     result = db_query(zBlock, Query);
  716.                     if(result) printf(">> SQLITE: successfully added %s's ban info", GetName(i));
  717.                     else printf(">> SQLITE: could not add %s's ban info", GetName(i));
  718.  
  719.  
  720.                     SetTimerEx("KickTimer", 100, false, "i", i);
  721.  
  722.                     format(stringz, sizeof(stringz), "* {F81414}zBlock has banned {FFFFFF}%s(%d) {F81414}for {FFFFFF}RCON Login attempts!", GetName(i), i);
  723.                     SendClientMessageToAll(-1, stringz);
  724.                 }
  725.             }
  726.         }
  727.     }
  728.     else
  729.     {
  730.         foreach(Player, i)
  731.         {
  732.             GetPlayerIp(i, ip, 16);
  733.             if(strcmp(PlayerIP(i),ip) == 0)
  734.             {
  735.                 if(!AdminImmunity{ i })
  736.                 {
  737.                     SendClientMessage(i, COLOR_NOTES, "zBlock: RCON login successfull, use '/zblock_login (password)' to get your 'Immunity'");
  738.                 }
  739.             }
  740.         }
  741.     }
  742.     return 1;
  743. }
  744.  
  745. public OnPlayerUpdate(playerid)
  746. {
  747.     return 1;
  748. }
  749.  
  750. /***** STOCKs, zBlock TIMERs etc. *****/
  751.  
  752. stock SendMessageToAdmins(color, text[])
  753. {
  754.     foreach(Player, i)
  755.     {
  756.         if(AdminImmunity{ i })
  757.         {
  758.             SendClientMessage(i, color, text);
  759.         }
  760.     }
  761. }
  762.  
  763. stock GetName(playerid)
  764. {
  765.     new pnameid[24];
  766.     GetPlayerName(playerid,pnameid,sizeof(pnameid));
  767.     return pnameid;
  768. }
  769. stock PlayerIP(playerid)
  770. {
  771.     new str[16];
  772.     GetPlayerIp(playerid, str, sizeof(str));
  773.     return str;
  774. }
  775.  
  776. stock ResetInfo(playerid)
  777. {
  778.     Muted{ playerid } = false;
  779.     ACDetected{ playerid } = false;
  780.     AdminImmunity{ playerid } = false;
  781.     LoggedIn{ playerid } = false;
  782.    
  783.     AntiSpam[playerid] = 0;
  784.     MutedTimes[playerid] = 0;
  785.     ACTimesDetected[playerid] = 0;
  786.     WarnForAdvert[playerid] = 0;
  787.     RCONLoginFails[playerid] = 0;
  788. }
  789. stock DB_Escape(text[])
  790. {
  791.     new
  792.         ret[80 * 2],
  793.         ch,
  794.         i,
  795.         j;
  796.     while ((ch = text[i++]) && j < sizeof (ret))
  797.     {
  798.         if (ch == '\'')
  799.         {
  800.             if (j < sizeof (ret) - 2)
  801.             {
  802.                 ret[j++] = '\'';
  803.                 ret[j++] = '\'';
  804.             }
  805.         }
  806.         else if (j < sizeof (ret))
  807.         {
  808.             ret[j++] = ch;
  809.         }
  810.         else
  811.         {
  812.             j++;
  813.         }
  814.     }
  815.     ret[sizeof (ret) - 1] = '\0';
  816.     return ret;
  817. }
  818. stock GetPlayerSpeed(playerid)
  819. {
  820.     new Float:ST[4];
  821.     if(IsPlayerInAnyVehicle(playerid))
  822.     GetVehicleVelocity(GetPlayerVehicleID(playerid),ST[0],ST[1],ST[2]);
  823.     else GetPlayerVelocity(playerid,ST[0],ST[1],ST[2]);
  824.     ST[3] = floatsqroot(floatpower(floatabs(ST[0]), 2.0) + floatpower(floatabs(ST[1]), 2.0) + floatpower(floatabs(ST[2]), 2.0)) * 179.28625;
  825.     return floatround(ST[3]);
  826. }
  827. stock GivePlayerCash(playerid, money)
  828. {
  829.     Cash[playerid] += money;
  830.     ResetMoneyBar(playerid);
  831.     UpdateMoneyBar(playerid,Cash[playerid]);
  832.     return Cash[playerid];
  833. }
  834. stock SetPlayerCash(playerid, money)
  835. {
  836.     Cash[playerid] = money;
  837.     ResetMoneyBar(playerid);
  838.     UpdateMoneyBar(playerid,Cash[playerid]);
  839.     return Cash[playerid];
  840. }
  841. stock ResetPlayerCash(playerid)
  842. {
  843.     Cash[playerid] = 0;
  844.     ResetMoneyBar(playerid);
  845.     UpdateMoneyBar(playerid,Cash[playerid]);
  846.     return Cash[playerid];
  847. }
  848. stock GetPlayerCash(playerid)
  849. {
  850.     return Cash[playerid];
  851. }
  852. forward KickTimer(playerid);
  853. public KickTimer(playerid)
  854. {
  855.     Kick(playerid);
  856.     return 1;
  857. }
  858. forward Unmute(playerid);
  859. public Unmute(playerid)
  860. {
  861.     Muted{ playerid } = false;
  862.     return 1;
  863. }
  864. forward ResetAntiSpam(playerid);
  865. public ResetAntiSpam(playerid)
  866. {
  867.     AntiSpam[playerid] = 0;
  868.     return 1;
  869. }
  870. forward AntiCheat();
  871. public AntiCheat()
  872. {
  873.     new Float:health, Float:armour, reason[24], stringz[120];
  874.     new Float:x,Float:y,Float:z;
  875.     new anim;
  876.     new Difference, Result;
  877.  
  878.     new Query[240], DBResult:result, day, month, year, second, minute, hour;
  879.     getdate(day, month, year);
  880.     gettime(hour, minute, second);
  881.    
  882.     format(datestring, sizeof(datestring), "%i-%i-%i", day, month, year);
  883.     format(timestring, sizeof(timestring), "%i:%i:%i", hour, minute, second);
  884.  
  885.     foreach(Player, i)
  886.     {
  887.         GetPlayerHealth(i, health);
  888.         GetPlayerArmour(i, armour);
  889.         anim = GetPlayerAnimationIndex(i);
  890.         GetPlayerVelocity(i,x,y,z);
  891.        
  892.         if(!AdminImmunity{ i })
  893.         {
  894.             if(GetPlayerWeapon(i) == 38)
  895.             {
  896.                 reason = "Minigun";
  897.                 format(stringz, sizeof(stringz), "* {F81414}zBlock has banned {FFFFFF}%s(%d) {F81414}for using {FFFFFF}Weapon Hacks!", GetName(i), i);
  898.                 SendClientMessageToAll(-1, stringz);
  899.                 SetTimerEx("KickTimer", 100, false, "i", i);
  900.  
  901.                 format(Query, sizeof(Query), "INSERT INTO `BANNED` (`NAME`, `IP`, `REASON`, `ADMIN`, `DATE`, `TIME`) VALUES ('%s', '%s', '%s', '%s', '%s', '%s')", DB_Escape(GetName(i)), DB_Escape(PlayerIP(i)), reason, BOT_NAME, datestring, timestring);
  902.                 result = db_query(zBlock, Query);
  903.  
  904.                 if(result) printf(">> SQLITE: successfully added %s's ban info", GetName(i));
  905.                 else printf(">> SQLITE: could not add %s's ban info", GetName(i));
  906.  
  907.                 printf("« ANTI-CHEAT has banned %s for using Weapon-Hacks!", GetName(i));
  908.             }
  909.             if(x <= -0.800000  || y <= -0.800000 || z <= -0.800000 && anim == 1008)
  910.             {
  911.                 if(GetPlayerWeapon(i) != 46)
  912.                 {
  913.                     ACTimesDetected[i]++;
  914.                     if(ACTimesDetected[i] < 3)
  915.                     {
  916.                         format(stringz, sizeof(stringz), "* {F81414}zBlock has detected {FFFFFF}%s(%d){F81414} using {FFFFFF}Fly hacks!", GetName(i), i);
  917.                         SendMessageToAdmins(-1, stringz);
  918.                     }
  919.                     else if(ACTimesDetected[i] >= 3)
  920.                     {
  921.                         reason = "Fly hack";
  922.                         format(stringz, sizeof(stringz), "* {F81414}zBlock has banned {FFFFFF}%s(%d) {F81414}for using {FFFFFF}Fly Hacks!", GetName(i), i);
  923.                         SendClientMessageToAll(-1, stringz);
  924.                         SetTimerEx("KickTimer", 100, false, "i", i);
  925.  
  926.                         format(Query, sizeof(Query), "INSERT INTO `BANNED` (`NAME`, `IP`, `REASON`, `ADMIN`, `DATE`, `TIME`) VALUES ('%s', '%s', '%s', '%s', '%s', '%s')", DB_Escape(GetName(i)), DB_Escape(PlayerIP(i)), reason, BOT_NAME, datestring, timestring);
  927.                         result = db_query(zBlock, Query);
  928.  
  929.                         if(result) printf(">> SQLITE: successfully added %s's ban info", GetName(i));
  930.                         else printf(">> SQLITE: could not add %s's ban info", GetName(i));
  931.  
  932.                         printf("zBlock: %s has been banned for using Fly-Hacks!", GetName(i));
  933.                     }
  934.                 }
  935.             }
  936.             if(armour >= 100)
  937.             {
  938.                 if(ACTimesDetected[i] == 0)
  939.                 {
  940.                     ACTimesDetected[i]++;
  941.  
  942.                     format(stringz, sizeof(stringz), "* {F81414}zBlock has detected {FFFFFF}%s(%d) {F81414}POSSIBLY using {FFFFFF}Armour hacks!", GetName(i), i);
  943.                     SendMessageToAdmins(-1, stringz);
  944.                 }
  945.             }
  946.             if(GetPlayerSpeed(i) > 271)
  947.             {
  948.                 ACTimesDetected[i]++;
  949.                 if(ACTimesDetected[i] <= 4)
  950.                 {
  951.                     format(stringz, sizeof(stringz), "zBlock: %s(%d) is possibly Speed-Hacking, KM/H: %d - %d warnings", GetName(i), i, GetPlayerSpeed(i), ACTimesDetected[i]);
  952.                     SendMessageToAdmins(COLOR_NOTES2, stringz);
  953.                     printf("zBlock: %s has been detected using Speed-Hacks | %d KM/H, %d/5 warnings |", GetName(i), GetPlayerSpeed(i), ACTimesDetected[i]);
  954.                 }
  955.                 else
  956.                 {
  957.                     if(BanForSpeedHack)
  958.                     {
  959.                         reason = "Speed Hack";
  960.                         format(stringz, sizeof(stringz), "zBlock: %s(%d) has been BANNED for using Speed-Hacks %d warnings", GetName(i), i, ACTimesDetected[i]);
  961.                         SendMessageToAdmins(COLOR_NOTES2, stringz);
  962.  
  963.                         SetTimerEx("KickTimer", 100, false, "i", i);
  964.  
  965.                         format(stringz, sizeof(stringz), "* {F81414}zBlock has banned {FFFFFF}%s(%d) {F81414}for using Speed hacks!", GetName(i), i);
  966.                         SendClientMessageToAll(-1, stringz);
  967.                         printf("zBlock: %s has been banned for using Speed-Hacks!", GetName(i));
  968.  
  969.                         format(Query, sizeof(Query), "INSERT INTO `BANNED` (`NAME`, `IP`, `REASON`, `ADMIN`, `DATE`, `TIME`) VALUES ('%s', '%s', '%s', '%s', '%s', '%s')", DB_Escape(GetName(i)), DB_Escape(PlayerIP(i)), reason, BOT_NAME, datestring, timestring);
  970.                         result = db_query(zBlock, Query);
  971.                         if(result) printf(">> SQLITE: successfully added %s's ban info", GetName(i));
  972.                         else printf(">> SQLITE: could not add %s's ban info", GetName(i));
  973.                     }
  974.                 }
  975.                 printf("*** zBlock: %s | Possibly speed-hacking, %d/271", GetName(i), GetPlayerSpeed(i));
  976.             }
  977.             if(GetPlayerCash(i) > GetPlayerMoney(i))
  978.             {
  979.                 if(!BanForMoneyHack)
  980.                 {
  981.                     ACDetected{ i } = true;
  982.                     ACTimesDetected[i]++;
  983.                    
  984.                     if(!ACDetected { i })
  985.                     {
  986.                         format(stringz, sizeof(stringz), "zBlock: %s(%d) is ( possibly ) Money-Hacking, money reset.", GetName(i), i);
  987.                         SendMessageToAdmins(COLOR_NOTES2, stringz);
  988.                         format(stringz, sizeof(stringz), "zBlock: Summary about %s's warning: SSM: %d$ PSM: %d$", GetPlayerCash(i), GetPlayerMoney(i));
  989.                         SendMessageToAdmins(COLOR_NOTES2, stringz);
  990.                     }
  991.                    
  992.                     Difference = GetPlayerCash(i) - GetPlayerMoney(i);
  993.                     Result = GetPlayerCash(i) - Difference;
  994.                     SetPlayerCash(i, Result);
  995.                 }
  996.                 else
  997.                 {
  998.                     ACTimesDetected[i]++;
  999.                     reason = "Money hack";
  1000.                     Difference = GetPlayerCash(i) - GetPlayerMoney(i);
  1001.                     Result = GetPlayerCash(i) - Difference;
  1002.                    
  1003.                     printf("* zBlock: Adding ban on '%s' due to Money-Hacks", GetName(i));
  1004.                     printf("* zBlock: Proof: (SERVER SIDE) %d$ - (PLAYER SIDE) %d$, %d$ difference.", GetPlayerCash(i), GetPlayerMoney(i), Difference);
  1005.  
  1006.                     SetTimerEx("KickTimer", 100, false, "i", i);
  1007.  
  1008.                     format(stringz, sizeof(stringz), "* {F81414}zBlock has banned {FFFFFF}%s(%d) {F81414}for using Money hacks!", GetName(i), i);
  1009.                     SendClientMessageToAll(-1, stringz);
  1010.  
  1011.                     format(Query, sizeof(Query), "INSERT INTO `BANNED` (`NAME`, `IP`, `REASON`, `ADMIN`, `DATE`, `TIME`) VALUES ('%s', '%s', '%s', '%s', '%s', '%s')", DB_Escape(GetName(i)), DB_Escape(PlayerIP(i)), reason, BOT_NAME, datestring, timestring);
  1012.                     result = db_query(zBlock, Query);
  1013.                     if(result) printf(">> SQLITE: successfully added %s's ban info", GetName(i));
  1014.                     else printf(">> SQLITE: could not add %s's ban info", GetName(i));
  1015.                 }
  1016.             }
  1017.         }
  1018.     }
  1019.     return 1;
  1020. }
  1021. forward EndProcessing(playerid);
  1022. public EndProcessing(playerid)
  1023. {
  1024.     new Float:x, Float:y, Float:z, reason[18] = "s0beit client", stringz[112];
  1025.     GetPlayerCameraFrontVector(playerid, x, y, z);
  1026.     #pragma unused x
  1027.     #pragma unused y
  1028.     if(z < -0.8)
  1029.     {
  1030.  
  1031.         SendClientMessage(playerid, COLOR_NOTES, "Processed successfully.");
  1032.  
  1033.         ACDetected{ playerid } = true;
  1034.         FirstSpawn{ playerid } = true;
  1035.  
  1036.         ACTimesDetected[playerid]++;
  1037.         if(ACTimesDetected[playerid] == 1)
  1038.         {
  1039.             printf("« ANTI-CHEAT has detected %s using Hacked Client - s0beit! »", GetName(playerid));
  1040.         }
  1041.         else if(ACTimesDetected[playerid] == 2)
  1042.         {
  1043.             SpawnPlayer(playerid);
  1044.             printf("« ANTI-CHEAT has detected %s using Hacked Client - s0beit! »", GetName(playerid));
  1045.         }
  1046.         else if(ACTimesDetected[playerid] >= 3)
  1047.         {
  1048.             SetTimerEx("KickTimer", 100, false, "i", playerid);
  1049.  
  1050.             SendClientMessage(playerid, -1, "{F81414}zBlock {FFFFFF}- {F81414}You've been banned for using {FFFFFF}s0beit {F81414}client!");
  1051.             format(stringz, sizeof(stringz), "* {F81414}zBlock has banned {FFFFFF}%s(%d){F81414} for using {FFFFFF}s0beit {F81414}client!", GetName(playerid), playerid);
  1052.             SendClientMessageToAll(-1, stringz);
  1053.  
  1054.             printf("« ANTI-CHEAT has banned %s for Hacked Client - s0beit! »", GetName(playerid));
  1055.             SetPlayerSpecialAction(playerid,SPECIAL_ACTION_HANDSUP);
  1056.  
  1057.             new Query[240], DBResult:result,  day, month, year, second, minute, hour;
  1058.             getdate(day, month, year);
  1059.             gettime(hour, minute, second);
  1060.  
  1061.             format(datestring, sizeof(datestring), "%i-%i-%i", day, month, year);
  1062.             format(timestring, sizeof(timestring), "%i:%i:%i", hour, minute, second);
  1063.  
  1064.             format(Query, sizeof(Query), "INSERT INTO `BANNED` (`NAME`, `IP`, `REASON`, `ADMIN`, `DATE`, `TIME`) VALUES ('%s', '%s', '%s', '%s', '%s', '%s')", DB_Escape(GetName(playerid)), DB_Escape(PlayerIP(playerid)), reason, BOT_NAME, datestring, timestring);
  1065.             result = db_query(zBlock, Query);
  1066.             if(result) printf(">> SQLITE: successfully added %s's ban info", GetName(playerid));
  1067.             else printf(">> SQLITE: could not add %s's ban info", GetName(playerid));
  1068.         }
  1069.     }
  1070.     else
  1071.     {
  1072.         SendClientMessage(playerid, -1, "Processed successfully.");
  1073.         FirstSpawn{ playerid } = false;
  1074.         TogglePlayerControllable(playerid, 1);
  1075.     }
  1076.     return 1;
  1077. }
  1078. forward CheckForFile();
  1079. public CheckForFile()
  1080. {
  1081.     new slhour, slminute, slsecond, slyear, slmonth, slday;
  1082.     if(fexist("/zblock/password.txt"))
  1083.     {
  1084.         print("NOTIFICATION: 'password.txt' has been successfully created'");
  1085.         print("INFO: File location: /scriptfiles/zBlock/\nINFO: Automatically set the default password.");
  1086.         gettime(slhour, slminute, slsecond);
  1087.         getdate(slyear, slmonth, slday);
  1088.  
  1089.         new File:zBlockstuff = fopen("/zblock/password.txt", io_write);
  1090.         if(zBlockstuff)
  1091.         {
  1092.             fwrite(zBlockstuff, "defaultpassword5791");
  1093.             fclose(zBlockstuff);
  1094.         }
  1095.     }
  1096.     else print("WARNING: could NOT create 'password.txt' at 'scriptfiles/zblock'");
  1097.     return 1;
  1098. }
  1099. forward fcreate(filename[]);
  1100. public fcreate(filename[])
  1101. {
  1102.     if (fexist(filename)){return false;}
  1103.     new File:fhandle = fopen(filename,io_write);
  1104.     fclose(fhandle);
  1105.     return true;
  1106. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement