Advertisement
Rei_Ayanami

AntyCheat System v2

Jan 16th, 2025
762
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #define FILTERSCRIPT
  2.  
  3. #include <open.mp>
  4.  
  5. // -
  6. #define C_GREEN 0x20DD6AFF
  7. #define C_ERROR 0xA01616FF
  8.  
  9. #define MOBILE_CLIENT "ED40ED0E8089CC44C08EE9580F4C8C44EE8EE990"
  10.  
  11. // -
  12. new bool:pSuspicious[MAX_PLAYERS];
  13. new bool:mobilePlayer[MAX_PLAYERS];
  14. // -
  15. new pCheat[MAX_PLAYERS];
  16. // -
  17. new rMemAddr[8];
  18.  
  19. // -
  20. forward autoSobCheck(playerid);
  21. forward kickPlayer(playerid);
  22. // -
  23.  
  24. new opcodes[8] = {
  25.     0x06865E,
  26.     0xA88774,
  27.     0xDB6746,
  28.     0xFDB957,
  29.     0x52D558,
  30.     0xE4FC58,
  31.     0x1BA246,
  32.     0xB0C56F
  33. };
  34.  
  35. // -- Callbacks --
  36. public OnPlayerConnect(playerid)
  37. {
  38.     new version[24], pAuth[43];
  39.    
  40.     // --
  41.     mobilePlayer[playerid] = false;
  42.     pSuspicious[playerid] = false;
  43.     pCheat[playerid] = -1;
  44.    
  45.     // -- Client version | GPCI --
  46.     GetPlayerVersion(playerid, version, sizeof(version));
  47.     GPCI(playerid, pAuth, sizeof(pAuth));
  48.  
  49.     if ( !strcmp ( MOBILE_CLIENT, pAuth, true ) ) mobilePlayer[playerid] = true;
  50.  
  51.     if ( strcmp ( version, "0.3.7" ) == 0 && mobilePlayer[playerid] == false )
  52.     {
  53.         SendClientMessage(playerid, C_ERROR, "[ERROR] The server requires a client version newer than 0.3.7 R1!");
  54.         SetTimerEx("kickPlayer", 2000, false, "d", playerid);
  55.     }
  56.  
  57.     // -
  58.     SendClientCheck(playerid, 0x47, 0, 0, 0x4);
  59.     SendClientCheck(playerid, 0x48, 0, 0, 0x4);
  60.     // -
  61.  
  62.     for (new i = 0; i < 8; i++) rMemAddr[i] = anotherForm(opcodes[i]), SendClientCheck(playerid, 0x5, rMemAddr[i], 0x0, 0x4);
  63.  
  64.     // -- Check RPC --
  65.     CallLocalFunction("Sec_OnClientCheckResponse", "iiii", playerid, 0x47, 0xCECECE, 256);
  66.     CallLocalFunction("Sec_OnClientCheckResponse", "iiii", playerid, 0x48, 0xDEDEDE, 256);
  67.     // -
  68.    
  69.     SetTimerEx("autoSobCheck", 2900, false, "i", playerid);
  70.     return 1;
  71. }
  72.  
  73. public Sec_OnClientCheckResponse(playerid, actionid, memaddr, retndata)
  74. {
  75.     switch(actionid)
  76.     {
  77.         case 0x47:
  78.         {
  79.             if ( mobilePlayer[playerid] == false && memaddr == 0x0 && retndata != 256 )
  80.             {
  81.                 pSuspicious[playerid] = false;
  82.             }
  83.             if ( mobilePlayer[playerid] == false && memaddr == 0xCECECE && retndata == 256 )
  84.             {
  85.                 pSuspicious[playerid] = true;
  86.                 // -
  87.                 SendClientCheck(playerid, 0x47, 0, 0, 0x4);
  88.             }
  89.         }
  90.         case 0x48:
  91.         {
  92.             if ( mobilePlayer[playerid] == false && memaddr != 0xDEDEDE && retndata == 0 )
  93.             {
  94.                 pSuspicious[playerid] = false;
  95.             }
  96.             if ( mobilePlayer[playerid] == false && memaddr == 0xDEDEDE && retndata == 256 )
  97.             {
  98.                 pSuspicious[playerid] = true;
  99.                 // -
  100.                 SendClientCheck(playerid, 0x48, 0, 0, 0x4);
  101.             }
  102.         }
  103.         case 0x5:
  104.         {
  105.             if ( memaddr == rMemAddr[0] && retndata != 192) pCheat[playerid] = 1;
  106.             if ( memaddr == rMemAddr[1] && retndata != 72) pCheat[playerid] = 2;
  107.             if ( memaddr == rMemAddr[2] && retndata != 192) pCheat[playerid] = 3;
  108.             if ( memaddr == rMemAddr[3] && retndata != 68) pCheat[playerid] = 4;
  109.             if ( memaddr == rMemAddr[4] && retndata != 196) pCheat[playerid] = 5;
  110.             if ( memaddr == rMemAddr[5] && retndata != 64) pCheat[playerid] = 6;
  111.             if ( memaddr == rMemAddr[6] && retndata != 8 ) pCheat[playerid] = 7; // CLEO5+Ultimate ASI Loader
  112.             if ( memaddr == rMemAddr[7] && retndata != 200 ) pCheat[playerid] = 8; // SilentPatch
  113.         }
  114.     }
  115.     return 0;
  116. }
  117.  
  118. public OnClientCheckResponse(playerid, actionid, memaddr, retndata)
  119. {
  120.     #if defined Sec_OnClientCheckResponse
  121.         Sec_OnClientCheckResponse(playerid, actionid, memaddr, retndata);
  122.     #endif
  123.     return 1;
  124. }
  125. #if defined _ALS_OnClientCheckResponse
  126.     #undef OnClientCheckResponse
  127. #else
  128.     #define _ALS_OnClientCheckResponse
  129. #endif
  130. #define OnClientCheckResponse Sec_OnClientCheckResponse
  131. #if defined Sec_OnClientCheckResponse
  132.     forward Sec_OnClientCheckResponse(playerid, actionid, memaddr, retndata);
  133. #endif
  134.  
  135. public autoSobCheck(playerid)
  136. {
  137.     if ( mobilePlayer[playerid] == true )
  138.     {
  139.         SendClientMessage(playerid, C_GREEN, "You’re currently playing the mobile version of SA-MP.");
  140.     }
  141.     // --
  142.     if ( pSuspicious[playerid] == true )
  143.     {
  144.         SendClientMessage(playerid, C_ERROR, "[ERROR] System has detected that you are probably using some mods. If you think this is a mistake, please contact the Admin.");
  145.         SetTimerEx("kickPlayer", 2500, false, "d", playerid);
  146.     }
  147.     if ( pCheat[playerid] > 0 )
  148.     {
  149.         for(new i = 0; i < 7; i++) SendClientMessage(playerid, -1, " ");
  150.         SendClientMessage(playerid, C_GREEN, "--------------------------------------------");
  151.     }
  152.     // --
  153.     switch ( pCheat[playerid] )
  154.     {
  155.         case 1:SendClientMessage(playerid, C_ERROR, "[ERROR] System has detected that you are using S0beit mod. Remove it and return to the server!"), SetTimerEx("kickPlayer", 2500, false, "d", playerid);
  156.         case 2..6:SendClientMessage(playerid, C_ERROR, "[ERROR] System has detected that you are using CLEO mod. Remove it and return to the server!"), SetTimerEx("kickPlayer", 2500, false, "d", playerid);
  157.         case 7:SendClientMessage(playerid, C_ERROR, "[ERROR] System has detected that you are using CLEO5+Ultimate ASI Loader mod. Remove it and return to the server!"), SetTimerEx("kickPlayer", 2500, false, "d", playerid);
  158.         case 8:SendClientMessage(playerid, C_ERROR, "[ERROR] System has detected that you are using SilentPatch. Remove it and return to the server!"), SetTimerEx("kickPlayer", 2500, false, "d", playerid);
  159.     }
  160.     return 1;
  161. }
  162.  
  163. public kickPlayer(playerid) Kick(playerid);
  164.  
  165. // --
  166. stock anotherForm(input)
  167. {
  168.     new result;
  169.  
  170.     #emit LOAD.S.pri input
  171.     #emit CONST.alt 0xFF
  172.     #emit AND
  173.     #emit CONST.alt 16
  174.     #emit SHL
  175.     #emit STOR.S.pri result
  176.  
  177.     #emit LOAD.S.pri input
  178.     #emit CONST.alt 0xFF00
  179.     #emit AND
  180.     #emit LOAD.S.alt result
  181.     #emit ADD
  182.     #emit STOR.S.pri result
  183.  
  184.     #emit LOAD.S.pri input
  185.     #emit CONST.alt 0xFF0000
  186.     #emit AND
  187.     #emit CONST.alt 16
  188.     #emit SHR
  189.     #emit LOAD.S.alt result
  190.     #emit ADD
  191.     #emit STOR.S.pri result
  192.  
  193.     return result;
  194. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement