Advertisement
Red_Jheyson

Anti-Cheat 1.2

Oct 9th, 2016
1,084
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 16.22 KB | None | 0 0
  1. /*
  2. Não adianta mudar os creditos não foi você que fez...
  3.  
  4. Server: 167.114.42.20:7762  ESTE SERVER ESTA USANDO ESTE ANTI CHEAT
  5. Anti-Aimbot 1.2 ANTIFLY\ANTI GOD\ANTI SKIN BUG\ANTI MONEY HACK\ANTI JETPACK HACK\ANTI GODOFCARS\ANTI FAKEKILL
  6.  
  7.                                            Anti-fake
  8.                                          Anti-skin bug
  9.                                           Anti-fly
  10.                                           Anti-money
  11.                                  Anti-god Health & Armour hack
  12.                                           Anti-jetpack
  13.                                           God Of Cars
  14.  
  15.  
  16.  
  17. Por padrão o anti money hack vem desligado
  18. Se etiver usando outro metodo de salvamento de money retire ele o anti cheat ja vem com o sistema para salvar money
  19.  
  20. |=-=-=-=-=-=- adcs -=-=-=-=-=-=|
  21. Sistema de anti god (beta)
  22. anti jetpack hack
  23. anti god of cars - car troll
  24.  
  25.  
  26. retirado comando /money
  27.  
  28. bugs (2)
  29. - anti fly não detecta       - corrigido
  30. - anti skin bug não detecta  - corrigido
  31.  
  32. */
  33.  
  34. //Includes
  35. #include <a_samp>
  36. #include <zcmd> // se for usar strcmp retire essa include e o comando na linha 199
  37. #include <bini>
  38.  
  39. //define's
  40. #define CONFIG "MF_CONFIG.ini" // Local onde as configurações do anti cheat são salvas
  41. #define CONFIGMONEY "MF_MONEY.ini" // Local onde o money dos players são salvos
  42. #define WARNINGSKICK 3 // max de avisos do anti god para kickar. recomendado 3 para cima
  43. #define DIALOG_ANTICHEAT 9999 // 9999 e o id do dialog
  44.  
  45. //variaveis
  46. static kickado[MAX_PLAYERS];// para não floodar o chat
  47. static AntiFakeKill[MAX_PLAYERS]; // variavel do anti fake kill
  48. static PlayerTimer1[MAX_PLAYERS];// timer do AntiMoneyHack
  49. static PlayerTimer2[MAX_PLAYERS];// timer do CheckCheat
  50. static money[MAX_PLAYERS];//variavel do anti money hack
  51. static string[256]; // variavel global
  52. static antifake,antiskin,antifly,antimoney,antigod,antijetpack,godofcars;//configs
  53. static hits[MAX_PLAYERS];//hit GOD acertados
  54. static MORTO[MAX_PLAYERS];// para garantir que não vai getar a vida de mortos
  55. static CHECANDO[MAX_PLAYERS];//garantir uma checagem mais correta
  56. //////////////////////////////////////////////////////////////////
  57. public OnFilterScriptInit()
  58. {
  59.     for(new x = 0; x < GetMaxPlayers(); ++x)// se voce usar em /rcon loadfs ele vai recarregar o sistema
  60.     {
  61.         if(IsPlayerConnected(x))
  62.         {
  63.             PlayerTimer1[x] = SetTimerEx("MF_AntiMoneyHack", 1000, true, "i", x); // 1000 = 1 segundo
  64.             PlayerTimer2[x] = SetTimerEx("CheckCheat", 1000,true,"i", x); // 1000 = 1 segundo
  65.         }
  66.     }
  67.     // Carregar configurações
  68.     if(fexist(CONFIG)) // verifica se existe o arquivo da config
  69.     {
  70.         INI_Open(CONFIG);
  71.         antifake = INI_ReadInt(CONFIG, "antifake");
  72.         antiskin = INI_ReadInt(CONFIG, "antiskin");
  73.         antifly = INI_ReadInt(CONFIG, "antifly");
  74.         antimoney = INI_ReadInt(CONFIG, "antimoney");
  75.         antigod = INI_ReadInt(CONFIG, "antigod");
  76.         antijetpack = INI_ReadInt(CONFIG, "antijetpack");
  77.         godofcars = INI_ReadInt(CONFIG, "godofcars");
  78.         INI_Close();
  79.         // printf = print formatada
  80.         print("1 = Ativado | 0 = Desativado");
  81.         printf("Anti Fake Kill \t\t%d",antifake);
  82.         printf("Anti Skin Bug \t\t%d",antiskin);
  83.         printf("Anti FLy \t\t%d",antifly);
  84.         printf("Anti Money Hack \t%d",antimoney);
  85.         printf("Anti G0D Hack \t\t%d",antigod);
  86.         printf("Anti God of Cars \t%d",godofcars);
  87.     }
  88.     else // se não existe ele vai criar-lo
  89.     {
  90.         INI_Create(CONFIG);
  91.         INI_WriteInt(CONFIG, "antifake", antifake = 1);
  92.         INI_WriteInt(CONFIG, "antiskin", antiskin = 1);
  93.         INI_WriteInt(CONFIG, "antifly", antifly = 1);
  94.         INI_WriteInt(CONFIG, "antigod", antigod = 1);
  95.         INI_WriteInt(CONFIG, "antijetpack", antijetpack = 1);
  96.         INI_WriteInt(CONFIG, "antimoney", antimoney = 0);
  97.         INI_WriteInt(CONFIG, "godofcars", godofcars = 1);
  98.         INI_Save();
  99.         printf("%s / Criado",CONFIG); // se ele for criado vai aparecer isto no log
  100.         INI_Create(CONFIGMONEY);
  101.         printf("%s / Criado",CONFIGMONEY); // igualmente
  102.         INI_Save();
  103.     }
  104.     print("\n----------------------------------------------");
  105.     print("  Anti Cheat 1.2 By [$]_Red_[MF] Loaded");
  106.     print("     Server ip: 167.114.42.20:7762\n");
  107.     print("----------------------------------------------\n");
  108.     return 1;
  109. }
  110. //////////////////////////////////////////////////////////////////
  111. public OnFilterScriptExit()
  112. {
  113.     INI_Exit();
  114.     return true;
  115. }
  116. //////////////////////////////////////////////////////////////////
  117. public OnPlayerConnect(playerid)
  118. {
  119.     if(antimoney == 1)
  120.     {
  121.         INI_Open(CONFIGMONEY);
  122.         MF_GivePlayerMoney(playerid, INI_ReadInt(CONFIGMONEY, pName(playerid)));
  123.         INI_Close();
  124.     }
  125.     CHECANDO[playerid] = 0;
  126.     MORTO[playerid] = 0;
  127.     hits[playerid] = 0;
  128.     PlayerTimer1[playerid] = SetTimerEx("MF_AntiMoneyHack", 200, true, "i", playerid); // 200 = 200 ms
  129.     PlayerTimer2[playerid] = SetTimerEx("CheckCheat", 1000,true,"i", playerid); // 1000 = 1 segundo
  130.     return 1;
  131. }
  132. //////////////////////////////////////////////////////////////////
  133. public OnPlayerDisconnect(playerid)
  134. {
  135.     INI_Open(CONFIGMONEY);
  136.     INI_WriteInt(CONFIGMONEY, pName(playerid), money[playerid]);
  137.     INI_Save();
  138.     kickado[playerid] = 0;
  139.     AntiFakeKill[playerid] = 0;
  140.    
  141.     // desligar os timersquando o players deslogar diminui o lag no server
  142.     KillTimer(PlayerTimer1[playerid]);
  143.     KillTimer(PlayerTimer2[playerid]);
  144.     return 1;
  145. }
  146. //////////////////////////////////////////////////////////////////
  147. public OnPlayerDeath(playerid, killerid, reason)
  148. {
  149.     if(antifake == 1)
  150.     {
  151.         AntiFakeKill[playerid]++;
  152.         SetTimerEx("Antifakekill", 1000,false,"i",playerid);
  153.     }
  154.     MORTO[playerid] = 1;
  155.     hits[playerid] = 0;
  156.     return 1;
  157. }
  158. /////////////////////////////////////////////////////////////////////////
  159. public OnPlayerSpawn(playerid)
  160. {
  161.     MORTO[playerid] = 0;
  162.     CHECANDO[playerid] = 0;
  163.     hits[playerid] = 0;
  164.     return 1;
  165. }
  166. /////////////////////////////////////////////////////////////////////////
  167. public OnPlayerGiveDamage(playerid, damagedid, Float:amount, weaponid, bodypart)
  168. {
  169.     if(antigod == 1)
  170.     {
  171.         if(damagedid != INVALID_PLAYER_ID)
  172.         {
  173.             if(CHECANDO[damagedid] == 0)
  174.             {
  175.                 if(MORTO[damagedid] == 0)
  176.                 {
  177.                     if(weaponid != 34)
  178.                     {
  179.                         CHECANDO[damagedid] = 1; // não dar bugs na hora de checar o player
  180.                         static Float:Health,Float:Armour;
  181.                         GetPlayerHealth(damagedid, Health);
  182.                         GetPlayerArmour(damagedid, Armour);
  183.                         if(Armour > 0.0)
  184.                         {                              // \/ Para não dar falsas denuncias por causa do ping
  185.                             SetTimerEx("CheckArmour", GetPlayerPing(damagedid)+300, false, "ii", damagedid, Armour);
  186.                         }
  187.                         else
  188.                         {
  189.                             SetTimerEx("CheckHealth", GetPlayerPing(damagedid)+300, false, "ii", damagedid, Health);
  190.                         }
  191.                     }
  192.                 }
  193.             }
  194.         }
  195.     }
  196.     return 1;
  197. }
  198. //////////////////////////////////////////////////////////////////
  199. CMD:mf(playerid, params[])
  200. {
  201.     if(!IsPlayerAdmin(playerid)) return 1; // so admins rcon pode usar esse comando
  202.     Dialog(playerid);
  203.     return 1;
  204. }
  205. //////////////////////////////////////////////////////////////////
  206. // Se for usar o strcmp apague as linhas acima dos comandos antigos e libere as linhas abaixo
  207. // e retire a include zcmd do topo desse filterscript
  208.  
  209.  
  210. /*
  211.  
  212. public OnPlayerCommandText(playerid, cmdtext[])
  213. {
  214.     if (strcmp("/mf", cmdtext, true, 10) == 0)
  215.     {
  216.         if(!IsPlayerAdmin(playerid)) return 1; // so admins rcon pode usar esse comando
  217.         Dialog(playerid);
  218.         return 1;
  219.     }
  220.     return 0;
  221. }
  222.  
  223. */
  224.  
  225.  
  226. //////////////////////////////////////////////////////////////////
  227. public OnPlayerStateChange(playerid, newstate, oldstate)
  228. {
  229.     if(godofcars == 1)
  230.     {
  231.     if(oldstate == 1 && newstate == 2) return KickPlayer(playerid, "God Of Cars");
  232.     if(oldstate == 2 && newstate == 1) return KickPlayer(playerid, "God Of Cars");
  233.     }
  234.     return 1;
  235. }
  236. //////////////////////////////////////////////////////////////////
  237. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  238. {
  239.     if(dialogid == DIALOG_ANTICHEAT)
  240.     {
  241.         if(response)
  242.         {
  243.             INI_Open(CONFIG);
  244.             if(listitem == 0)
  245.             {
  246.                 if(antifly == 1)
  247.                 {
  248.                     antifly = 0;
  249.                 }
  250.                 else
  251.                 {
  252.                     antifly = 1;
  253.                 }
  254.             }
  255.             if(listitem == 1)
  256.             {
  257.                 if(antiskin == 1)
  258.                 {
  259.                     antiskin = 0;
  260.                 }
  261.                 else
  262.                 {
  263.                     antiskin = 1;
  264.                 }
  265.             }
  266.             if(listitem == 2)
  267.             {
  268.                 if(antifake == 1)
  269.                 {
  270.                     antifake = 0;
  271.                 }
  272.                 else
  273.                 {
  274.                     antifake = 1;
  275.                 }
  276.             }
  277.             if(listitem == 3)
  278.             {
  279.                 if(antimoney == 1)
  280.                 {
  281.                     antimoney = 0;
  282.                 }
  283.                 else
  284.                 {
  285.                     for(new x = 0; x < GetMaxPlayers(); ++x)
  286.                     {
  287.                         if(IsPlayerConnected(x))
  288.                         {
  289.                             money[x] = GetPlayerMoney(x);
  290.                         }
  291.                     }
  292.                     antimoney = 1;
  293.                     SendClientMessage(playerid, -1, "Se você estiver usando outro anti money hack por favor desligue para não cauzar conflito.");
  294.                 }
  295.             }
  296.             if(listitem == 4)
  297.             {
  298.                 if(antigod == 1)
  299.                 {
  300.                     antigod = 0;
  301.                 }
  302.                 else
  303.                 {
  304.                     antigod = 1;
  305.                 }
  306.             }
  307.             if(listitem == 5)
  308.             {
  309.                 if(antijetpack == 1)
  310.                 {
  311.                     antijetpack = 0;
  312.                 }
  313.                 else
  314.                 {
  315.                     antijetpack = 1;
  316.                 }
  317.             }
  318.             if(listitem == 6)
  319.             {
  320.                 if(godofcars == 1)
  321.                 {
  322.                     godofcars = 0;
  323.                 }
  324.                 else
  325.                 {
  326.                     godofcars = 1;
  327.                 }
  328.             }
  329.             Dialog(playerid);
  330.             // Salva as alterações feitas
  331.             INI_WriteInt(CONFIG, "antifake", antifake);
  332.             INI_WriteInt(CONFIG, "antiskin", antiskin);
  333.             INI_WriteInt(CONFIG, "antifly", antifly);
  334.             INI_WriteInt(CONFIG, "antimoney", antimoney);
  335.             INI_WriteInt(CONFIG, "antijetpack", antijetpack);
  336.             INI_WriteInt(CONFIG, "antigod", antigod);
  337.             INI_WriteInt(CONFIG, "godofcars", godofcars);
  338.             INI_Save();
  339.         }
  340.         return 1;
  341.     }
  342.     return 0;
  343. }
  344. //////////////////////////////////////////////////////////////////
  345. forward CheckCheat(playerid);
  346. public CheckCheat(playerid)
  347. {
  348.  
  349.     if(antiskin == 1)
  350.     {
  351.         if(GetPlayerWeapon(playerid) != WEAPON_PARACHUTE && GetPlayerAnimationIndex(playerid) == 974) return KickPlayer(playerid, "Skin Bug");
  352.         if(GetPlayerWeapon(playerid) != WEAPON_PARACHUTE && GetPlayerAnimationIndex(playerid) == 972) return KickPlayer(playerid, "Skin Bug");
  353.         if(GetPlayerWeapon(playerid) != WEAPON_PARACHUTE && GetPlayerAnimationIndex(playerid) == 968) return KickPlayer(playerid, "Skin Bug");
  354.     }
  355.  
  356.     if(antifly == 1)
  357.     {
  358.         if(GetPlayerWeapon(playerid) != WEAPON_PARACHUTE && GetPlayerAnimationIndex(playerid) == 959) return KickPlayer(playerid, "Fly");
  359.         if(GetPlayerWeapon(playerid) != WEAPON_PARACHUTE && GetPlayerAnimationIndex(playerid) == 958) return KickPlayer(playerid, "Fly");
  360.         if(!IsPlayerInWater(playerid) && GetPlayerAnimationIndex(playerid) == 1539) return KickPlayer(playerid, "Fly");
  361.         if(!IsPlayerInWater(playerid) && GetPlayerAnimationIndex(playerid) == 1538) return KickPlayer(playerid, "Fly");  // novo anin que anti fly pega
  362.     }
  363.  
  364.     if(antijetpack == 1)
  365.     {
  366.         if(GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_USEJETPACK)
  367.         {
  368.             if(!IsPlayerAdmin(playerid))
  369.             {
  370.                 //SetPlayerSpecialAction(playerid, SPECIAL_ACTION_NONE);// aqui ele so vai retirar a jetpack so players logados na RCON pode ter jetpack
  371.                 KickPlayer(playerid, "JetPack Hack");
  372.             }
  373.         }
  374.     }
  375.    
  376.     return 1;
  377. }
  378. //////////////////////////////////////////////////////////////////
  379. forward Antifakekill(playerid);
  380. public Antifakekill(playerid)
  381. {
  382.     if(AntiFakeKill[playerid] > 3) return KickPlayer(playerid, "Fake Kill");
  383.     AntiFakeKill[playerid] = 0;
  384.     return 1;
  385. }
  386. //////////////////////////////////////////////////////////////////
  387. stock IsPlayerInWater(playerid)
  388. {
  389.     new Float:Z;// não mude para static
  390.     GetPlayerPos(playerid,Z,Z,Z);
  391.     if(Z < 0.7) switch(GetPlayerAnimationIndex(playerid)) { case 1543,1538,1539: return 1; }
  392.     if(GetPlayerDistanceFromPoint(playerid,-965,2438,42) <= 700 && Z < 45)return 1;
  393.     new Float:water_places[][] =
  394.     {
  395.  
  396.         {
  397.             25.0,   2313.0, -1417.0,    23.0},
  398.         {
  399.             15.0,   1280.0, -773.0,     1082.0},
  400.         {
  401.             15.0,   1279.0, -804.0,     86.0},
  402.         {
  403.             20.0,   1094.0, -674.0,     111.0},
  404.         {
  405.             26.0,   194.0-1232.0,    76.0},
  406.         {
  407.             25.0,   2583.0, 2385.0,     15.0},
  408.         {
  409.             25.0,   225.0-1187.0,    73.0},
  410.         {
  411.             50.0,   1973.0, -1198.0,    17.0}
  412.     };
  413.     for(new t=0; t < sizeof water_places; t++)
  414.     if(GetPlayerDistanceFromPoint(playerid,water_places[t][1],water_places[t][2],water_places[t][3]) <= water_places[t][0]) return 1;
  415.     return 0;
  416. }
  417.  
  418. /////////////////////////////////////////////////////////////////////
  419. stock pName(playerid)// stock para pegar nome de players
  420. {
  421.     static name[24];
  422.     GetPlayerName(playerid, name, sizeof(name));
  423.     return name;
  424. }
  425. //////////////////////////////////////////////////////////////////
  426. forward KickPlayer(playerid, caso[]);
  427. public KickPlayer(playerid, caso[])
  428. {
  429.     if(kickado[playerid] == 0)
  430.     {
  431.         kickado[playerid]++;
  432.         format(string, sizeof(string), "{FFFF00}[ANTI-CHEAT]: {FF0000}%s {FFFFFF}foi kickado {000000}[{FFFF00}Motivo: {00FF00}%s{000000}]", pName(playerid),caso); // uma mensagem mais bonita :D
  433.         SendClientMessageToAll(-1, string);
  434.         printf(">>[ANTI-CHEAT]: %s foi kickado [Motivo: %s]", pName(playerid),caso); // escrever no log o player que foi kickado
  435.         Kick(playerid);
  436.     }
  437.     return 1;
  438. }
  439. //////////////////////////////////////////////////////////////////
  440. forward Dialog(playerid);
  441. public Dialog(playerid)
  442. {
  443.     static antifly2[30],antiskin2[30],antifake2[30],antimoney2[30],antigod2[30],antijetpack2[30],godofcars2[30];
  444.     switch(antifly)
  445.     {
  446.         case 0: antifly2 = "{FF0000}Desativado{FFFFFF}";
  447.         case 1: antifly2 = "{00FF00}Ativado{FFFFFF}";
  448.     }
  449.     switch(antiskin)
  450.     {
  451.         case 0: antiskin2 = "{FF0000}Desativado{FFFFFF}";
  452.         case 1: antiskin2 = "{00FF00}Ativado{FFFFFF}";
  453.     }
  454.     switch(antifake)
  455.     {
  456.         case 0: antifake2 = "{FF0000}Desativado{FFFFFF}";
  457.         case 1: antifake2 = "{00FF00}Ativado{FFFFFF}";
  458.     }
  459.     switch(antimoney)
  460.     {
  461.         case 0: antimoney2 = "{FF0000}Desativado{FFFFFF}";
  462.         case 1: antimoney2 = "{00FF00}Ativado{FFFFFF}";
  463.     }
  464.     switch(antigod)
  465.     {
  466.         case 0: antigod2 = "{FF0000}Desativado{FFFFFF}";
  467.         case 1: antigod2 = "{00FF00}Ativado{FFFFFF}";
  468.     }
  469.     switch(antijetpack)
  470.     {
  471.         case 0: antijetpack2 = "{FF0000}Desativado{FFFFFF}";
  472.         case 1: antijetpack2 = "{00FF00}Ativado{FFFFFF}";
  473.     }
  474.     switch(godofcars)
  475.     {
  476.         case 0: godofcars2 = "{FF0000}Desativado{FFFFFF}";
  477.         case 1: godofcars2 = "{00FF00}Ativado{FFFFFF}";
  478.     }
  479.     static config[356];
  480.     format(config, sizeof config, "{FFFFFF}Anti Fly \t\t\t %s\nAnti Skin Bug \t\t %s\nAnti Fake Kill \t\t %s\nAnti Money Hack \t %s\nAnti G0D Hack \t\t %s\nAnti JetPack Hack \t %s\nAnti God Of Car \t %s",antifly2,antiskin2,antifake2,antimoney2,antigod2,antijetpack2,godofcars2);
  481.     return ShowPlayerDialog(playerid, DIALOG_ANTICHEAT, DIALOG_STYLE_LIST, " CONFIGURAÇÔES DO ANTI CHEAT", config, "Selecionar", "Sair");
  482. }
  483. //////////////////////////////////////////////////////////////////
  484. forward MF_AntiMoneyHack(playerid);
  485. public MF_AntiMoneyHack(playerid)//MoneyCheatCheck
  486. {
  487.     if(antimoney == 1)
  488.     {
  489.         if(GetPlayerMoney(playerid) > money[playerid])
  490.         {
  491.             ResetPlayerMoney(playerid);
  492.             GivePlayerMoney(playerid, money[playerid]);
  493.         }
  494.     }
  495.     return 1;
  496. }
  497. //////////////////////////////////////////////////////////////////
  498. /*
  499. Funsão para ser ultilizada fora do FS
  500. CallRemoteFunction("MF_GivePlayerMoney", "ii", playerid, quantidade);
  501. ================================================================
  502. Funsão para ser ultilizada dentro do FS
  503. MF_GivePlayerMoney(playerid, quantidade);
  504. */
  505. stock MF_GivePlayerMoney(playerid, quantidade)//GivePlayerMoney
  506. {
  507.     ResetPlayerMoney(playerid);
  508.     GivePlayerMoney(playerid, money[playerid] + quantidade);
  509.     money[playerid] = GetPlayerMoney(playerid);
  510.     return 1;
  511. }
  512. //////////////////////////////////////////////////////////////////
  513. forward CheckHealth(playerid, Float:OldHealth);
  514. public CheckHealth(playerid, Float:OldHealth)
  515. {
  516.     static Float:Health;
  517.     GetPlayerHealth(playerid, Health);
  518.     if(Health == OldHealth && MORTO[playerid] == 0)
  519.     {
  520.         hits[playerid]++;
  521.         if(hits[playerid] >= WARNINGSKICK) return KickPlayer(playerid, "Health H4CK");
  522.     }
  523.     CHECANDO[playerid] = 0;
  524.     return 1;
  525. }
  526. /////////////////////////////////////////////////////////////////////////
  527. forward CheckArmour(playerid, Float:OldArmour);
  528. public CheckArmour(playerid, Float:OldArmour)
  529. {
  530.     static Float:Armour;
  531.     GetPlayerArmour(playerid, Armour);
  532.     if(Armour == OldArmour && MORTO[playerid] == 0)
  533.     {
  534.         hits[playerid]++;
  535.         if(hits[playerid] >= WARNINGSKICK) return KickPlayer(playerid, "Armour H4CK");
  536.     }
  537.     CHECANDO[playerid] = 0;
  538.     return 1;
  539. }
  540. /////////////////////////////////////////////////////////////////////////
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement