Advertisement
Red_Jheyson

Anti Cheat 1.4

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