Advertisement
Red_Jheyson

Anti Cheat 1.1

Oct 5th, 2016
908
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 9.70 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
  5.  
  6.  
  7. Por padrão o anti money hack vem desligado
  8. Se etiver usando outro metodo de salvamento de money retire ele o anti cheat ja vem com o sistema para salvar money
  9.  
  10. */
  11.  
  12. //Includes
  13. #include <a_samp>
  14. #include <zcmd>
  15. #include <bini>
  16.  
  17. //define's
  18. #define DIALOG_ANTICHEAT 9999
  19.  
  20. //variaveis
  21. static kickado[MAX_PLAYERS];// para não floodar o chat
  22. static AntiFakeKill[MAX_PLAYERS];
  23. static PlayerTimer1[MAX_PLAYERS];// timer do AntiMoneyHack
  24. static PlayerTimer2[MAX_PLAYERS];// timer do CheckCheat
  25. static money[MAX_PLAYERS];//variavel do anti money hack
  26. static string[124];
  27. static antifake,antiskin,antifly,antimoney;
  28. //////////////////////////////////////////////////////////////////
  29. public OnFilterScriptInit()
  30. {
  31.     for(new x = 0; x < GetMaxPlayers(); ++x)// ser voce usar em /rcon loadfs ele vai recarregar o sistema
  32.     {
  33.  
  34.         if(IsPlayerConnected(x))
  35.         {
  36.  
  37.             PlayerTimer1[x] = SetTimerEx("MF_AntiMoneyHack", 1000, true, "i", x);
  38.             PlayerTimer2[x] = SetTimerEx("CheckCheat", 1000,true,"i",x);
  39.         }
  40.     }
  41.     // Carregar configurações
  42.     if(fexist("MF_CONFIG.ini"))
  43.     {
  44.  
  45.         INI_Open("MF_CONFIG.ini");
  46.         antifake = INI_ReadInt("MF_CONFIG.ini", "antifake");
  47.         antiskin = INI_ReadInt("MF_CONFIG.ini", "antiskin");
  48.         antifly = INI_ReadInt("MF_CONFIG.ini", "antifly");
  49.         antimoney = INI_ReadInt("MF_CONFIG.ini", "antimoney");
  50.         INI_Close();
  51.         print("1 = Ativado | 0 = Desativado");
  52.         printf("Anti Fake Kill %d",antifake);
  53.         printf("Anti Skin Bug %d",antiskin);
  54.         printf("Anti FLy %d",antifly);
  55.         printf("Anti Money Hack",antimoney);
  56.     }else{
  57.         INI_Create("MF_CONFIG.ini");
  58.         INI_WriteInt("MF_CONFIG.ini", "antifake", antifake = 1);
  59.         INI_WriteInt("MF_CONFIG.ini", "antiskin", antiskin = 1);
  60.         INI_WriteInt("MF_CONFIG.ini", "antifly", antifly = 1);
  61.         INI_WriteInt("MF_CONFIG.ini", "antimoney", antifly = 0);
  62.         INI_Save();
  63.         print("MF_CONFIG.ini / Criado");
  64.         INI_Create("MF_MONEY.ini");
  65.         print("MF_MONEY.ini / Criado");
  66.     }
  67.     print("\n----------------------------------------------");
  68.     print("  Anti Cheat 1.1 By [$]_Red_[MF] Loaded");
  69.     print("     Server ip: 167.114.42.20:7762\n");
  70.     print("----------------------------------------------\n");
  71.     return 1;
  72. }
  73. //////////////////////////////////////////////////////////////////
  74. public OnFilterScriptExit() {
  75.     INI_Exit();
  76.     return true;
  77. }
  78. //////////////////////////////////////////////////////////////////
  79. public OnPlayerConnect(playerid)
  80. {
  81.     if(antimoney == 1)
  82.     {
  83.  
  84.         INI_Open("MF_MONEY.ini");
  85.         MF_GivePlayerMoney(playerid, INI_ReadInt("MF_MONEY.ini", pName(playerid)));
  86.         INI_Close();
  87.     }
  88.     PlayerTimer1[playerid] = SetTimerEx("MF_AntiMoneyHack", 1000, true, "i", playerid);
  89.     PlayerTimer2[playerid] = SetTimerEx("CheckCheat", 1000,true,"i",playerid);
  90.     return 1;
  91. }
  92. //////////////////////////////////////////////////////////////////
  93. public OnPlayerDisconnect(playerid)
  94. {
  95.     INI_Open("MF_MONEY.ini");
  96.     INI_WriteInt("MF_MONEY.ini", pName(playerid), money[playerid]);
  97.     INI_Save();
  98.     kickado[playerid] = 0;
  99.     KillTimer(PlayerTimer1[playerid]);
  100.     KillTimer(PlayerTimer2[playerid]);
  101.     return 1;
  102. }
  103. //////////////////////////////////////////////////////////////////
  104. public OnPlayerDeath(playerid, killerid, reason)
  105. {
  106.     if(antifake == 1){
  107.         AntiFakeKill[playerid]++;
  108.         SetTimerEx("Antifakekill", 1000,false,"i",playerid);}
  109.     return 1;
  110. }
  111. //////////////////////////////////////////////////////////////////
  112. CMD:mf(playerid, params[])
  113. {
  114.     Dialog(playerid);
  115.     return 1;
  116. }
  117. //////////////////////////////////////////////////////////////////
  118. CMD:money(playerid, params[])
  119. {
  120.     if(antimoney == 1)
  121.     {
  122.  
  123.         new stringmoney[64];
  124.         format(stringmoney, 64, "Seu money: {FF0000}%d", money[playerid]);
  125.         SendClientMessage(playerid, -1, stringmoney);
  126.     }
  127.     return 1;
  128. }
  129. //////////////////////////////////////////////////////////////////
  130. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  131. {
  132.     if(dialogid == DIALOG_ANTICHEAT)
  133.     {
  134.  
  135.         if(response)
  136.         {
  137.  
  138.             if(!IsPlayerAdmin(playerid)) return 1;
  139.             INI_Open("MF_CONFIG.ini");
  140.             if(listitem == 0){
  141.                 if(antifly == 1){
  142.                     antifly = 0;
  143.                 }else{
  144.                     antifly = 1;}}
  145.  
  146.             if(listitem == 1){
  147.                 if(antiskin == 1){
  148.                     antiskin = 0;
  149.                 }else{
  150.                     antiskin = 1;}}
  151.  
  152.             if(listitem == 2){
  153.                 if(antifake == 1){
  154.                     antifake = 0;
  155.                 }else{
  156.                     antifake = 1;}}
  157.             if(listitem == 3){
  158.                 if(antimoney == 1){
  159.                     antimoney = 0;
  160.                 }else{
  161.                     for(new x = 0; x < GetMaxPlayers(); ++x)
  162.                     {
  163.  
  164.                         if(IsPlayerConnected(x)){
  165.                             money[x] = GetPlayerMoney(x);
  166.                         }}// retirando umas linhas
  167.                     antimoney = 1;
  168.                     SendClientMessage(playerid, -1, "Se você estiver usando outro anti money hack por favor desligue para não cauzar conflito.");
  169.                 }}
  170.             Dialog(playerid);
  171.             // Salva as alterações feitas
  172.             INI_WriteInt("MF_CONFIG.ini", "antifake", antifake);
  173.             INI_WriteInt("MF_CONFIG.ini", "antiskin", antiskin);
  174.             INI_WriteInt("MF_CONFIG.ini", "antifly", antifly);
  175.             INI_WriteInt("MF_CONFIG.ini", "antimoney", antimoney);
  176.             INI_Save();
  177.         }
  178.         return 1;
  179.     }
  180.     return 0;
  181. }
  182. //////////////////////////////////////////////////////////////////
  183. forward CheckCheat(playerid);
  184. public CheckCheat(playerid)
  185. {
  186.     if(antiskin == 1){
  187.         if(GetPlayerWeapon(playerid) != WEAPON_PARACHUTE && GetPlayerAnimationIndex(playerid) == 974 || GetPlayerWeapon(playerid) != WEAPON_PARACHUTE && GetPlayerAnimationIndex(playerid) == 972 || GetPlayerWeapon(playerid) != WEAPON_PARACHUTE && GetPlayerAnimationIndex(playerid) == 968){
  188.             KickPlayer(playerid, "Skin Bug");}}
  189.     if(antifly == 1){
  190.         if(GetPlayerWeapon(playerid) != WEAPON_PARACHUTE && GetPlayerAnimationIndex(playerid) == 959 || !IsPlayerInWater(playerid) && GetPlayerAnimationIndex(playerid) == 1539 || GetPlayerWeapon(playerid) != WEAPON_PARACHUTE && GetPlayerAnimationIndex(playerid) == 958){
  191.             static Float:x, Float:y, Float:z;
  192.             GetPlayerPos(playerid, x, y, z);
  193.             if(z > 2) return 0;
  194.             KickPlayer(playerid, "Fly");}}
  195.     return 1;
  196. }
  197. //////////////////////////////////////////////////////////////////
  198. forward Antifakekill(playerid);
  199. public Antifakekill(playerid)
  200. {
  201.     if(AntiFakeKill[playerid] > 2){
  202.         KickPlayer(playerid, "Fake Kill");
  203.     }
  204.     AntiFakeKill[playerid] = 0;
  205.     return 1;
  206. }
  207. //////////////////////////////////////////////////////////////////
  208. stock IsPlayerInWater(playerid)//by stabker http://forum.sa-mp.com/showthread.php?t=400049
  209. {
  210.     static Float:Z;
  211.     GetPlayerPos(playerid,Z,Z,Z);
  212.     if(Z < 0.7) switch(GetPlayerAnimationIndex(playerid)) { case 1543,1538,1539: return 1; }
  213.     if(GetPlayerDistanceFromPoint(playerid,-965,2438,42) <= 700 && Z < 45)return 1;
  214.     static Float:water_places[][] =
  215.     {
  216.  
  217.         {
  218.             25.0,   2313.0, -1417.0,    23.0},
  219.         {
  220.             15.0,   1280.0, -773.0,     1082.0},
  221.         {
  222.             15.0,   1279.0, -804.0,     86.0},
  223.         {
  224.             20.0,   1094.0, -674.0,     111.0},
  225.         {
  226.             26.0,   194.0-1232.0,    76.0},
  227.         {
  228.             25.0,   2583.0, 2385.0,     15.0},
  229.         {
  230.             25.0,   225.0-1187.0,    73.0},
  231.         {
  232.             50.0,   1973.0, -1198.0,    17.0}
  233.     };
  234.     for(new t=0; t < sizeof water_places; t++)
  235.     if(GetPlayerDistanceFromPoint(playerid,water_places[t][1],water_places[t][2],water_places[t][3]) <= water_places[t][0]) return 1;
  236.     return 0;
  237. }
  238. /////////////////////////////////////////////////////////////////////
  239. stock pName(playerid)
  240. {
  241.     static name[24];
  242.     GetPlayerName(playerid, name, sizeof(name));
  243.     return name;
  244. }
  245. //////////////////////////////////////////////////////////////////
  246. forward KickPlayer(playerid, caso[]);
  247. public KickPlayer(playerid, caso[])
  248. {
  249.     if(kickado[playerid] == 0){
  250.         kickado[playerid]++;
  251.         format(string, sizeof(string), "[ANTI-CHEAT]: %s foi kickado [Motivo: %s]", pName(playerid),caso);
  252.         SendClientMessageToAll(-1, string);
  253.         print(string);
  254.         Kick(playerid);
  255.     }
  256.     return 1;
  257. }
  258. //////////////////////////////////////////////////////////////////
  259. forward Dialog(playerid);
  260. public Dialog(playerid)
  261. {
  262.     if(!IsPlayerAdmin(playerid)) return 1;
  263.     static antifly2[30],antiskin2[30],antifake2[30],antimoney2[30];
  264.     switch(antifly)
  265.     {
  266.  
  267.         case 0: antifly2 = "{FF0000}Desativado{FFFFFF}";
  268.         case 1: antifly2 = "{00FF00}Ativado{FFFFFF}";
  269.     }
  270.     switch(antiskin)
  271.     {
  272.  
  273.         case 0: antiskin2 = "{FF0000}Desativado{FFFFFF}";
  274.         case 1: antiskin2 = "{00FF00}Ativado{FFFFFF}";
  275.     }
  276.     switch(antifake)
  277.     {
  278.  
  279.         case 0: antifake2 = "{FF0000}Desativado{FFFFFF}";
  280.         case 1: antifake2 = "{00FF00}Ativado{FFFFFF}";
  281.     }
  282.     switch(antimoney)
  283.     {
  284.  
  285.         case 0: antimoney2 = "{FF0000}Desativado{FFFFFF}";
  286.         case 1: antimoney2 = "{00FF00}Ativado{FFFFFF}";
  287.     }
  288.     static config[200];
  289.     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",antifly2,antiskin2,antifake2,antimoney2);
  290.     return ShowPlayerDialog(playerid, DIALOG_ANTICHEAT, DIALOG_STYLE_LIST, " CONFIGURAÇÔES DO ANTI CHEAT", config, "Selecionar", "Sair");
  291. }
  292. //////////////////////////////////////////////////////////////////
  293. forward MF_AntiMoneyHack(playerid);
  294. public MF_AntiMoneyHack(playerid)//MoneyCheatCheck
  295. {
  296.     if(antimoney == 1)
  297.     {
  298.  
  299.         if(GetPlayerMoney(playerid) > money[playerid])
  300.         {
  301.  
  302.             ResetPlayerMoney(playerid);
  303.             GivePlayerMoney(playerid, money[playerid]);
  304.         }
  305.     }
  306.     return 1;
  307. }
  308. //////////////////////////////////////////////////////////////////
  309. /*
  310. Funsão para ser ultilizada fora do FS
  311. CallRemoteFunction("MF_GivePlayerMoney", "ii", playerid, quantidade);
  312. ================================================================
  313. Funsão para ser ultilizada dentro do FS
  314. MF_GivePlayerMoney(playerid, quantidade);
  315. */
  316. stock MF_GivePlayerMoney(playerid, quantidade)//GivePlayerMoney
  317. {
  318.     ResetPlayerMoney(playerid);
  319.     GivePlayerMoney(playerid, money[playerid] + quantidade);
  320.     money[playerid] = GetPlayerMoney(playerid);
  321.     return 1;
  322. }
  323. //////////////////////////////////////////////////////////////////
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement