SHOW:
|
|
- or go back to the newest paste.
1 | /* | |
2 | +--------------------------+ | |
3 | | _ | | |
4 | | (_) | | |
5 | | _ ___ _ __ __ _ | | |
6 | | | |/ __| '__/ _` | | | |
7 | | | | (__| | | (_| | | | |
8 | | |_|\___|_| \__,_| | | |
9 | | | | |
10 | +--------------------------+ | |
11 | ||
12 | - | [!] Automatic Cheats Detector R1.0 |
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 | - | // Amount of banned/kicked players (resets every gamemode restart) |
22 | + | |
23 | - | new ACD_BannedPlayers = 0, |
23 | + | |
24 | - | ACD_KickedPlayers = 0; |
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 | - | bool:ACD_Toggled = true, // Enable or disables the cheat check. Console / RCON (in game) command: togacd |
28 | + | |
29 | - | bool:ACD_LOGToggled = true, // Stores when a player get kicked/banned for mod detected. Console / RCON (in game) command: togacdlogs |
29 | + | |
30 | - | bool:ACD_BANToggled = false; // Bans player IP Address if mod is detected, else kicks him. Console / RCON (in game) command: togacdban |
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 | - | GetPlayerIp(playerid, playeraddress, sizeof(playeraddress)); // Stores player IP Address to report it in logs. |
59 | + | |
60 | - | GetPlayerName(playerid, playername, sizeof(playername)); |
60 | + | |
61 | return true; | |
62 | - | if(ACD_LOGToggled) printf("[!ACD!] Kicked player %s (%i), hacks detected. IP: %s",playername,playerid,playeraddress); // Sends a log to admin console. |
62 | + | |
63 | - | GameTextForPlayer(playerid, "~r~UNALLOWED GAME MODIFICATION", 2, 5000); // Notificate user. |
63 | + | |
64 | forward OnPlayerCheatDetected(playerid); | |
65 | - | if(ACD_BANToggled) Kick(playerid), ACD_KickedPlayers++; else Ban(playerid), ACD_BannedPlayers++; // Kick / Ban the player (depends on your config) |
65 | + | |
66 | stock ACD_Toggle(bool:ACD_status) { | |
67 | return ACD_Toggled = ACD_status; | |
68 | } |