Advertisement
icra

[Include] acd.inc for SA-MP 2.0

Jul 23rd, 2014
818
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2.     +--------------------------+
  3.     |    _                 |
  4.     |   (_)                |
  5.     |    _  ___ _ __ __ _  |
  6.     |   | |/ __| '__/ _` | |
  7.     |   | | (__| | | (_| | |
  8.     |   |_|\___|_|  \__,_| |
  9.     |                          |
  10.     +--------------------------+
  11.    
  12.     [!] Automatic Cheats Detector R2.0
  13.         [!] Developed by icra
  14.     [!] Please, keep credits!
  15. */
  16.  
  17. // Stores player positions at spawn so it can be restored after cheat check.
  18. new
  19.     Float:ACD_pSpawn[MAX_PLAYERS][4],
  20.     ACD_pInterior[MAX_PLAYERS];
  21.  
  22. // Main configuration, type "true" or "false" to enable/disable something.
  23. new
  24.     bool:ACD_Toggled = true; // Enable or disables the cheat check. Console / RCON (in game) command: togacd
  25.  
  26. public OnPlayerSpawn(playerid) {
  27.     if(ACD_Toggled) {
  28.         SetCameraBehindPlayer(playerid); // Stops possible camera moving
  29.         TogglePlayerControllable(playerid, false); // Freezes the player
  30.        
  31.         GetPlayerPos(playerid, ACD_pSpawn[playerid][0], ACD_pSpawn[playerid][1], ACD_pSpawn[playerid][2]); // Stores current player position
  32.         GetPlayerFacingAngle(playerid, ACD_pSpawn[playerid][3]); // Stores current player facing angle
  33.         ACD_pInterior[playerid] = GetPlayerInterior(playerid); // Stores current player interior
  34.        
  35.         SetPlayerPos(playerid,-1155.2751,29.5401,14.1484); // Sets players pos to a random one (different by the stored)
  36.         SetPlayerFacingAngle(playerid,134.4939); // Sets player facing angle to a random one (different by the stored)
  37.         SetPlayerInterior(playerid,ACD_pInterior[playerid]+random(15)+playerid); // Sets player interior to a random one (different by the stored)
  38.        
  39.         // Note: ACD_pInterior[playerid]+random(15)+playerid is an algorithm that sets player in a unique interior and a different from its.
  40.        
  41.         SetTimerEx("ACD_HackShieldTimer", 2000, false, "i", playerid); // Starts timer to check if player is hacking or not
  42.     }
  43.     return true;
  44. }
  45.  
  46. forward ACD_HackShieldTimer(playerid);
  47. public ACD_HackShieldTimer(playerid) {
  48.     new Float:ACD_pVector[3], playeraddress[14], playername[MAX_PLAYER_NAME];
  49.    
  50.     GetPlayerCameraPos(playerid, ACD_pVector[0], ACD_pVector[1], ACD_pVector[2]); // Stores into pVector player's camera to detect if he's cheating.
  51.    
  52.     if(ACD_pVector[2] > 15.3) { // Checks if player camera has moved. If true, there is an unallowed mod installed.
  53.         CallLocalFunction("OnPlayerCheatDetected", "i", playerid);
  54.     } else {
  55.         SetPlayerPos(playerid, ACD_pSpawn[playerid][0], ACD_pSpawn[playerid][1], ACD_pSpawn[playerid][2]); // Stores back player position
  56.         SetPlayerFacingAngle(playerid, ACD_pSpawn[playerid][3]); // Stores back player facing angle
  57.         SetPlayerInterior(playerid, ACD_pInterior[playerid]); // Stores back player interior
  58.        
  59.         TogglePlayerControllable(playerid, true); // Allows players move again
  60.     }
  61.     return true;
  62. }
  63.  
  64. forward OnPlayerCheatDetected(playerid);
  65.  
  66. stock ACD_Toggle(bool:ACD_status) {
  67.     return ACD_Toggled = ACD_status;
  68. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement