Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- +--------------------------+
- | _ |
- | (_) |
- | _ ___ _ __ __ _ |
- | | |/ __| '__/ _` | |
- | | | (__| | | (_| | |
- | |_|\___|_| \__,_| |
- | |
- +--------------------------+
- [!] Automatic Cheats Detector R1.0
- [!] Developed by icra
- [!] Please, keep credits!
- */
- // Stores player positions at spawn so it can be restored after cheat check.
- new
- Float:ACD_pSpawn[MAX_PLAYERS][4],
- ACD_pInterior[MAX_PLAYERS];
- // Amount of banned/kicked players (resets every gamemode restart)
- new ACD_BannedPlayers = 0,
- ACD_KickedPlayers = 0;
- // Main configuration, type "true" or "false" to enable/disable something.
- new
- bool:ACD_Toggled = true, // Enable or disables the cheat check. Console / RCON (in game) command: togacd
- bool:ACD_LOGToggled = true, // Stores when a player get kicked/banned for mod detected. Console / RCON (in game) command: togacdlogs
- bool:ACD_BANToggled = false; // Bans player IP Address if mod is detected, else kicks him. Console / RCON (in game) command: togacdban
- public OnPlayerSpawn(playerid) {
- if(ACD_Toggled) {
- SetCameraBehindPlayer(playerid); // Stops possible camera moving
- TogglePlayerControllable(playerid, false); // Freezes the player
- GetPlayerPos(playerid, ACD_pSpawn[playerid][0], ACD_pSpawn[playerid][1], ACD_pSpawn[playerid][2]); // Stores current player position
- GetPlayerFacingAngle(playerid, ACD_pSpawn[playerid][3]); // Stores current player facing angle
- ACD_pInterior[playerid] = GetPlayerInterior(playerid); // Stores current player interior
- SetPlayerPos(playerid,-1155.2751,29.5401,14.1484); // Sets players pos to a random one (different by the stored)
- SetPlayerFacingAngle(playerid,134.4939); // Sets player facing angle to a random one (different by the stored)
- SetPlayerInterior(playerid,ACD_pInterior[playerid]+random(15)+playerid); // Sets player interior to a random one (different by the stored)
- // Note: ACD_pInterior[playerid]+random(15)+playerid is an algorithm that sets player in a unique interior and a different from its.
- SetTimerEx("ACD_HackShieldTimer", 2000, false, "i", playerid); // Starts timer to check if player is hacking or not
- }
- return true;
- }
- forward ACD_HackShieldTimer(playerid);
- public ACD_HackShieldTimer(playerid) {
- new Float:ACD_pVector[3], playeraddress[14], playername[MAX_PLAYER_NAME];
- GetPlayerCameraPos(playerid, ACD_pVector[0], ACD_pVector[1], ACD_pVector[2]); // Stores into pVector player's camera to detect if he's cheating.
- if(ACD_pVector[2] > 15.3) { // Checks if player camera has moved. If true, there is an unallowed mod installed.
- GetPlayerIp(playerid, playeraddress, sizeof(playeraddress)); // Stores player IP Address to report it in logs.
- GetPlayerName(playerid, playername, sizeof(playername));
- if(ACD_LOGToggled) printf("[!ACD!] Kicked player %s (%i), hacks detected. IP: %s",playername,playerid,playeraddress); // Sends a log to admin console.
- GameTextForPlayer(playerid, "~r~UNALLOWED GAME MODIFICATION", 2, 5000); // Notificate user.
- if(ACD_BANToggled) Kick(playerid), ACD_KickedPlayers++; else Ban(playerid), ACD_BannedPlayers++; // Kick / Ban the player (depends on your config)
- } else {
- SetPlayerPos(playerid, ACD_pSpawn[playerid][0], ACD_pSpawn[playerid][1], ACD_pSpawn[playerid][2]); // Stores back player position
- SetPlayerFacingAngle(playerid, ACD_pSpawn[playerid][3]); // Stores back player facing angle
- SetPlayerInterior(playerid, ACD_pInterior[playerid]); // Stores back player interior
- TogglePlayerControllable(playerid, true); // Allows players move again
- }
- return true;
- }
- stock ACD_Toggle(bool:ACD_status) {
- return ACD_Toggled = ACD_status;
- }
- stock ACD_ToggleLogs(bool:ACD_status) {
- return ACD_LOGToggled = ACD_status;
- }
- stock ACD_ToggleBan(bool:ACD_status) {
- return ACD_BANToggled = ACD_status;
- }
- stock ACD_KickedCount() {
- return ACD_KickedPlayers ++;
- }
- stock ACD_BannedCount() {
- return ACD_BannedPlayers ++;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement