├── .gitattributes ├── pawn.json ├── .github └── ISSUE_TEMPLATE │ ├── feature_request.md │ └── bug_report.md ├── .gitignore ├── test.pwn ├── Anti-Cheat ├── FakeConnect.inc ├── Jetpack.inc ├── ChatSpam.inc ├── CarSpam.inc ├── SlideBug.inc ├── EasyDialog.inc ├── SpeedCheats.inc ├── MoneyCheats.inc ├── GodMode.inc ├── VehicleAbuse.inc ├── FakeKill.inc ├── BugCheats.inc ├── LaggersDetect.inc ├── GunCheats.inc ├── VehicleMods.inc └── CarTroll.inc ├── README.md ├── Rogue-AC.inc └── LICENSE /.gitattributes: -------------------------------------------------------------------------------- 1 | *.pwn linguist-language=Pawn 2 | *.inc linguist-language=Pawn 3 | -------------------------------------------------------------------------------- /pawn.json: -------------------------------------------------------------------------------- 1 | { 2 | "user": "RogueDrifter", 3 | "repo": "Rogue-AC", 4 | "entry": "test.pwn", 5 | "output": "test.amx", 6 | "dependencies": [ 7 | "sampctl/samp-stdlib" 8 | ] 9 | } 10 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | 5 | --- 6 | 7 | **Is your feature request related to a problem? Please describe.** 8 | A clear and concise description of what the suggestion is. Ex. A certain function in the AC that could be improved [...] 9 | 10 | **Describe the solution you'd like** 11 | A clear and concise description of what you think could improve it. 12 | 13 | **Describe alternatives you've considered** 14 | A clear and concise description of any alternative solutions or features you've considered. 15 | 16 | **Additional context** 17 | Add any other context about the feature request here. 18 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | 5 | --- 6 | 7 | **Describe the bug** 8 | A clear and concise description of what the bug is. 9 | 10 | **To Reproduce** 11 | Steps to reproduce the behavior: 12 | 1. Go to '...' 13 | 2. Click on '....' 14 | 3. See the bug 15 | 16 | **Expected behavior** 17 | A clear and concise description of what you expected to happen. 18 | 19 | **Screenshots** 20 | If applicable, add screenshots to help explain your problem. 21 | 22 | **Samp details (please complete the following information):** 23 | - Version: [e.g. 0.3.7/0.3.7-R2] 24 | - Using filterscripts? [Yes/No] 25 | - Using sampctl? [Yes/No] 26 | 27 | **Additional context** 28 | Add any other context about the problem here. 29 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # 2 | # Package only files 3 | # 4 | 5 | # Compiled Bytecode, precompiled output and assembly 6 | *.amx 7 | *.lst 8 | *.asm 9 | 10 | # Vendor directory for dependencies 11 | dependencies/ 12 | 13 | # Dependency versions lockfile 14 | pawn.lock 15 | 16 | 17 | # 18 | # Server/gamemode related files 19 | # 20 | 21 | # compiled settings file 22 | # keep `samp.json` file on version control 23 | # but make sure the `rcon_password` field is set externally 24 | # you can use the environment variable `SAMP_RCON_PASSWORD` to do this. 25 | server.cfg 26 | 27 | # Plugins directory 28 | plugins/ 29 | 30 | # binaries 31 | *.exe 32 | *.dll 33 | *.so 34 | announce 35 | samp03svr 36 | samp-npc 37 | 38 | # logs 39 | logs/ 40 | server_log.txt 41 | 42 | # 43 | # Common files 44 | # 45 | 46 | *.sublime-workspace 47 | .vscode 48 | -------------------------------------------------------------------------------- /test.pwn: -------------------------------------------------------------------------------- 1 | #include "a_samp.inc" 2 | #include "Rogue-AC.inc" 3 | 4 | 5 | //OnPlayerViolate default example: 6 | #define MAX_WARNS_AC 3 //Max warns before kick in severe case 1 7 | #define AC_MESSAGE_COLOR -1 8 | 9 | static s_playerWarnings[MAX_PLAYERS]; 10 | forward OnPlayerViolate(playerid, severity, violationCode, const violationName[]); 11 | public OnPlayerViolate(playerid, severity, violationCode, const violationName[]) 12 | { 13 | new acString[128], name[MAX_PLAYER_NAME]; 14 | GetPlayerName(playerid, name, sizeof name); 15 | 16 | switch(severity) 17 | { 18 | case SEVERITY_CASE_ONE: 19 | { 20 | if(s_playerWarnings[playerid] < MAX_WARNS_AC) s_playerWarnings[playerid]++; 21 | else 22 | { 23 | format(acString, sizeof acString, "Player %s was kicked after 3 warnings, reason: Code violation #%d", name, violationCode); 24 | Kick(playerid); 25 | SendClientMessageToAll(AC_MESSAGE_COLOR, acString); 26 | 27 | } 28 | } 29 | case SEVERITY_CASE_TWO: 30 | { 31 | format(acString, sizeof acString, "Player %s was kicked, reason: Code violation #%d", name, violationCode); 32 | Kick(playerid); 33 | SendClientMessageToAll(AC_MESSAGE_COLOR, acString); 34 | } 35 | case SEVERITY_CASE_THREE: 36 | { 37 | format(acString, sizeof acString, "Player %s was banned, reason: Code violation #%d", name, violationCode); 38 | BanEx(playerid, violationName); 39 | SendClientMessageToAll(AC_MESSAGE_COLOR, acString); 40 | } 41 | } 42 | return 1; 43 | } 44 | public OnPlayerDisconnect(playerid, reason) 45 | { 46 | s_playerWarnings[playerid] = 0; 47 | return 1; 48 | } -------------------------------------------------------------------------------- /Anti-Cheat/FakeConnect.inc: -------------------------------------------------------------------------------- 1 | /* 2 | Anti fake client by Rogue 2018/3/26 3 | -=-=-= 4 | Last updated on Mar 30th. 5 | =-=-=-=-=-=-=-= 6 | OnPlayerFakeConnect(playerid); 7 | -=-= 8 | playerid = the cheater who connected with a fake client. 9 | -=-=-=-=-=-= 10 | */ 11 | 12 | #if !defined FILTERSCRIPT 13 | 14 | #if defined _rAFC_Included_ 15 | #endinput 16 | #endif 17 | 18 | #define _rAFC_Included_ 19 | #define AFC_NUMBER 30 20 | 21 | #include 22 | 23 | #if !defined gpci 24 | native gpci(playerid, serial[], len); 25 | #endif 26 | 27 | #if defined AFC_OnPlayerConnect 28 | forward AFC_OnPlayerConnect(playerid); 29 | #endif 30 | 31 | #if defined OnPlayerFakeConnect 32 | forward OnPlayerFakeConnect(playerid); 33 | #endif 34 | 35 | static bool:IsPlayerBot(playerid) 36 | { 37 | if(IsPlayerNPC(playerid)) return false; 38 | new temporaryID[80], temporaryNumber; 39 | gpci(playerid, temporaryID, sizeof(temporaryID)); 40 | for(new i; i < strlen(temporaryID); i++) 41 | { 42 | if(temporaryID[i] >= '0' && temporaryID[i] <= '9') temporaryNumber++; 43 | } 44 | return (temporaryNumber >= AFC_NUMBER || strlen(temporaryID) <= AFC_NUMBER); 45 | } 46 | 47 | public OnPlayerConnect(playerid) 48 | { 49 | if(IsPlayerBot(playerid)) 50 | { 51 | #if defined OnPlayerFakeConnect 52 | OnPlayerFakeConnect(playerid); 53 | #endif 54 | } 55 | 56 | #if defined AFC_OnPlayerConnect 57 | return AFC_OnPlayerConnect(playerid); 58 | #else 59 | return 1; 60 | #endif 61 | } 62 | 63 | #if defined _ALS_OnPlayerConnect 64 | #undef OnPlayerConnect 65 | #else 66 | #define _ALS_OnPlayerConnect 67 | #endif 68 | 69 | #define OnPlayerConnect AFC_OnPlayerConnect 70 | 71 | #endif 72 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Rogue-AC (THIS WILL WORK FOREVER) 2 | 3 | [![sampctl](https://shields.southcla.ws/badge/sampctl-Anti_cheat_pack-2f2f2f.svg?style=for-the-badge)](https://github.com/RogueDrifter/Anti_cheat_pack) 4 | 5 | This is a pack of 14 anticheats and 3 helping systems which you can control through callbacks mentioned 6 | in the includes and the test.pwn file. 7 | 8 | `Installation`: The Rogue-AC file needs to be included in your gamemode and in all filterscripts, function(s) is/are to be used only within the gamemode. 9 | 10 | `Testing`: All can be done through the test.pwn folder which already contains all of the includes and their callbacks nottify you through `SCM` and `print` messages 11 | 12 | `Version`: `8.0` 13 | 14 | # Installation 15 | 16 | Simply install to your project: 17 | 18 | ```bash 19 | sampctl package install RogueDrifter/Anti_cheat_pack 20 | ``` 21 | 22 | Include in your code and begin using the library: 23 | 24 | ```pawn 25 | #include 26 | ``` 27 | 28 | # Usage 29 | 30 | Use the callbacks provided to you by the includes depending on the type of it. 31 | 32 | If you're including the pack as a whole you'll need to only use the callback `OnPlayerViolate` 33 | 34 | Details for callback: 35 | ``forward OnPlayerViolate(playerid, severity, violationCode, const violationName[]);`` 36 | Whereas: 37 | 38 | ``` 39 | playerid = cheater player id. 40 | 41 | severity = how bad cheating is, 42 | types: 43 | #define SEVERITY_CASE_ONE 0 //Warn then kick 44 | #define SEVERITY_CASE_TWO 1 //Kick 45 | #define SEVERITY_CASE_THREE 2 //Ban 46 | 47 | violationcode: which callback was triggered (codes can be found below in the #CONTAINS section. 48 | 49 | violationName: basically a string for the cheat name which makes it easier to write a string. 50 | ``` 51 | 52 | If you use separate includes you can use the respective callbacks in the test.pwn file. 53 | 54 | If you want to disable any anti cheat when using the Rogue-AC file, you can put this line before the include: 55 | 56 | ``#define DISABLE_[anti cheat file name]`` 57 | 58 | For example: 59 | ``#define DISABLE_JETPACK`` 60 | and so on. 61 | 62 | NOTE: If you don't use the callback, my include will do all the work for you. 63 | 64 | # Testing 65 | 66 | Use the test.pwn file and check the server for client messages/log for printed messages. 67 | 68 | To test, simply run the package: 69 | 70 | ```bash 71 | sampctl package run 72 | ``` 73 | 74 | # Contains: 75 | 76 | ``` 77 | #define VIOLATION_CODE_BUGATTEMPT 0 78 | #define VIOLATION_CODE_LAGOUT 1 79 | #define VIOLATION_CODE_SLIDEBUG 2 80 | #define VIOLATION_CODE_INVALIDMODS 3 81 | #define VIOLATION_CODE_PARTICLESPAM 4 82 | #define VIOLATION_CODE_CARSWING 5 83 | #define VIOLATION_CODE_MONEYHACK 6 84 | #define VIOLATION_CODE_CARTROLL 7 85 | #define VIOLATION_CODE_CARSPAM 8 86 | #define VIOLATION_CODE_AIRBRAKE 9 87 | #define VIOLATION_CODE_SPEEDING 10 88 | #define VIOLATION_CODE_CHATSPAM 11 89 | #define VIOLATION_CODE_JETPACK 12 90 | #define VIOLATION_CODE_FAKECONNECT 13 91 | #define VIOLATION_CODE_FAKEKILL 14 92 | #define VIOLATION_CODE_GODMODE 15 93 | #define VIOLATION_CODE_WEPHACKS 16 94 | ``` 95 | 96 | # How to update: 97 | 98 | Simply open your project and run the code: 99 | 100 | ```bash 101 | sampctl package ensure 102 | ``` 103 | Thread: https://www.burgershot.gg/showthread.php?tid=873 104 | -------------------------------------------------------------------------------- /Anti-Cheat/Jetpack.inc: -------------------------------------------------------------------------------- 1 | /* 2 | Anti jetpack cheats by Rogue 2018/3/26. 3 | -=-=-=-= 4 | Last updated on April 18th. 5 | -=-=-=- 6 | OnPlayerJetpackCheat(playerid); 7 | -=-=-=-= 8 | playerid = the cheater who spoofed a jetpack. 9 | -=-=-=-=-=--=-=-= 10 | */ 11 | 12 | #include 13 | 14 | #if defined _rAntiJC_Included 15 | #endinput 16 | #endif 17 | 18 | #define _rAntiJC_Included 19 | 20 | #if !defined FILTERSCRIPT 21 | 22 | #if defined OnPlayerJetpackCheat 23 | forward OnPlayerJetpackCheat(playerid); 24 | #endif 25 | 26 | forward AJC_SetPlayerSpecialAction(playerid, actionid); 27 | 28 | static bool:s_jetpackProtection[MAX_PLAYERS char]; 29 | 30 | #if defined AJC_OnPlayerUpdate 31 | forward AJC_OnPlayerUpdate(playerid); 32 | #endif 33 | 34 | #if defined AJC_OnPlayerDisconnect 35 | forward AJC_OnPlayerDisconnect(playerid, reason); 36 | #endif 37 | 38 | #if defined AJC_OnPlayerSpawn 39 | forward AJC_OnPlayerSpawn(playerid); 40 | #endif 41 | 42 | public AJC_SetPlayerSpecialAction(playerid, actionid) 43 | { 44 | if(playerid > MAX_PLAYERS || playerid < 0) return 0; 45 | if(actionid == SPECIAL_ACTION_USEJETPACK) s_jetpackProtection{playerid} = true; 46 | return SetPlayerSpecialAction(playerid, actionid); 47 | } 48 | 49 | public OnPlayerDisconnect(playerid, reason) 50 | { 51 | s_jetpackProtection{playerid} = false; 52 | #if defined AJC_OnPlayerDisconnect 53 | return AJC_OnPlayerDisconnect(playerid, reason); 54 | #else 55 | return 1; 56 | #endif 57 | } 58 | 59 | public OnPlayerUpdate(playerid) 60 | { 61 | if(GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_USEJETPACK && !s_jetpackProtection{playerid}) 62 | { 63 | s_jetpackProtection{playerid} = true; 64 | SetPlayerHealth(playerid, 0.0); 65 | #if defined OnPlayerJetpackCheat 66 | OnPlayerJetpackCheat(playerid); 67 | #endif 68 | } 69 | 70 | #if defined AJC_OnPlayerUpdate 71 | return AJC_OnPlayerUpdate(playerid); 72 | #else 73 | return 1; 74 | #endif 75 | } 76 | 77 | public OnPlayerSpawn(playerid) 78 | { 79 | s_jetpackProtection{playerid} = false; 80 | #if defined AJC_OnPlayerSpawn 81 | return AJC_OnPlayerSpawn(playerid); 82 | #else 83 | return 1; 84 | #endif 85 | } 86 | 87 | #if defined _ALS_OnPlayerUpdate 88 | #undef OnPlayerUpdate 89 | #else 90 | #define _ALS_OnPlayerUpdate 91 | #endif 92 | 93 | #define OnPlayerUpdate AJC_OnPlayerUpdate 94 | 95 | #if defined _ALS_OnPlayerSpawn 96 | #undef OnPlayerSpawn 97 | #else 98 | #define _ALS_OnPlayerSpawn 99 | #endif 100 | 101 | #define OnPlayerSpawn AJC_OnPlayerSpawn 102 | 103 | #if defined _ALS_OnPlayerDisconnect 104 | #undef OnPlayerDisconnect 105 | #else 106 | #define _ALS_OnPlayerDisconnect 107 | #endif 108 | 109 | #define OnPlayerDisconnect AJC_OnPlayerDisconnect 110 | 111 | #if defined _ALS_SetPlayerSpecialAction 112 | #undef SetPlayerSpecialAction 113 | #else 114 | #define _ALS_SetPlayerSpecialAction 115 | #endif 116 | 117 | #define SetPlayerSpecialAction AJC_SetPlayerSpecialAction 118 | 119 | #else 120 | 121 | stock AJC_FSetPlayerSpecialAction(playerid, actionid) 122 | return CallRemoteFunction("AJC_SetPlayerSpecialAction", "ii", playerid, actionid); 123 | 124 | #if defined _ALS_SetPlayerSpecialAction 125 | #undef SetPlayerSpecialAction 126 | #else 127 | #define _ALS_SetPlayerSpecialAction 128 | #endif 129 | 130 | #define SetPlayerSpecialAction AJC_FSetPlayerSpecialAction 131 | 132 | #endif 133 | -------------------------------------------------------------------------------- /Anti-Cheat/ChatSpam.inc: -------------------------------------------------------------------------------- 1 | /* 2 | Anti spam by Rogue 2018/3/25. 3 | ---- 4 | Last Updated Mar 29th 5 | -=-=-=-=-=-=- 6 | 7 | Callbacks: 8 | ---------- 9 | 10 | OnPlayerSpamChat(playerid); 11 | -- 12 | playerid = the spamer 13 | -=-=-=-=-=--=-=-= 14 | */ 15 | 16 | #if !defined FILTERSCRIPT 17 | 18 | #if defined _rAntiSpammer_Included 19 | #endinput 20 | #endif 21 | 22 | #define _rAntiSpammer_Included 23 | 24 | #include 25 | 26 | #if defined OnPlayerSpamChat 27 | forward OnPlayerSpamChat(playerid); 28 | #endif 29 | 30 | #if defined Aspa_OnPlayerText 31 | forward Aspa_OnPlayerText(playerid, text[]); 32 | #endif 33 | 34 | #if defined Aspa_OnPlayerDisconnect 35 | forward Aspa_OnPlayerDisconnect(playerid, reason); 36 | #endif 37 | 38 | enum E_SPAM_PLAYER_DATA 39 | { 40 | firstText, 41 | secondText, 42 | 43 | spamTimer, 44 | spamWarnings 45 | } 46 | 47 | static 48 | playerData[MAX_PLAYERS][E_SPAM_PLAYER_DATA]; 49 | 50 | #define MAX_WAIT_TIME 1 //max waiting time in MS (half a second here) 51 | 52 | public OnPlayerText(playerid, text[]) 53 | { 54 | if(playerData[playerid][secondText] == 0 && playerData[playerid][firstText] ==0 ) playerData[playerid][firstText] = gettime(); 55 | else if(playerData[playerid][firstText] != 0 && playerData[playerid][secondText] == 0) playerData[playerid][secondText] = gettime(); 56 | 57 | else if(playerData[playerid][firstText] != 0 && playerData[playerid][secondText] != 0 && playerData[playerid][secondText] - playerData[playerid][firstText] < MAX_WAIT_TIME) 58 | { 59 | playerData[playerid][spamWarnings]++; 60 | switch(playerData[playerid][spamWarnings]) 61 | { 62 | case 1: 63 | { 64 | KillTimer(playerData[playerid][spamTimer]); 65 | playerData[playerid][spamTimer] = SetTimerEx("ASPA_RWarns", 1500, false, "i", playerid); 66 | } 67 | case 2: 68 | { 69 | KillTimer(playerData[playerid][spamTimer]); 70 | playerData[playerid][spamTimer] = SetTimerEx("ASPA_RWarns", 3000, false, "i", playerid); 71 | } 72 | case 3: 73 | { 74 | KillTimer(playerData[playerid][spamTimer]); 75 | playerData[playerid][spamWarnings] = 0; 76 | CallLocalFunction("OnPlayerSpamChat", "i", playerid); 77 | } 78 | } 79 | playerData[playerid][firstText] = 0; 80 | playerData[playerid][secondText] = 0; 81 | return 0; 82 | } 83 | else if(playerData[playerid][firstText] != 0 && playerData[playerid][secondText] != 0 && playerData[playerid][secondText] - playerData[playerid][firstText] >= MAX_WAIT_TIME) 84 | { 85 | playerData[playerid][firstText] =0; 86 | playerData[playerid][secondText] =0; 87 | } 88 | 89 | #if defined Aspa_OnPlayerText 90 | return Aspa_OnPlayerText(playerid, text); 91 | #else 92 | return 1; 93 | #endif 94 | } 95 | 96 | public OnPlayerDisconnect(playerid, reason) 97 | { 98 | playerData[playerid][firstText] = 0; 99 | playerData[playerid][secondText] = 0; 100 | 101 | #if defined Aspa_OnPlayerDisconnect 102 | return Aspa_OnPlayerDisconnect(playerid, reason); 103 | #else 104 | return 1; 105 | #endif 106 | } 107 | 108 | #if defined _ALS_OnPlayerDisconnect 109 | #undef OnPlayerDisconnect 110 | #else 111 | #define _ALS_OnPlayerDisconnect 112 | #endif 113 | 114 | #define OnPlayerDisconnect Aspa_OnPlayerDisconnect 115 | 116 | #if defined _ALS_OnPlayerText 117 | #undef OnPlayerText 118 | #else 119 | #define _ALS_OnPlayerText 120 | #endif 121 | 122 | #define OnPlayerText Aspa_OnPlayerText 123 | 124 | #endif -------------------------------------------------------------------------------- /Anti-Cheat/CarSpam.inc: -------------------------------------------------------------------------------- 1 | /* 2 | Anti car spammer by RogueDrifter 2018/1/30 . 3 | (Will auto respawn the spammed cars after the callback). 4 | ===Usables==== 5 | -Number of cars a player can stream in- 6 | #define ACS_MAX_STREAMIN [number] 7 | 8 | -Public function called when a player exceeds maximum vehicles streamed in- 9 | OnPlayerSpamCars(playerid, number); 10 | */ 11 | 12 | #if !defined FILTERSCRIPT 13 | 14 | #if defined ACS_Included 15 | #endinput 16 | #endif 17 | 18 | #define ACS_Included 19 | 20 | #include 21 | 22 | #if !defined IsValidVehicle 23 | native IsValidVehicle(vehicleid); 24 | #endif 25 | 26 | #if !defined ACS_MAX_STREAMIN 27 | #define ACS_MAX_STREAMIN 100 28 | #endif 29 | 30 | #if defined ACS_OnPlayerConnect 31 | forward ACS_OnPlayerConnect(playerid); 32 | #endif 33 | 34 | #if defined ACS_OnPlayerDisconnect 35 | forward ACS_OnPlayerDisconnect(playerid, reason); 36 | #endif 37 | 38 | #if defined ACS_OnVehicleStreamIn 39 | forward ACS_OnVehicleStreamIn(vehicleid, forplayerid); 40 | #endif 41 | 42 | #if defined ACS_OnVehicleStreamOut 43 | forward ACS_OnVehicleStreamOut(vehicleid, forplayerid); 44 | #endif 45 | 46 | new 47 | g_checkTimer[MAX_PLAYERS] ; 48 | new 49 | g_streamingPlayer[MAX_VEHICLES]; 50 | new 51 | g_streamedCars[MAX_PLAYERS] ; 52 | 53 | forward CheckCarSpam(playerid); 54 | 55 | public CheckCarSpam(playerid) 56 | { 57 | if(g_streamedCars[playerid] >= ACS_MAX_STREAMIN) 58 | { 59 | for(new v; v < MAX_VEHICLES; v++) 60 | { 61 | if(!IsValidVehicle(v) || g_streamingPlayer[v] != playerid) continue; 62 | SetVehicleToRespawn(v); 63 | } 64 | 65 | #if defined OnPlayerSpamCars 66 | OnPlayerSpamCars(playerid, g_streamedCars[playerid]); 67 | #endif 68 | } 69 | 70 | return 1; 71 | } 72 | 73 | public OnPlayerDisconnect(playerid, reason) 74 | { 75 | KillTimer(g_checkTimer[playerid]); 76 | 77 | #if defined ACS_OnPlayerDisconnect 78 | return ACS_OnPlayerDisconnect(playerid, reason); 79 | #else 80 | return 1; 81 | #endif 82 | } 83 | 84 | public OnPlayerConnect(playerid) 85 | { 86 | g_streamedCars[playerid] = 0; 87 | g_checkTimer[playerid] = SetTimerEx("CheckCarSpam", 2000, true, "i", playerid); 88 | #if defined ACS_OnPlayerConnect 89 | return ACS_OnPlayerConnect(playerid); 90 | #else 91 | return 1; 92 | #endif 93 | } 94 | 95 | public OnVehicleStreamIn(vehicleid, forplayerid) 96 | { 97 | g_streamingPlayer[vehicleid] = forplayerid; 98 | g_streamedCars[forplayerid] ++; 99 | #if defined ACS_OnVehicleStreamIn 100 | return ACS_OnVehicleStreamIn(vehicleid, forplayerid); 101 | #else 102 | return 1; 103 | #endif 104 | } 105 | 106 | public OnVehicleStreamOut(vehicleid, forplayerid) 107 | { 108 | g_streamingPlayer[vehicleid] = -1; 109 | g_streamedCars[forplayerid] --; 110 | 111 | #if defined ACS_OnVehicleStreamOut 112 | return ACS_OnVehicleStreamOut(vehicleid, forplayerid); 113 | #else 114 | return 1; 115 | #endif 116 | } 117 | 118 | #if defined OnPlayerSpamCars 119 | forward OnPlayerSpamCars(playerid, number); 120 | #endif 121 | 122 | #if defined _ALS_OnPlayerConnect 123 | #undef OnPlayerConnect 124 | #else 125 | #define _ALS_OnPlayerConnect 126 | #endif 127 | 128 | #define OnPlayerConnect ACS_OnPlayerConnect 129 | 130 | #if defined _ALS_OnPlayerDisconnect 131 | #undef OnPlayerDisconnect 132 | #else 133 | #define _ALS_OnPlayerDisconnect 134 | #endif 135 | 136 | #define OnPlayerDisconnect ACS_OnPlayerDisconnect 137 | 138 | #if defined _ALS_OnVehicleStreamIn 139 | #undef OnVehicleStreamIn 140 | #else 141 | #define _ALS_OnVehicleStreamIn 142 | #endif 143 | 144 | #define OnVehicleStreamIn ACS_OnVehicleStreamIn 145 | 146 | #if defined _ALS_OnVehicleStreamOut 147 | #undef OnVehicleStreamOut 148 | #else 149 | #define _ALS_OnVehicleStreamOut 150 | #endif 151 | 152 | #define OnVehicleStreamOut ACS_OnVehicleStreamOut 153 | 154 | #endif -------------------------------------------------------------------------------- /Anti-Cheat/SlideBug.inc: -------------------------------------------------------------------------------- 1 | /*Anti-Slide bug include by RogueDrifter 2017-12-13. 2 | -=-=-=-= 3 | Callbacks: 4 | -=-=-=-=-= 5 | OnPlayerSlide(playerid, weaponid, speed); 6 | -=-=-=-==-=*/ 7 | 8 | #if !defined FILTERSCRIPT 9 | 10 | #if defined _rSBAIncluded_ 11 | #endinput 12 | #endif 13 | 14 | #define _rSBAIncluded_ 15 | 16 | #include 17 | 18 | enum E_PLAYER_SLIDE_INFO 19 | { 20 | slideCheck, 21 | 22 | bool:isSliding 23 | }; 24 | 25 | static 26 | playerData[MAX_PLAYERS][E_PLAYER_SLIDE_INFO]; 27 | 28 | forward RemoveSlideCheck(playerid); 29 | forward CheckPlayerSlide(playerid); 30 | 31 | #if defined SBA_OnPlayerConnect 32 | forward SBA_OnPlayerConnect(playerid); 33 | #endif 34 | 35 | #if defined SBA_OnPlayerDisconnect 36 | forward SBA_OnPlayerDisconnect(playerid, reason); 37 | #endif 38 | 39 | #if defined SBA_OnPlayerKeyStateChange 40 | forward SBA_OnPlayerKeyStateChange(playerid, newkeys, oldkeys); 41 | #endif 42 | 43 | static GetPlayerOnFootSpeed(playerid)//I didn't create this 44 | { 45 | new Float:ST[4]; 46 | GetPlayerVelocity(playerid, ST[0], ST[1], ST[2]); 47 | ST[3] = floatsqroot(floatpower(floatabs(ST[0]), 2.0) + floatpower(floatabs(ST[1]), 2.0) + floatpower(floatabs(ST[2]), 2.0)) * 179.28625; 48 | 49 | return floatround(ST[3]); 50 | } 51 | 52 | static bool:IsPlayerAiming(playerid) 53 | { 54 | new playerAnim = GetPlayerAnimationIndex(playerid); 55 | if (((playerAnim >= 1160) && (playerAnim <= 1163)) || (playerAnim == 1167) || (playerAnim == 1365) || 56 | (playerAnim == 1643) || (playerAnim == 1453) || (playerAnim == 220)) return true; 57 | 58 | return false; 59 | } 60 | 61 | public CheckPlayerSlide(playerid) 62 | { 63 | new playerWeapon = GetPlayerWeapon(playerid); 64 | new playerSpeed = GetPlayerOnFootSpeed(playerid); 65 | if(playerSpeed > 15 && GetPlayerSurfingVehicleID(playerid) == INVALID_VEHICLE_ID && IsPlayerAiming(playerid) 66 | && GetPlayerState(playerid) == PLAYER_STATE_ONFOOT && playerData[playerid][isSliding] 67 | && (playerWeapon >= 22 && playerWeapon<=38) ) 68 | { 69 | CallLocalFunction("OnPlayerSlide", "ddd", playerid, playerWeapon, playerSpeed); 70 | } 71 | 72 | return 1; 73 | } 74 | 75 | public RemoveSlideCheck(playerid) 76 | { 77 | playerData[playerid][isSliding] =false; 78 | 79 | return 1; 80 | } 81 | 82 | public OnPlayerKeyStateChange(playerid, newkeys, oldkeys) 83 | { 84 | if( (newkeys & 128) && ( newkeys & 8) && (newkeys & 2)) 85 | { 86 | if(!playerData[playerid][isSliding]) SetTimerEx("RemoveSlideCheck", 2000, false, "i", playerid); 87 | playerData[playerid][isSliding] =true; 88 | } 89 | 90 | #if defined SBA_OnPlayerKeyStateChange 91 | return SBA_OnPlayerKeyStateChange(playerid, newkeys, oldkeys); 92 | #else 93 | return 1; 94 | #endif 95 | } 96 | 97 | public OnPlayerConnect(playerid) 98 | { 99 | playerData[playerid][slideCheck] = SetTimerEx("CheckPlayerSlide", 1000, true, "d", playerid); 100 | 101 | #if defined SBA_OnPlayerConnect 102 | return SBA_OnPlayerConnect(playerid); 103 | #else 104 | return 1; 105 | #endif 106 | } 107 | 108 | public OnPlayerDisconnect(playerid, reason) 109 | { 110 | playerData[playerid][isSliding]=false; 111 | KillTimer(playerData[playerid][slideCheck]); 112 | 113 | #if defined SBA_OnPlayerDisconnect 114 | return SBA_OnPlayerDisconnect(playerid, reason); 115 | #else 116 | return 1; 117 | #endif 118 | } 119 | 120 | #if defined _ALS_OnPlayerKeyStateChange 121 | #undef OnPlayerKeyStateChange 122 | #else 123 | #define _ALS_OnPlayerKeyStateChange 124 | #endif 125 | 126 | #if defined _ALS_OnPlayerConnect 127 | #undef OnPlayerConnect 128 | #else 129 | #define _ALS_OnPlayerConnect 130 | #endif 131 | 132 | #if defined _ALS_OnPlayerDisconnect 133 | #undef OnPlayerDisconnect 134 | #else 135 | #define _ALS_OnPlayerDisconnect 136 | #endif 137 | 138 | #define OnPlayerKeyStateChange SBA_OnPlayerKeyStateChange 139 | #define OnPlayerConnect SBA_OnPlayerConnect 140 | #define OnPlayerDisconnect SBA_OnPlayerDisconnect 141 | 142 | #if defined OnPlayerSlide 143 | forward OnPlayerSlide(playerid, weaponid, speed); 144 | #endif 145 | 146 | #endif -------------------------------------------------------------------------------- /Anti-Cheat/EasyDialog.inc: -------------------------------------------------------------------------------- 1 | /* 2 | easyDialog.inc - Dialogs made easier! 3 | With this useful include, scripters can easily create 4 | dialogs and show them to players. 5 | This include will prevent dialog spoofing, ID collision 6 | and a lot more. 7 | Created by Emmet on Friday, January 24, 2014. 8 | Updated by Southclaws 2017-10-13 to add include guard 9 | */ 10 | 11 | 12 | #if defined _easyDialog_included 13 | #endinput 14 | #endif 15 | #define _easyDialog_included 16 | 17 | #if !defined isnull 18 | #define isnull(%1) \ 19 | ((!(%1[0])) || (((%1[0]) == '\1') && (!(%1[1])))) 20 | #endif 21 | 22 | #define Dialog:%0(%1) \ 23 | forward dialog_%0(%1); public dialog_%0(%1) 24 | 25 | #define Dialog_Show(%0,%1, \ 26 | Dialog_Open(%0, #%1, 27 | 28 | #define Dialog_Opened(%0) \ 29 | (CallRemoteFunction("Dialog_IsOpened", "i", (%0))) 30 | 31 | static 32 | s_DialogName[MAX_PLAYERS][32 char], 33 | s_DialogOpened[MAX_PLAYERS] 34 | ; 35 | 36 | forward OnDialogPerformed(playerid, dialog[], response, success); 37 | 38 | //I don't even know why Emmet_ put this code but it's irrelevant 39 | /* 40 | forward @dialog_format(); @dialog_format() { 41 | format("", 0, ""); 42 | } 43 | */ 44 | 45 | forward Dialog_IsOpened(playerid); 46 | public Dialog_IsOpened(playerid) 47 | { 48 | return (s_DialogOpened[playerid]); 49 | } 50 | 51 | stock Dialog_Close(playerid) 52 | { 53 | s_DialogName[playerid]{0} = 0; 54 | s_DialogOpened[playerid] = 0; 55 | 56 | return ShowPlayerDialog(playerid, -1, DIALOG_STYLE_MSGBOX, " ", " ", " ", ""); 57 | } 58 | 59 | stock Dialog_Open(playerid, const function[], style, const caption[], const info[], const button1[], const button2[], {Float,_}:...) 60 | { 61 | static 62 | string[4096], 63 | args 64 | ; 65 | 66 | if (!strlen(info)) 67 | { 68 | return 0; 69 | } 70 | if ((args = numargs()) > 7) 71 | { 72 | while (--args >= 7) 73 | { 74 | #emit LCTRL 5 75 | #emit LOAD.alt args 76 | #emit SHL.C.alt 2 77 | #emit ADD.C 12 78 | #emit ADD 79 | #emit LOAD.I 80 | #emit PUSH.pri 81 | } 82 | #emit PUSH.S info 83 | #emit PUSH.C 4096 84 | #emit PUSH.C string 85 | 86 | #emit LOAD.S.pri 8 87 | #emit CONST.alt 16 88 | #emit SUB 89 | #emit PUSH.pri 90 | 91 | #emit SYSREQ.C format 92 | #emit LCTRL 5 93 | #emit SCTRL 4 94 | 95 | ShowPlayerDialog(playerid, 32700, style, caption, string, button1, button2); 96 | } 97 | else 98 | { 99 | ShowPlayerDialog(playerid, 32700, style, caption, info, button1, button2); 100 | } 101 | s_DialogOpened[playerid] = 1; 102 | 103 | strpack(s_DialogName[playerid], function, 32 char); 104 | 105 | return 1; 106 | } 107 | 108 | public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) 109 | { 110 | static 111 | s_Public = cellmax; 112 | 113 | if (s_Public == cellmax) 114 | { 115 | s_Public = funcidx("OnDialogPerformed"); 116 | } 117 | 118 | // Sanitize inputs. 119 | for (new i = 0, l = strlen(inputtext); i < l; i ++) 120 | { 121 | if (inputtext[i] == '%') 122 | { 123 | inputtext[i] = '#'; 124 | } 125 | } 126 | if (dialogid == 32700 && strlen(s_DialogName[playerid]) > 0) 127 | { 128 | new 129 | string[40]; 130 | 131 | strcat(string, "dialog_"); 132 | strcat(string, s_DialogName[playerid]); 133 | 134 | Dialog_Close(playerid); 135 | 136 | if ((s_Public == -1) || (CallLocalFunction("OnDialogPerformed", "dsdd", playerid, string[7], response, funcidx(string) != -1))) 137 | { 138 | CallLocalFunction(string, "ddds", playerid, response, listitem, (!inputtext[0]) ? ("\1") : (inputtext)); 139 | } 140 | } 141 | #if defined DR_OnDialogResponse 142 | return DR_OnDialogResponse(playerid, dialogid, response, listitem, inputtext); 143 | #else 144 | return 0; 145 | #endif 146 | } 147 | 148 | #if defined _ALS_OnDialogResponse 149 | #undef OnDialogResponse 150 | #else 151 | #define _ALS_OnDialogResponse 152 | #endif 153 | 154 | #define OnDialogResponse DR_OnDialogResponse 155 | 156 | #if defined DR_OnDialogResponse 157 | forward DR_OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]); 158 | #endif 159 | -------------------------------------------------------------------------------- /Anti-Cheat/SpeedCheats.inc: -------------------------------------------------------------------------------- 1 | /* 2 | Anti speed cheats by Rogue 2018/3/26 3 | -=-=-= 4 | Last updated on Apr 6th 5 | -=-=-=-= 6 | OnPlayerSpeedCheat(playerid, speedtype); 7 | -=-=-=-=- 8 | 9 | playerid = the cheater 10 | speedtype 0 = on foot 11 | speedtype 1 = in car 12 | speedtype 2 = in plane 13 | -=-=-=-=- 14 | */ 15 | 16 | #if !defined FILTERSCRIPT 17 | 18 | #include 19 | 20 | #if defined _rAntiSpeed_Included 21 | #endinput 22 | #endif 23 | 24 | #define _rAntiSpeed_Included 25 | #define ASC_MAX_FOOT_SPEED 110 26 | #define ASC_MAX_CAR_SPEED 290 27 | #define ASC_MAX_PLANE_SPEED 340 28 | #define ASC_MAX_SPEED_WARNS 2 29 | 30 | static bool:IsModelAPlane(vehicleid) 31 | { 32 | switch(GetVehicleModel(vehicleid)) 33 | { 34 | case 592, 577, 511, 512, 593, 520, 553, 476, 519, 460, 513, 464: return true; 35 | case 548, 425, 417, 487, 488, 497, 563, 447, 469, 465, 501: return true; 36 | } 37 | return false; 38 | } 39 | 40 | static GetPlayerSpeed(playerid) 41 | { 42 | new Float:ST[4]; 43 | if(IsPlayerInAnyVehicle(playerid)) 44 | GetVehicleVelocity(GetPlayerVehicleID(playerid), ST[0], ST[1], ST[2]); 45 | else GetPlayerVelocity(playerid, ST[0], ST[1], ST[2]); 46 | ST[3] = floatsqroot(floatpower(floatabs(ST[0]), 2.0) + floatpower(floatabs(ST[1]), 2.0) + floatpower(floatabs(ST[2]), 2.0)) * 179.28625; 47 | return floatround(ST[3]); 48 | } 49 | 50 | forward CheckSpeedCheats(playerid); 51 | forward ResetSpamCall(playerid); 52 | forward ResetSpeedWarnings(playerid); 53 | forward ResetFallTeleport(playerid); 54 | 55 | #if defined ASC_OnPlayerDisconnect 56 | forward ASC_OnPlayerDisconnect(playerid, reason); 57 | #endif 58 | 59 | #if defined ASC_OnPlayerConnect 60 | forward ASC_OnPlayerConnect(playerid); 61 | #endif 62 | 63 | #if defined OnPlayerSpeedCheat 64 | forward OnPlayerSpeedCheat(playerid, speedtype); 65 | #endif 66 | 67 | static bool:s_callSpam[MAX_PLAYERS char], 68 | s_playerFalling[MAX_PLAYERS char], 69 | s_speedWarnings[MAX_PLAYERS char], 70 | 71 | Float:s_playerZ[MAX_PLAYERS], 72 | s_speedChecker[MAX_PLAYERS], 73 | s_resetTimer[MAX_PLAYERS]; 74 | 75 | 76 | public OnPlayerDisconnect(playerid, reason) 77 | { 78 | s_callSpam{playerid} = false; 79 | s_playerFalling{playerid} = 0; 80 | s_speedWarnings{playerid} = 0; 81 | s_playerZ[playerid] = 0.0; 82 | 83 | KillTimer(s_speedChecker[playerid]); 84 | KillTimer(s_resetTimer[playerid]); 85 | 86 | #if defined ASC_OnPlayerDisconnect 87 | return ASC_OnPlayerDisconnect(playerid, reason); 88 | #else 89 | return 1; 90 | #endif 91 | } 92 | 93 | public OnPlayerConnect(playerid) 94 | { 95 | s_speedChecker[playerid] = SetTimerEx("CheckSpeedCheats", 1000, true, "i", playerid); 96 | 97 | #if defined ASC_OnPlayerConnect 98 | return ASC_OnPlayerConnect(playerid); 99 | #else 100 | return 1; 101 | #endif 102 | } 103 | 104 | public ResetSpeedWarnings(playerid) return s_speedWarnings{playerid} = 0; 105 | public ResetSpamCall(playerid) return s_callSpam{playerid} = false; 106 | public ResetFallTeleport(playerid) return s_playerFalling{playerid} = 0; 107 | public CheckSpeedCheats(playerid) 108 | { 109 | new Float:AscX, Float:AscY, Float:AscZ; 110 | if(s_callSpam{playerid}) return 0; 111 | GetPlayerPos(playerid, AscX, AscY, AscZ); 112 | 113 | if(AscZ < 0.0 || s_playerZ[playerid] < 0.0 ) return 0; 114 | if(s_playerZ[playerid] - AscZ > 3 && s_playerFalling{playerid} == 0) 115 | { 116 | s_playerFalling{playerid} = 1; 117 | } 118 | else if(s_playerFalling{playerid} == 1 && s_playerZ[playerid] - AscZ < 3) 119 | { 120 | s_playerFalling{playerid} = 2; 121 | SetTimerEx("ResetFallTeleport", 3000, false, "i", playerid); 122 | } 123 | 124 | if(s_playerFalling{playerid} == 0) 125 | { 126 | switch(GetPlayerState(playerid)) 127 | { 128 | case 1: 129 | { 130 | if(GetPlayerSpeed(playerid) >= ASC_MAX_FOOT_SPEED && GetPlayerSurfingVehicleID(playerid) == INVALID_VEHICLE_ID) 131 | { 132 | s_callSpam{playerid} = true; 133 | SetTimerEx("ResetSpamCall", 1000, false, "i", playerid); 134 | if(s_speedWarnings{playerid} == 0) s_resetTimer[playerid] = SetTimerEx("ResetSpeedWarnings", 50*1000, false, "i", playerid); 135 | if(s_speedWarnings{playerid} < ASC_MAX_SPEED_WARNS) s_speedWarnings{playerid}++; 136 | if(s_speedWarnings{playerid} == ASC_MAX_SPEED_WARNS) CallLocalFunction("OnPlayerSpeedCheat", "ii", playerid, 0); 137 | } 138 | } 139 | case 2: 140 | { 141 | switch(IsModelAPlane(GetPlayerVehicleID(playerid))) 142 | { 143 | case 0: 144 | { 145 | if(GetPlayerSpeed(playerid) >= ASC_MAX_CAR_SPEED) 146 | { 147 | s_callSpam{playerid} = true; 148 | SetTimerEx("ResetSpamCall", 2000, false, "i", playerid); 149 | if(s_speedWarnings{playerid} == 0) s_resetTimer[playerid] = SetTimerEx("ResetSpeedWarnings", 50*1000, false, "i", playerid); 150 | if(s_speedWarnings{playerid} < ASC_MAX_SPEED_WARNS) s_speedWarnings{playerid}++; 151 | if(s_speedWarnings{playerid} == ASC_MAX_SPEED_WARNS) s_speedWarnings{playerid} = 0, CallLocalFunction("OnPlayerSpeedCheat", "ii", playerid, 1); 152 | } 153 | } 154 | case 1: 155 | { 156 | if(GetPlayerSpeed(playerid) >= ASC_MAX_PLANE_SPEED) 157 | { 158 | s_callSpam{playerid} = true; 159 | SetTimerEx("ResetSpamCall", 2000, false, "i", playerid); 160 | if(s_speedWarnings{playerid} == 0) s_resetTimer[playerid] = SetTimerEx("ResetSpeedWarnings", 50*1000, false, "i", playerid); 161 | if(s_speedWarnings{playerid} < ASC_MAX_SPEED_WARNS) s_speedWarnings{playerid}++; 162 | if(s_speedWarnings{playerid} == ASC_MAX_SPEED_WARNS) s_speedWarnings{playerid} = 0, CallLocalFunction("OnPlayerSpeedCheat", "ii", playerid, 2); 163 | } 164 | } 165 | } 166 | } 167 | } 168 | } 169 | 170 | s_playerZ[playerid] = AscZ; 171 | return 1; 172 | } 173 | 174 | #if defined _ALS_OnPlayerConnect 175 | #undef OnPlayerConnect 176 | #else 177 | #define _ALS_OnPlayerConnect 178 | #endif 179 | 180 | #define OnPlayerConnect ASC_OnPlayerConnect 181 | 182 | #if defined _ALS_OnPlayerDisconnect 183 | #undef OnPlayerDisconnect 184 | #else 185 | #define _ALS_OnPlayerDisconnect 186 | #endif 187 | 188 | #define OnPlayerDisconnect ASC_OnPlayerDisconnect 189 | 190 | #endif 191 | -------------------------------------------------------------------------------- /Anti-Cheat/MoneyCheats.inc: -------------------------------------------------------------------------------- 1 | /* 2 | Advanced anti cash cheat by RogueDrifter 2018/2/9 -=-==Last updated on Apr 18th 3 | USAGE: Include in all scripts and use the following: 4 | -=-=-=-=-=-=-=-=-=-= 5 | Callback: 6 | -=-=-=-=-= 7 | OnPlayerCashCheat(playerid, oldcash, newcash, amount); 8 | -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 9 | playerid = the player who used cheats to spoof cash. 10 | oldcash = the original cash he had before using cheats. 11 | newcash = the current amount of cash after he used cheats. 12 | amount = the amount of cash he used cheats to spoof. 13 | -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 14 | */ 15 | 16 | #if defined _rAntiCashCheat_ 17 | #endinput 18 | #endif 19 | 20 | #define _rAntiCashCheat_ 21 | 22 | #include 23 | 24 | #if !defined FILTERSCRIPT 25 | 26 | enum E_AMC_INFO 27 | { 28 | bool:cashImmunity, 29 | 30 | detectingTimer, 31 | 32 | pausedTicks, 33 | actualCash 34 | 35 | }; 36 | 37 | static 38 | playerData[MAX_PLAYERS][E_AMC_INFO]; 39 | 40 | #if defined Amc_OnPlayerDisconnect 41 | forward Amc_OnPlayerDisconnect(playerid, reason); 42 | #endif 43 | 44 | #if defined Amc_OnPlayerConnect 45 | forward Amc_OnPlayerConnect(playerid); 46 | #endif 47 | 48 | #if defined Amc_OnPlayerUpdate 49 | forward Amc_OnPlayerUpdate(playerid); 50 | #endif 51 | 52 | forward Amc_GivePlayerMoney(playerid, amount); 53 | forward Amc_ResetPlayerMoney(playerid); 54 | forward Amc_GetPlayerMoney(playerid); 55 | 56 | forward ResetImmunity(playerid); 57 | forward CheckActualCash(playerid); 58 | 59 | static bool:IsPlayerPaused(playerid) 60 | return (gettime() > (playerData[playerid][pausedTicks]+2)); 61 | 62 | public ResetImmunity(playerid) 63 | return playerData[playerid][cashImmunity]= false; 64 | 65 | public Amc_GetPlayerMoney(playerid) 66 | { 67 | if(playerid <0 || playerid > MAX_PLAYERS) return 0; 68 | return playerData[playerid][actualCash]; 69 | } 70 | 71 | public CheckActualCash(playerid) 72 | { 73 | if(IsPlayerPaused(playerid)) return 0; 74 | 75 | new rAmcTempCash; 76 | rAmcTempCash = GetPlayerMoney(playerid); 77 | 78 | if(playerData[playerid][actualCash] < rAmcTempCash && !playerData[playerid][cashImmunity]) 79 | { 80 | new rAmcSumUp; 81 | rAmcSumUp = rAmcTempCash - playerData[playerid][actualCash]; 82 | if(rAmcSumUp <= 1000) return GivePlayerMoney(playerid, - rAmcSumUp); 83 | 84 | #if defined OnPlayerCashCheat 85 | OnPlayerCashCheat(playerid, playerData[playerid][actualCash], rAmcTempCash, rAmcSumUp); 86 | #endif 87 | 88 | GivePlayerMoney(playerid, - rAmcSumUp); 89 | } 90 | return 1; 91 | } 92 | 93 | public Amc_ResetPlayerMoney(playerid) 94 | { 95 | if(playerid <0 || playerid > MAX_PLAYERS) return 0; 96 | if(!playerData[playerid][cashImmunity]) SetTimerEx("ResetImmunity", 3000, false, "i", playerid); 97 | playerData[playerid][cashImmunity]= true; 98 | 99 | playerData[playerid][actualCash] = 0; 100 | return ResetPlayerMoney(playerid); 101 | } 102 | 103 | public Amc_GivePlayerMoney(playerid, amount) 104 | { 105 | if(playerid <0 || playerid > MAX_PLAYERS) return 0; 106 | if(!playerData[playerid][cashImmunity]) SetTimerEx("ResetImmunity", 3000, false, "i", playerid); 107 | playerData[playerid][cashImmunity]= true; 108 | 109 | playerData[playerid][actualCash] += amount; 110 | return GivePlayerMoney(playerid, amount); 111 | } 112 | 113 | public OnPlayerDisconnect(playerid, reason) 114 | { 115 | playerData[playerid][cashImmunity]= false; 116 | KillTimer(playerData[playerid][detectingTimer]); 117 | 118 | #if defined Amc_OnPlayerDisconnect 119 | return Amc_OnPlayerDisconnect(playerid, reason); 120 | #else 121 | return 1; 122 | #endif 123 | } 124 | 125 | public OnPlayerUpdate(playerid) 126 | { 127 | playerData[playerid][pausedTicks] = gettime(); 128 | 129 | #if defined Amc_OnPlayerUpdate 130 | return Amc_OnPlayerUpdate(playerid); 131 | #else 132 | return 1; 133 | #endif 134 | } 135 | 136 | public OnPlayerConnect(playerid) 137 | { 138 | Amc_ResetPlayerMoney(playerid); 139 | playerData[playerid][detectingTimer] = SetTimerEx("CheckActualCash", 15000, true, "i", playerid); 140 | 141 | #if defined Amc_OnPlayerConnect 142 | return Amc_OnPlayerConnect(playerid); 143 | #else 144 | return 1; 145 | #endif 146 | } 147 | 148 | #if defined OnPlayerCashCheat 149 | forward OnPlayerCashCheat(playerid, oldcash, newcash, amount); 150 | #endif 151 | 152 | #if defined _ALS_OnPlayerDisconnect 153 | #undef OnPlayerDisconnect 154 | #else 155 | #define _ALS_OnPlayerDisconnect 156 | #endif 157 | 158 | #define OnPlayerDisconnect Amc_OnPlayerDisconnect 159 | 160 | #if defined _ALS_OnPlayerUpdate 161 | #undef OnPlayerUpdate 162 | #else 163 | #define _ALS_OnPlayerUpdate 164 | #endif 165 | 166 | #define OnPlayerUpdate Amc_OnPlayerUpdate 167 | 168 | #if defined _ALS_OnPlayerConnect 169 | #undef OnPlayerConnect 170 | #else 171 | #define _ALS_OnPlayerConnect 172 | #endif 173 | 174 | #define OnPlayerConnect Amc_OnPlayerConnect 175 | 176 | #if defined _ALS_GivePlayerMoney 177 | #undef GivePlayerMoney 178 | #else 179 | #define _ALS_GivePlayerMoney 180 | #endif 181 | 182 | #define GivePlayerMoney Amc_GivePlayerMoney 183 | 184 | #if defined _ALS_ResetPlayerMoney 185 | #undef ResetPlayerMoney 186 | #else 187 | #define _ALS_ResetPlayerMoney 188 | #endif 189 | 190 | #define ResetPlayerMoney Amc_ResetPlayerMoney 191 | 192 | #if defined _ALS_GetPlayerMoney 193 | #undef GetPlayerMoney 194 | #else 195 | #define _ALS_GetPlayerMoney 196 | #endif 197 | 198 | #define GetPlayerMoney Amc_GetPlayerMoney 199 | 200 | #else 201 | 202 | stock Amc_FGetPlayerMoney(playerid) 203 | return CallRemoteFunction("Amc_GetPlayerMoney","i",playerid); 204 | 205 | stock Amc_FGivePlayerMoney(playerid, money) 206 | return CallRemoteFunction("Amc_GivePlayerMoney","ii",playerid, money); 207 | 208 | stock Amc_FResetPlayerMoney(playerid) 209 | return CallRemoteFunction("Amc_ResetPlayerMoney","i",playerid); 210 | 211 | #if defined _ALS_GivePlayerMoney 212 | #undef GivePlayerMoney 213 | #else 214 | #define _ALS_GivePlayerMoney 215 | #endif 216 | 217 | #define GivePlayerMoney Amc_FGivePlayerMoney 218 | 219 | #if defined _ALS_ResetPlayerMoney 220 | #undef ResetPlayerMoney 221 | #else 222 | #define _ALS_ResetPlayerMoney 223 | #endif 224 | 225 | #define ResetPlayerMoney Amc_FResetPlayerMoney 226 | 227 | #if defined _ALS_GetPlayerMoney 228 | #undef GetPlayerMoney 229 | #else 230 | #define _ALS_GetPlayerMoney 231 | #endif 232 | 233 | #define GetPlayerMoney Amc_FGetPlayerMoney 234 | 235 | #endif 236 | -------------------------------------------------------------------------------- /Anti-Cheat/GodMode.inc: -------------------------------------------------------------------------------- 1 | /* Anti godmode by RogueDrifter created August 30th 2 | 3 | Callback: 4 | OnPlayerGodmode(playerid, gmtype); 5 | 6 | gmtype 0 = on foot 7 | gmtype 1 = in car (not added yet). 8 | 9 | -Cases excluded: 10 | 1- Frozen 11 | 2- Paused 12 | 3- Kill shot 13 | 4- Npcs 14 | 5- Player state 15 | 16 | This only detects godmode cheats that disable the damage callbacks completely. Yes, it is very limited. 17 | I do plan to expand this one day. 18 | */ 19 | 20 | #include 21 | 22 | #if defined _rAGM_Included 23 | #endinput 24 | #endif 25 | 26 | #define _rAGM_Included 27 | 28 | #if !defined FILTERSCRIPT 29 | 30 | #define RAGM_MAX_SHOT_TICKS 0 31 | 32 | forward rAGM_TogglePlayerControllable(playerid, bool:toggle); 33 | 34 | forward CheckFinalResult(hitid); 35 | forward ResetWarningTicks(playerid); 36 | 37 | enum E_GODMODE_PLAYER_INFO 38 | { 39 | bool:isPlayerFrozen, 40 | 41 | delayTimerOne, 42 | delayTimerTwo, 43 | 44 | finalWarnings, 45 | damageWarnings, 46 | pausedTicks 47 | }; 48 | 49 | static 50 | playerData[MAX_PLAYERS][E_GODMODE_PLAYER_INFO]; 51 | 52 | #if defined rAGM_OnPlayerUpdate 53 | forward rAGM_OnPlayerUpdate(playerid); 54 | #endif 55 | 56 | #if defined rAGM_OnPlayerWeaponShot 57 | forward rAGM_OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ); 58 | #endif 59 | 60 | #if defined rAGM_OnPlayerTakeDamage 61 | forward rAGM_OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid, bodypart); 62 | #endif 63 | 64 | #if defined rAGM_OnPlayerConnect 65 | forward rAGM_OnPlayerConnect(playerid); 66 | #endif 67 | 68 | #if defined rAGM_OnPlayerSpawn 69 | forward rAGM_OnPlayerSpawn(playerid); 70 | #endif 71 | 72 | #if defined rAGM_OnPlayerDeath 73 | forward rAGM_OnPlayerDeath(playerid, killerid, reason); 74 | #endif 75 | 76 | #if defined OnPlayerGodmode 77 | forward OnPlayerGodmode(playerid, gmtype); 78 | #endif 79 | 80 | static bool:IsWeaponAmmoable(weaponid) 81 | { 82 | return (22 <= weaponid <= 33); 83 | } 84 | 85 | static bool:IsPlayerPaused(playerid) 86 | { 87 | return (gettime() > (playerData[playerid][pausedTicks]+2)); 88 | } 89 | 90 | public OnPlayerUpdate(playerid) 91 | { 92 | playerData[playerid][pausedTicks] = gettime(); 93 | 94 | #if defined rAGM_OnPlayerUpdate 95 | return rAGM_OnPlayerUpdate(playerid); 96 | #else 97 | return 1; 98 | #endif 99 | } 100 | 101 | public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ) 102 | { 103 | if(hittype == BULLET_HIT_TYPE_PLAYER) 104 | { 105 | if(IsWeaponAmmoable(weaponid) && GetPlayerState(playerid) == PLAYER_STATE_ONFOOT && GetPlayerState(hitid) == PLAYER_STATE_ONFOOT) 106 | { 107 | if(!IsPlayerPaused(hitid) && !IsPlayerPaused(playerid) && !IsPlayerNPC(hitid) && !playerData[hitid][isPlayerFrozen]) 108 | { 109 | #if defined _FLaggersIncluded_ 110 | if(!IsPlayerDesynced(hitid)) 111 | { 112 | KillTimer(playerData[hitid][delayTimerOne]); 113 | if(IsPlayerLagging(hitid)) 114 | playerData[hitid][delayTimerOne] = SetTimerEx("CheckFinalResult", 500, false, "i", hitid); 115 | else 116 | playerData[hitid][delayTimerOne] = SetTimerEx("CheckFinalResult", 950, false, "i", hitid); 117 | } 118 | #else 119 | KillTimer(playerData[hitid][delayTimerOne]); 120 | playerData[hitid][delayTimerOne] = SetTimerEx("CheckFinalResult", 950, false, "i", hitid); 121 | #endif 122 | } 123 | } 124 | } 125 | #if defined rAGM_OnPlayerWeaponShot 126 | return rAGM_OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ); 127 | #else 128 | return 1; 129 | #endif 130 | } 131 | 132 | public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid, bodypart) 133 | { 134 | if(issuerid != INVALID_PLAYER_ID && IsPlayerConnected(issuerid) && IsWeaponAmmoable(weaponid)) 135 | { 136 | KillTimer(playerData[playerid][delayTimerTwo]); 137 | playerData[playerid][finalWarnings] = 0; 138 | playerData[playerid][damageWarnings] = gettime(); 139 | } 140 | #if defined rAGM_OnPlayerTakeDamage 141 | return rAGM_OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid, bodypart); 142 | #else 143 | return 1; 144 | #endif 145 | } 146 | 147 | public OnPlayerSpawn(playerid) 148 | { 149 | playerData[playerid][isPlayerFrozen] = false; 150 | 151 | #if defined rAGM_OnPlayerSpawn 152 | return rAGM_OnPlayerSpawn(playerid); 153 | #else 154 | return 1; 155 | #endif 156 | } 157 | 158 | public OnPlayerConnect(playerid) 159 | { 160 | playerData[playerid][isPlayerFrozen] = false; 161 | playerData[playerid][finalWarnings] = 0; 162 | 163 | #if defined rAGM_OnPlayerConnect 164 | return rAGM_OnPlayerConnect(playerid); 165 | #else 166 | return 1; 167 | #endif 168 | } 169 | 170 | public OnPlayerDeath(playerid, killerid, reason) 171 | { 172 | KillTimer(playerData[playerid][delayTimerTwo]); 173 | playerData[playerid][finalWarnings] = 0; 174 | playerData[playerid][isPlayerFrozen] = true; 175 | 176 | #if defined rAGM_OnPlayerDeath 177 | return rAGM_OnPlayerDeath(playerid, killerid, reason); 178 | #else 179 | return 1; 180 | #endif 181 | } 182 | 183 | public rAGM_TogglePlayerControllable(playerid, bool:toggle) 184 | { 185 | playerData[playerid][isPlayerFrozen] = toggle; 186 | return TogglePlayerControllable(playerid, toggle); 187 | } 188 | 189 | public CheckFinalResult(hitid) 190 | { 191 | if(!IsPlayerConnected(hitid)) return 0; 192 | if(gettime() > (playerData[hitid][damageWarnings]+ 2)) 193 | { 194 | if(playerData[hitid][finalWarnings] <= RAGM_MAX_SHOT_TICKS) 195 | { 196 | KillTimer(playerData[hitid][delayTimerTwo]); 197 | playerData[hitid][delayTimerTwo] = SetTimerEx("ResetWarningTicks", 60*1000, false, "i", hitid); 198 | playerData[hitid][finalWarnings]++; 199 | } 200 | else 201 | { 202 | KillTimer(playerData[hitid][delayTimerTwo]); 203 | playerData[hitid][finalWarnings] = 0; 204 | #if defined OnPlayerGodmode 205 | OnPlayerGodmode(hitid, 0); 206 | #endif 207 | } 208 | } 209 | return 1; 210 | } 211 | 212 | public ResetWarningTicks(playerid) 213 | return playerData[playerid][finalWarnings] = 0; 214 | 215 | #if defined _ALS_OnPlayerWeaponShot 216 | #undef OnPlayerWeaponShot 217 | #else 218 | #define _ALS_OnPlayerWeaponShot 219 | #endif 220 | 221 | #define OnPlayerWeaponShot rAGM_OnPlayerWeaponShot 222 | 223 | #if defined _ALS_OnPlayerDeath 224 | #undef OnPlayerDeath 225 | #else 226 | #define _ALS_OnPlayerDeath 227 | #endif 228 | 229 | #define OnPlayerDeath rAGM_OnPlayerDeath 230 | 231 | #if defined _ALS_OnPlayerTakeDamage 232 | #undef OnPlayerTakeDamage 233 | #else 234 | #define _ALS_OnPlayerTakeDamage 235 | #endif 236 | 237 | #define OnPlayerTakeDamage rAGM_OnPlayerTakeDamage 238 | 239 | #if defined _ALS_OnPlayerUpdate 240 | #undef OnPlayerUpdate 241 | #else 242 | #define _ALS_OnPlayerUpdate 243 | #endif 244 | 245 | #define OnPlayerUpdate rAGM_OnPlayerUpdate 246 | 247 | #if defined _ALS_OnPlayerConnect 248 | #undef OnPlayerConnect 249 | #else 250 | #define _ALS_OnPlayerConnect 251 | #endif 252 | 253 | #define OnPlayerConnect rAGM_OnPlayerConnect 254 | 255 | #if defined _ALS_OnPlayerSpawn 256 | #undef OnPlayerSpawn 257 | #else 258 | #define _ALS_OnPlayerSpawn 259 | #endif 260 | 261 | #define OnPlayerSpawn rAGM_OnPlayerSpawn 262 | 263 | #if defined _ALS_TogglePlayerControllable 264 | #undef TogglePlayerControllable 265 | #else 266 | #define _ALS_TogglePlayerControllable 267 | #endif 268 | 269 | #define TogglePlayerControllable rAGM_TogglePlayerControllable 270 | 271 | #else 272 | 273 | stock rAGMF_TogglePlayerControllable(playerid, bool:toggle) 274 | return CallRemoteFunction("rAGM_TogglePlayerControllable", "ii", playerid, toggle); 275 | 276 | #if defined _ALS_TogglePlayerControllable 277 | #undef TogglePlayerControllable 278 | #else 279 | #define _ALS_TogglePlayerControllable 280 | #endif 281 | 282 | #define TogglePlayerControllable rAGMF_TogglePlayerControllable 283 | 284 | #endif 285 | 286 | -------------------------------------------------------------------------------- /Anti-Cheat/VehicleAbuse.inc: -------------------------------------------------------------------------------- 1 | /*Anti car swing, particle spam and fixes breached boundaries. 2 | Updated: June 27th. 3 | -=-==-=-=-=-== 4 | Originally made by Lorenc_ (Extracted/Reposted & edited by Rogue) 5 | -=-=-=-= 6 | Callbacks: 7 | ---------- 8 | OnPlayerCarSwing(playerid, vehicleid); 9 | OnPlayerParticleSpam(playerid, vehicleid); 10 | -=-=-=-=-=-=-=-=-=- 11 | */ 12 | 13 | #if defined r_EAC_Included 14 | #endinput 15 | #endif 16 | 17 | #define r_EAC_Included 18 | 19 | #include 20 | 21 | #if !defined FILTERSCRIPT 22 | 23 | enum E_VEHICLESPAM_DATA 24 | { 25 | bool:vehicleSpeed, 26 | 27 | timeTicks, 28 | spamTicks, 29 | 30 | Float:playerX, 31 | Float:playerY, 32 | Float:playerZ, 33 | 34 | checkTimer 35 | } 36 | 37 | static 38 | playerData[MAX_PLAYERS][E_VEHICLESPAM_DATA]; 39 | 40 | static GetTickDiff_AC(newtick, oldtick) 41 | { 42 | if (oldtick > newtick) { 43 | return (cellmax - oldtick + 1) - (cellmin - newtick); 44 | } 45 | return newtick - oldtick; 46 | } 47 | 48 | #if defined EAC_OnVehicleDamageStatusUpd 49 | forward EAC_OnVehicleDamageStatusUpd(vehicleid, playerid); 50 | #endif 51 | 52 | #if defined EAC_OnPlayerDisconnect 53 | forward EAC_OnPlayerDisconnect(playerid, reason); 54 | #endif 55 | 56 | #if defined EAC_OnPlayerUpdate 57 | forward EAC_OnPlayerUpdate(playerid); 58 | #endif 59 | 60 | #if defined OnPlayerParticleSpam 61 | forward OnPlayerParticleSpam(playerid, vehicleid); 62 | #endif 63 | 64 | #if defined OnPlayerCarSwing 65 | forward OnPlayerCarSwing(playerid, vehicleid); 66 | #endif 67 | 68 | forward EAC_RepairVehicle(vehicleid); 69 | forward EAC_SetVehicleVelocity(vehicleid, Float:X, Float:Y, Float:Z); 70 | 71 | forward ResetCarSpeed(playerid); 72 | public ResetCarSpeed(playerid) return playerData[playerid][vehicleSpeed] = false; 73 | 74 | public EAC_RepairVehicle(vehicleid) 75 | { 76 | if(vehicleid <0 || vehicleid > MAX_VEHICLES) return 0; 77 | #if !defined foreach 78 | for(new i, j = GetPlayerPoolSize(); i <= j; i++) 79 | { 80 | if(!IsPlayerConnected(i)) continue; 81 | if(GetPlayerVehicleID(i) == vehicleid) 82 | { 83 | playerData[i][timeTicks] = 0; 84 | playerData[i][spamTicks] = 0; 85 | } 86 | } 87 | #else 88 | foreach(new i: Player) 89 | { 90 | if(GetPlayerVehicleID(i) == vehicleid) 91 | { 92 | playerData[i][timeTicks] = 0; 93 | playerData[i][spamTicks] = 0; 94 | } 95 | } 96 | #endif 97 | return RepairVehicle(vehicleid); 98 | } 99 | 100 | public EAC_SetVehicleVelocity(vehicleid, Float:X, Float:Y, Float:Z) 101 | { 102 | if(vehicleid <0 || vehicleid > MAX_VEHICLES) return 0; 103 | #if !defined foreach 104 | for(new i, j = GetPlayerPoolSize(); i <= j; i++) 105 | { 106 | if(!IsPlayerConnected(i)) continue; 107 | if(GetPlayerVehicleID(i) == vehicleid) 108 | { 109 | KillTimer(playerData[i][checkTimer]); 110 | playerData[i][checkTimer] = SetTimerEx("ResetCarSpeed", 2000, false, "i", i); 111 | playerData[i][vehicleSpeed] = true; 112 | } 113 | } 114 | #else 115 | foreach(new i: Player) 116 | { 117 | if(GetPlayerVehicleID(i) == vehicleid) 118 | { 119 | KillTimer(playerData[i][checkTimer]); 120 | playerData[i][checkTimer] = SetTimerEx("ResetCarSpeed", 2000, false, "i", i); 121 | playerData[i][vehicleSpeed] = true; 122 | } 123 | } 124 | #endif 125 | return SetVehicleVelocity(vehicleid, X, Y, Z); 126 | } 127 | 128 | public OnPlayerDisconnect(playerid, reason) 129 | { 130 | playerData[playerid][spamTicks] = 0; 131 | playerData[playerid][timeTicks] = 0; 132 | playerData[playerid][vehicleSpeed] = false; 133 | #if defined EAC_OnPlayerDisconnect 134 | return EAC_OnPlayerDisconnect(playerid, reason); 135 | #else 136 | return 1; 137 | #endif 138 | } 139 | 140 | public OnVehicleDamageStatusUpdate(vehicleid, playerid) 141 | { 142 | new carTires, carLights; 143 | GetVehicleDamageStatus(vehicleid, carLights, carTires, carLights, carTires ); 144 | if(GetPlayerState(playerid) == 2) 145 | { 146 | if(carLights || carTires) return 1; 147 | new tickTimes; 148 | tickTimes = GetTickCount(); 149 | 150 | if(GetTickDiff_AC(tickTimes, playerData[playerid][timeTicks]) >= 0 && GetTickDiff_AC(tickTimes, playerData[playerid][timeTicks]) <= 500 ) 151 | { 152 | playerData[playerid][spamTicks] ++; 153 | if(playerData[playerid][spamTicks] >= 10) 154 | { 155 | playerData[playerid][spamTicks] = 0; 156 | #if defined OnPlayerParticleSpam 157 | OnPlayerParticleSpam(playerid, vehicleid); 158 | #endif 159 | SetPlayerHealth(playerid, 0.0); 160 | EAC_RepairVehicle(vehicleid); 161 | SetVehicleHealth(vehicleid, 999.000); 162 | return 1; 163 | } 164 | } 165 | else playerData[playerid][spamTicks] = 0; 166 | playerData[playerid][timeTicks] = tickTimes; 167 | } 168 | #if defined EAC_OnVehicleDamageStatusUpd 169 | return EAC_OnVehicleDamageStatusUpd(vehicleid, playerid); 170 | #else 171 | return 1; 172 | #endif 173 | } 174 | 175 | public OnPlayerUpdate(playerid) 176 | { 177 | new Float:fposX, Float:fposY, Float:fposZ, 178 | Float:fposVX, Float:fposVY, Float:fposVZ, playerCar; 179 | 180 | GetPlayerPos(playerid, fposX, fposY, fposZ); 181 | if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER && playerCar != GetPlayerVehicleID(playerid)) 182 | playerCar = GetPlayerVehicleID(playerid); 183 | 184 | if(fposX >= 99999.0 || fposY >= 99999.0 || fposZ >= 99999.0 || fposX <= -99999.0 || fposY <= -99999.0 || fposZ <= -99999.0) 185 | { 186 | if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER) SetVehicleToRespawn(playerCar); 187 | SendClientMessage(playerid, 0xa9c4e4ff, "Warning: Excessive X, Y, Z has been breached thus old location set."); 188 | SetPlayerPos(playerid, playerData[playerid][playerX], playerData[playerid][playerY], playerData[playerid][playerZ]); 189 | } 190 | else GetPlayerPos(playerid, playerData[playerid][playerX], playerData[playerid][playerY], playerData[playerid][playerZ]); 191 | 192 | if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER) 193 | { 194 | GetVehicleVelocity(playerCar, fposVX, fposVY, fposVZ); 195 | if(( fposVX > 3.0 || fposVY > 3.0 || fposVZ > 3.0 || fposVX < -3.0 || fposVY < -3.0 || fposVZ < -3.0 ) 196 | && ( fposVX != fposX && fposVY != fposY && fposVZ != fposZ ) && !playerData[playerid][vehicleSpeed]) 197 | { 198 | #if defined OnPlayerCarSwing 199 | OnPlayerCarSwing(playerid, playerCar); 200 | #endif 201 | SetPlayerHealth(playerid, 0.0); 202 | SetVehicleToRespawn(playerCar); 203 | } 204 | } 205 | #if defined EAC_OnPlayerUpdate 206 | return EAC_OnPlayerUpdate(playerid); 207 | #else 208 | return 1; 209 | #endif 210 | } 211 | 212 | #if defined _ALS_OnPlayerDisconnect 213 | #undef OnPlayerDisconnect 214 | #else 215 | #define _ALS_OnPlayerDisconnect 216 | #endif 217 | 218 | #define OnPlayerDisconnect EAC_OnPlayerDisconnect 219 | 220 | #if defined _ALS_OnPlayerUpdate 221 | #undef OnPlayerUpdate 222 | #else 223 | #define _ALS_OnPlayerUpdate 224 | #endif 225 | 226 | #define OnPlayerUpdate EAC_OnPlayerUpdate 227 | 228 | #if defined _ALS_OnVehicleDamageStatusUpd 229 | #undef OnVehicleDamageStatusUpdate 230 | #else 231 | #define _ALS_OnVehicleDamageStatusUpd 232 | #endif 233 | 234 | #define OnVehicleDamageStatusUpdate EAC_OnVehicleDamageStatusUpd 235 | 236 | #if defined _ALS_SetVehicleVelocity 237 | #undef SetVehicleVelocity 238 | #else 239 | #define _ALS_SetVehicleVelocity 240 | #endif 241 | 242 | #define SetVehicleVelocity EAC_SetVehicleVelocity 243 | 244 | #if defined _ALS_RepairVehicle 245 | #undef RepairVehicle 246 | #else 247 | #define _ALS_RepairVehicle 248 | #endif 249 | 250 | #define RepairVehicle EAC_RepairVehicle 251 | #else //If it's a FILTERSCRIPT 252 | 253 | stock EAC_FRepairVehicle(vehicleid) 254 | return CallRemoteFunction("EAC_RepairVehicle", "i", vehicleid); 255 | 256 | stock EAC_FSetVehicleVelocity(vehicleid, Float:X, Float:Y, Float:Z) 257 | return CallRemoteFunction("EAC_SetVehicleVelocity", "ifff", vehicleid, X, Y, Z); 258 | 259 | #if defined _ALS_SetVehicleVelocity 260 | #undef SetVehicleVelocity 261 | #else 262 | #define _ALS_SetVehicleVelocity 263 | #endif 264 | 265 | #define SetVehicleVelocity EAC_FSetVehicleVelocity 266 | 267 | #if defined _ALS_RepairVehicle 268 | #undef RepairVehicle 269 | #else 270 | #define _ALS_RepairVehicle 271 | #endif 272 | 273 | #define RepairVehicle EAC_FRepairVehicle 274 | #endif 275 | -------------------------------------------------------------------------------- /Rogue-AC.inc: -------------------------------------------------------------------------------- 1 | 2 | #if !defined DISABLE_GUNCHEATS 3 | #include //Anti gun cheats -Rogue 4 | #endif 5 | 6 | #if !defined DISABLE_LAGGERSDETECT 7 | #include //Lag spike\desnyc detector- Rogue 8 | #endif 9 | 10 | #if !defined DISABLE_AIRBREAKTELEPORT 11 | #include //Anti airbreak\teleport - Rogue 12 | #endif 13 | 14 | #if !defined DISABLE_CARTROLL 15 | #include //Anti car trolls - Rogue 16 | #endif 17 | 18 | #if !defined DISABLE_JETPACK 19 | #include //Anti jetpack cheats- Rogue 20 | #endif 21 | 22 | #if !defined DISABLE_VEHICLEABUSE 23 | #include //Anti carswing\particlespam - Lorenc_ 24 | #endif 25 | 26 | #if !defined DISABLE_MONEYCHEATS 27 | #include //Anti money cheats- Rogue 28 | #endif 29 | 30 | #if !defined DISABLE_GODMODE 31 | #include //Anti godmode -Rogue 32 | #endif 33 | 34 | #if !defined DISABLE_BUGCHEATS 35 | #include //Depresses 5 abusing bugs triggered by cheats. -Rogue 36 | #endif 37 | 38 | #if !defined DISABLE_FAKEKILL 39 | #include //Anti fake kill -Rogue 40 | #endif 41 | 42 | #if !defined DISABLE_FAKECONNECT 43 | #include //Anti fake clients - Rogue 44 | #endif 45 | 46 | #if !defined DISABLE_SPEEDCHEATS 47 | #include //Anti speed cheats- Rogue 48 | #endif 49 | 50 | #if !defined DISABLE_VEHICLEMODS 51 | #include //Anti illegal car mods -Emmet_ 52 | #endif 53 | 54 | #if !defined DISABLE_CARSPAM 55 | #include //Anti car spam - Rogue 56 | #endif 57 | 58 | #if !defined DISABLE_EASYDIALOG 59 | #include //Anti dialog spoof/crash- Emmet_ (easyDialog) 60 | #endif 61 | 62 | #if !defined DISABLE_CHATSPAM 63 | #include //Anti chat spam- Rogue 64 | #endif 65 | 66 | #if !defined DISABLE_SLIDEBUG 67 | #include //Anti slide bug abuse- Rogue 68 | #endif 69 | 70 | #if defined _AC_SYSTEM_ 71 | #endinput 72 | #endif 73 | 74 | #define _AC_SYSTEM_ 75 | 76 | #define SEVERITY_CASE_ONE 0 //Warn then kick 77 | #define SEVERITY_CASE_TWO 1 //Kick 78 | #define SEVERITY_CASE_THREE 2 //Ban 79 | 80 | #define VIOLATION_CODE_BUGATTEMPT 0 81 | #define VIOLATION_CODE_LAGOUT 1 82 | #define VIOLATION_CODE_SLIDEBUG 2 83 | #define VIOLATION_CODE_INVALIDMODS 3 84 | #define VIOLATION_CODE_PARTICLESPAM 4 85 | #define VIOLATION_CODE_CARSWING 5 86 | #define VIOLATION_CODE_MONEYHACK 6 87 | #define VIOLATION_CODE_CARTROLL 7 88 | #define VIOLATION_CODE_CARSPAM 8 89 | #define VIOLATION_CODE_AIRBRAKE 9 90 | #define VIOLATION_CODE_SPEEDING 10 91 | #define VIOLATION_CODE_CHATSPAM 11 92 | #define VIOLATION_CODE_JETPACK 12 93 | #define VIOLATION_CODE_FAKECONNECT 13 94 | #define VIOLATION_CODE_FAKEKILL 14 95 | #define VIOLATION_CODE_GODMODE 15 96 | #define VIOLATION_CODE_WEPHACKS 16 97 | 98 | 99 | 100 | 101 | #if !defined OnPlayerViolate 102 | 103 | #if !defined AC_MESSAGE_COLOR 104 | #define AC_MESSAGE_COLOR -1 105 | #endif 106 | 107 | static s_playerWarnings[MAX_PLAYERS]; 108 | #define MAX_WARNS_AC 3 //Max warns before kick in severe case 1 109 | 110 | forward OnPlayerViolate(playerid, severity, violationCode, const violationName[]); 111 | public OnPlayerViolate(playerid, severity, violationCode, const violationName[]) 112 | { 113 | new acString[128], name[MAX_PLAYER_NAME]; 114 | GetPlayerName(playerid, name, sizeof name); 115 | 116 | switch(severity) 117 | { 118 | case SEVERITY_CASE_ONE: 119 | { 120 | if(s_playerWarnings[playerid] < MAX_WARNS_AC) s_playerWarnings[playerid]++; 121 | else 122 | { 123 | format(acString, sizeof acString, "Player %s was kicked after 3 warnings, reason: Code violation #%d", name, violationCode); 124 | Kick(playerid); 125 | SendClientMessageToAll(AC_MESSAGE_COLOR, acString); 126 | 127 | } 128 | } 129 | case SEVERITY_CASE_TWO: 130 | { 131 | format(acString, sizeof acString, "Player %s was kicked, reason: Code violation #%d", name, violationCode); 132 | Kick(playerid); 133 | SendClientMessageToAll(AC_MESSAGE_COLOR, acString); 134 | } 135 | case SEVERITY_CASE_THREE: 136 | { 137 | format(acString, sizeof acString, "Player %s was banned, reason: Code violation #%d", name, violationCode); 138 | BanEx(playerid, violationName); 139 | SendClientMessageToAll(AC_MESSAGE_COLOR, acString); 140 | } 141 | } 142 | return 1; 143 | } 144 | 145 | #if defined AC_OnPlayerDisconnect 146 | forward AC_OnPlayerDisconnect(playerid, reason); 147 | #endif 148 | 149 | public OnPlayerDisconnect(playerid, reason) 150 | { 151 | s_playerWarnings[playerid] = 0; 152 | 153 | #if defined AC_OnPlayerDisconnect 154 | return AC_OnPlayerDisconnect(playerid, reason); 155 | #else 156 | return 1; 157 | #endif 158 | } 159 | 160 | 161 | #if defined _ALS_OnPlayerDisconnect 162 | #undef OnPlayerDisconnect 163 | #else 164 | #define _ALS_OnPlayerDisconnect 165 | #endif 166 | 167 | #define OnPlayerDisconnect AC_OnPlayerDisconnect 168 | 169 | #endif 170 | 171 | #if !defined DISABLE_FAKEKILL 172 | 173 | #if !defined OnPlayerFakeKill 174 | 175 | public OnPlayerFakeKill(playerid, spoofedid, spoofedreason, faketype) 176 | { 177 | OnPlayerViolate(playerid, SEVERITY_CASE_TWO, VIOLATION_CODE_FAKEKILL, "Fake killing"); 178 | return 1; 179 | } 180 | #endif 181 | #endif 182 | 183 | #if !defined DISABLE_FAKECONNECT 184 | 185 | #if !defined OnPlayerFakeConnect 186 | 187 | public OnPlayerFakeConnect(playerid) 188 | { 189 | OnPlayerViolate(playerid, SEVERITY_CASE_TWO, VIOLATION_CODE_FAKECONNECT, "Fake connect"); 190 | return 1; 191 | } 192 | #endif 193 | #endif 194 | 195 | #if !defined DISABLE_JETPACK 196 | 197 | #if !defined OnPlayerJetpackCheat 198 | public OnPlayerJetpackCheat(playerid) 199 | { 200 | OnPlayerViolate(playerid, SEVERITY_CASE_THREE, VIOLATION_CODE_JETPACK, "Jetpack cheats"); 201 | return 1; 202 | } 203 | #endif 204 | #endif 205 | 206 | #if !defined DISABLE_GODMODE 207 | 208 | #if !defined OnPlayerGodmode 209 | public OnPlayerGodmode(playerid, gmtype) 210 | { 211 | OnPlayerViolate(playerid, SEVERITY_CASE_TWO, VIOLATION_CODE_GODMODE, "Godmode cheats"); 212 | return 1; 213 | } 214 | #endif 215 | #endif 216 | 217 | #if !defined DISABLE_CHATSPAM 218 | 219 | #if !defined OnPlayerSpamChat 220 | public OnPlayerSpamChat(playerid) 221 | { 222 | OnPlayerViolate(playerid, SEVERITY_CASE_ONE, VIOLATION_CODE_CHATSPAM, "Chat spamming"); 223 | return 1; 224 | } 225 | #endif 226 | #endif 227 | 228 | #if !defined DISABLE_GUNCHEATS 229 | 230 | #if !defined OnPlayerGunCheat 231 | public OnPlayerGunCheat(playerid, weaponid, ammo, hacktype) 232 | { 233 | OnPlayerViolate(playerid, SEVERITY_CASE_TWO, VIOLATION_CODE_WEPHACKS, "Weapon cheats"); 234 | return 1; 235 | } 236 | #endif 237 | #endif 238 | 239 | #if !defined DISABLE_SPEEDCHEATS 240 | 241 | #if !defined OnPlayerSpeedCheat 242 | public OnPlayerSpeedCheat(playerid, speedtype) 243 | { 244 | OnPlayerViolate(playerid, SEVERITY_CASE_TWO, VIOLATION_CODE_SPEEDING, "Speed cheats"); 245 | return 1; 246 | } 247 | #endif 248 | #endif 249 | 250 | #if !defined DISABLE_AIRBREAKTELEPORT 251 | 252 | #if !defined OnPlayerBreakAir 253 | public OnPlayerBreakAir(playerid, breaktype) 254 | { 255 | OnPlayerViolate(playerid, SEVERITY_CASE_TWO, VIOLATION_CODE_AIRBRAKE, "Airbrake"); 256 | return 1; 257 | } 258 | #endif 259 | #endif 260 | 261 | #if !defined DISABLE_CARSPAM 262 | 263 | #if !defined OnPlayerSpamCars 264 | public OnPlayerSpamCars(playerid, number) 265 | { 266 | OnPlayerViolate(playerid, SEVERITY_CASE_THREE, VIOLATION_CODE_CARSPAM, "Car spam"); 267 | return 1; 268 | } 269 | #endif 270 | #endif 271 | 272 | #if !defined DISABLE_CARTROLL 273 | 274 | #if !defined OnPlayerCarTroll 275 | public OnPlayerCarTroll(playerid, vehicleid, trolledid, trolltype) 276 | { 277 | OnPlayerViolate(playerid, SEVERITY_CASE_TWO, VIOLATION_CODE_CARTROLL, "Car troll"); 278 | return 1; 279 | } 280 | #endif 281 | #endif 282 | 283 | #if !defined DISABLE_MONEYCHEATS 284 | 285 | #if !defined OnPlayerCashCheat 286 | public OnPlayerCashCheat(playerid, oldcash, newcash, amount) 287 | { 288 | OnPlayerViolate(playerid, SEVERITY_CASE_TWO, VIOLATION_CODE_MONEYHACK, "Cash cheats"); 289 | return 1; 290 | } 291 | #endif 292 | #endif 293 | 294 | #if !defined DISABLE_VEHICLEABUSE 295 | 296 | #if !defined OnPlayerCarSwing 297 | public OnPlayerCarSwing(playerid, vehicleid) 298 | { 299 | OnPlayerViolate(playerid, SEVERITY_CASE_TWO, VIOLATION_CODE_CARSWING, "Car swing"); 300 | return 1; 301 | } 302 | #endif 303 | #if !defined OnPlayerParticleSpam 304 | public OnPlayerParticleSpam(playerid, vehicleid) 305 | { 306 | OnPlayerViolate(playerid, SEVERITY_CASE_THREE, VIOLATION_CODE_PARTICLESPAM, "Particle spamming"); 307 | return 1; 308 | } 309 | #endif 310 | #endif 311 | 312 | #if !defined DISABLE_VEHICLEMODS 313 | 314 | #if !defined OnVehicleModEx 315 | 316 | public OnVehicleModEx(playerid, vehicleid, componentid, illegal) 317 | { 318 | if(illegal) 319 | { 320 | OnPlayerViolate(playerid, SEVERITY_CASE_THREE, VIOLATION_CODE_INVALIDMODS, "Invalid mods"); 321 | } 322 | return 1; 323 | } 324 | #endif 325 | #endif 326 | 327 | #if !defined DISABLE_SLIDEBUG 328 | 329 | #if !defined OnPlayerSlide 330 | public OnPlayerSlide(playerid, weaponid, speed) 331 | { 332 | OnPlayerViolate(playerid, SEVERITY_CASE_ONE, VIOLATION_CODE_SLIDEBUG, "Slide bugging"); 333 | return 1; 334 | } 335 | #endif 336 | #endif 337 | 338 | #if !defined DISABLE_LAGGERSDETECT 339 | 340 | #if !defined OnPlayerLagout 341 | public OnPlayerLagout(playerid, lagtype, ping) 342 | { 343 | OnPlayerViolate(playerid, SEVERITY_CASE_ONE, VIOLATION_CODE_LAGOUT, "Huge lag"); 344 | return 1; 345 | } 346 | #endif 347 | #endif 348 | 349 | #if !defined DISABLE_BUGCHEATS 350 | 351 | #if !defined OnPlayerBugAttempt 352 | public OnPlayerBugAttempt(playerid, bugcode) 353 | { 354 | OnPlayerViolate(playerid, SEVERITY_CASE_TWO, VIOLATION_CODE_BUGATTEMPT, "Bug cheats"); 355 | return 1; 356 | } 357 | #endif 358 | #endif 359 | -------------------------------------------------------------------------------- /Anti-Cheat/FakeKill.inc: -------------------------------------------------------------------------------- 1 | /* 2 | Anti fake kill by Rogue 2018/3/25 3 | ---- 4 | Last Updated April 5th. 5 | -=-=-=-=-=-=- 6 | 7 | Callbacks: 8 | ---------- 9 | 10 | OnPlayerFakeKill(playerid, spoofedid, spoofedreason, faketype); 11 | ------------- 12 | playerid = the cheater who did a fake kill action 13 | spoofedid = the player alleged to have killed the cheater 14 | spoofedreason = the weapon used in the process (spoofed by the cheater) 15 | faketype 1 = normal fake kill (one time) - Detected when a player dies without getting hit or when killed by a vehicle from too far that isnt a plane 16 | faketype 2 = spammed fake kill (must kick or ban instantly) - Detected when a player dies before spawning or dies too many times in a row or uses a spoofed invalid parameter 17 | -=-=-=-=-=--=-=-= 18 | */ 19 | 20 | #if !defined FILTERSCRIPT 21 | 22 | #if defined _rAntiFakeKill_Included 23 | #endinput 24 | #endif 25 | 26 | #define _rAntiFakeKill_Included 27 | #define FKI_MAX_ERROR_WARNS 2 28 | 29 | #include 30 | 31 | forward FKI_SetPlayerHealth(playerid, Float:health); 32 | 33 | #if defined OnPlayerFakeKill 34 | forward OnPlayerFakeKill(playerid, spoofedid, spoofedreason, faketype); 35 | #endif 36 | 37 | #if defined FKI_OnPlayerDisconnect 38 | forward FKI_OnPlayerDisconnect(playerid, reason); 39 | #endif 40 | 41 | #if defined FKI_OnPlayerTakeDamage 42 | forward FKI_OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid, bodypart); 43 | #endif 44 | 45 | #if defined FKI_OnPlayerGiveDamage 46 | forward FKI_OnPlayerGiveDamage(playerid, damagedid, Float:amount, weaponid, bodypart); 47 | #endif 48 | 49 | #if defined FKI_OnPlayerWeaponShot 50 | forward FKI_OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ); 51 | #endif 52 | 53 | #if defined FKI_OnPlayerDeath 54 | forward FKI_OnPlayerDeath(playerid, killerid, reason); 55 | #endif 56 | 57 | #if defined FKI_OnPlayerSpawn 58 | forward FKI_OnPlayerSpawn(playerid); 59 | #endif 60 | 61 | enum E_ANTI_FAKE_KILL 62 | { 63 | bool:damageCheck, 64 | bool:spawnCheck, 65 | bool:justDied, 66 | bool:healthImmune, 67 | 68 | warningTicks, 69 | 70 | deathRefresher 71 | } 72 | 73 | static 74 | playerData[MAX_PLAYERS][E_ANTI_FAKE_KILL]; 75 | 76 | static bool:IsReasonValid(reason) 77 | return ( 0 <= reason <= 18 || 22 <= reason <= 46 ); 78 | 79 | static bool:IsReasonDifferentlyValid(reason) //Helicopter blades and Explosion 80 | { 81 | switch(reason) 82 | { 83 | case 50, 51: return true; 84 | } 85 | return false; 86 | } 87 | 88 | static bool:IsModelAPlane(vehicleid) 89 | { 90 | switch(GetVehicleModel(vehicleid)) 91 | { 92 | case 592, 577, 511, 512, 593, 520, 553, 476, 519, 460, 513, 464: return true; 93 | case 548, 425, 417, 487, 488, 497, 563, 447, 469, 465, 501: return true; 94 | } 95 | return false; 96 | } 97 | 98 | static bool:IsReasonIgnoreable(reason) 99 | { 100 | switch(reason) 101 | { 102 | case 54, 255, 53: return true; 103 | } 104 | return false; 105 | } 106 | 107 | forward FakeKillJustDied(playerid); 108 | public FakeKillJustDied(playerid) 109 | return playerData[playerid][justDied] = false; 110 | 111 | 112 | forward FakeKillImmunity(playerid); 113 | public FakeKillImmunity(playerid) 114 | return playerData[playerid][healthImmune] = false; 115 | 116 | public FKI_SetPlayerHealth(playerid, Float:health) 117 | { 118 | if(playerid > MAX_PLAYERS || playerid < 0) return 0; 119 | if(health == 0.0) 120 | { 121 | playerData[playerid][healthImmune] = true; 122 | SetTimerEx("FakeKillImmunity", 3000, false, "i", playerid); 123 | } 124 | return SetPlayerHealth(playerid, health); 125 | } 126 | 127 | public OnPlayerDisconnect(playerid, reason) 128 | { 129 | playerData[playerid][spawnCheck]= false; 130 | playerData[playerid][damageCheck] = false; 131 | playerData[playerid][healthImmune] = false; 132 | playerData[playerid][justDied] = false; 133 | 134 | playerData[playerid][warningTicks] = 0; 135 | #if defined FKI_OnPlayerDisconnect 136 | return FKI_OnPlayerDisconnect(playerid, reason); 137 | #else 138 | return 1; 139 | #endif 140 | } 141 | 142 | public OnPlayerDeath(playerid, killerid, reason) 143 | { 144 | if(!playerData[playerid][spawnCheck] || playerData[playerid][justDied]) 145 | { 146 | if(!playerData[playerid][healthImmune]) 147 | return CallLocalFunction("OnPlayerFakeKill", "iiii", playerid, killerid, reason, 2); 148 | } 149 | if(!playerData[playerid][damageCheck] && killerid != INVALID_PLAYER_ID && IsPlayerConnected(killerid)) 150 | { 151 | if(IsReasonIgnoreable(reason)) 152 | { 153 | if(IsPlayerConnected(killerid)) 154 | { 155 | if(!playerData[playerid][healthImmune]) 156 | return CallLocalFunction("OnPlayerFakeKill", "iiii", playerid, killerid, reason, 2); 157 | } 158 | #if defined FKI_OnPlayerDeath 159 | return FKI_OnPlayerDeath(playerid, killerid, reason); 160 | #else 161 | return 1; 162 | #endif 163 | } 164 | if(GetPlayerState(killerid) == PLAYER_STATE_DRIVER && !IsModelAPlane(GetPlayerVehicleID(playerid)) && reason == WEAPON_VEHICLE) 165 | { 166 | static Float:TPX, Float:TPY, Float:TPZ; 167 | GetPlayerPos(killerid, TPX, TPY, TPZ); 168 | if(!IsPlayerInRangeOfPoint(playerid, 5.0, TPX, TPY, TPZ)) 169 | { 170 | if(!playerData[playerid][healthImmune]) 171 | return CallLocalFunction("OnPlayerFakeKill", "iiii", playerid, killerid, reason, 1); 172 | } 173 | } 174 | if(IsReasonValid(reason)) 175 | { 176 | playerData[playerid][warningTicks]++; 177 | if(playerData[playerid][warningTicks] == FKI_MAX_ERROR_WARNS) 178 | { 179 | playerData[playerid][warningTicks] = 0; 180 | if(!playerData[playerid][healthImmune]) 181 | return CallLocalFunction("OnPlayerFakeKill", "iiii", playerid, killerid, reason, 1); 182 | } 183 | } 184 | else 185 | { 186 | if(!playerData[playerid][healthImmune]) 187 | return CallLocalFunction("OnPlayerFakeKill", "iiii", playerid, killerid, reason, 1); 188 | } 189 | } 190 | if(!IsReasonValid(reason) && !IsReasonIgnoreable(reason) && !IsReasonDifferentlyValid(reason) && reason != WEAPON_VEHICLE) 191 | return CallLocalFunction("OnPlayerFakeKill", "iiii", playerid, killerid, reason, 2); 192 | 193 | KillTimer(playerData[playerid][deathRefresher]); 194 | playerData[playerid][deathRefresher] = SetTimerEx("FakeKillJustDied", 5000, false, "i", playerid); 195 | 196 | playerData[playerid][justDied] = true; 197 | playerData[playerid][spawnCheck] = false; 198 | playerData[playerid][damageCheck] = false; 199 | #if defined FKI_OnPlayerDeath 200 | return FKI_OnPlayerDeath(playerid, killerid, reason); 201 | #else 202 | return 1; 203 | #endif 204 | } 205 | 206 | public OnPlayerGiveDamage(playerid, damagedid, Float:amount, weaponid, bodypart) 207 | { 208 | if(damagedid != INVALID_PLAYER_ID && IsPlayerConnected(damagedid)) 209 | { 210 | playerData[damagedid][damageCheck] = true; 211 | } 212 | #if defined FKI_OnPlayerGiveDamage 213 | return FKI_OnPlayerGiveDamage(playerid, damagedid, Float:amount, weaponid, bodypart); 214 | #else 215 | return 1; 216 | #endif 217 | } 218 | 219 | public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid, bodypart) 220 | { 221 | if(issuerid != INVALID_PLAYER_ID && IsPlayerConnected(issuerid)) 222 | { 223 | playerData[playerid][damageCheck] = true; 224 | } 225 | #if defined FKI_OnPlayerTakeDamage 226 | return FKI_OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid, bodypart); 227 | #else 228 | return 1; 229 | #endif 230 | } 231 | 232 | public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ) 233 | { 234 | switch(hittype) 235 | { 236 | case BULLET_HIT_TYPE_PLAYER: 237 | { 238 | playerData[hitid][damageCheck] = true; 239 | } 240 | case BULLET_HIT_TYPE_VEHICLE: 241 | { 242 | #if defined foreach 243 | foreach(new i: Player) 244 | { 245 | if(GetPlayerVehicleID(i) == hitid) playerData[i][damageCheck] = true; 246 | } 247 | #else 248 | for(new i, j = GetPlayerPoolSize(); i <= j; i++) 249 | { 250 | if(GetPlayerVehicleID(i) == hitid) playerData[i][damageCheck] = true; 251 | } 252 | #endif 253 | } 254 | } 255 | #if defined FKI_OnPlayerWeaponShot 256 | return FKI_OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ); 257 | #else 258 | return 1; 259 | #endif 260 | } 261 | 262 | public OnPlayerSpawn(playerid) 263 | { 264 | playerData[playerid][spawnCheck] = true; 265 | #if defined FKI_OnPlayerSpawn 266 | return FKI_OnPlayerSpawn(playerid); 267 | #else 268 | return 1; 269 | #endif 270 | } 271 | 272 | #if defined _ALS_SetPlayerHealth 273 | #undef SetPlayerHealth 274 | #else 275 | #define _ALS_SetPlayerHealth 276 | #endif 277 | 278 | #define SetPlayerHealth FKI_SetPlayerHealth 279 | 280 | #if defined _ALS_OnPlayerSpawn 281 | #undef OnPlayerSpawn 282 | #else 283 | #define _ALS_OnPlayerSpawn 284 | #endif 285 | 286 | #define OnPlayerSpawn FKI_OnPlayerSpawn 287 | 288 | #if defined _ALS_OnPlayerDeath 289 | #undef OnPlayerDeath 290 | #else 291 | #define _ALS_OnPlayerDeath 292 | #endif 293 | 294 | #define OnPlayerDeath FKI_OnPlayerDeath 295 | 296 | #if defined _ALS_OnPlayerTakeDamage 297 | #undef OnPlayerTakeDamage 298 | #else 299 | #define _ALS_OnPlayerTakeDamage 300 | #endif 301 | 302 | #define OnPlayerTakeDamage FKI_OnPlayerTakeDamage 303 | 304 | #if defined _ALS_OnPlayerGiveDamage 305 | #undef OnPlayerGiveDamage 306 | #else 307 | #define _ALS_OnPlayerGiveDamage 308 | #endif 309 | 310 | #define OnPlayerGiveDamage FKI_OnPlayerGiveDamage 311 | 312 | #if defined _ALS_OnPlayerWeaponShot 313 | #undef OnPlayerWeaponShot 314 | #else 315 | #define _ALS_OnPlayerWeaponShot 316 | #endif 317 | 318 | #define OnPlayerWeaponShot FKI_OnPlayerWeaponShot 319 | 320 | #if defined _ALS_OnPlayerDisconnect 321 | #undef OnPlayerDisconnect 322 | #else 323 | #define _ALS_OnPlayerDisconnect 324 | #endif 325 | 326 | #define OnPlayerDisconnect FKI_OnPlayerDisconnect 327 | 328 | #else //If its a filterscript 329 | 330 | stock FKIS_SetPlayerHealth(playerid, Float:health) 331 | return CallRemoteFunction("FKI_SetPlayerHealth", "if", playerid, health); 332 | 333 | #if defined _ALS_SetPlayerHealth 334 | #undef SetPlayerHealth 335 | #else 336 | #define _ALS_SetPlayerHealth 337 | #endif 338 | 339 | #define SetPlayerHealth FKIS_SetPlayerHealth 340 | 341 | #endif 342 | -------------------------------------------------------------------------------- /Anti-Cheat/BugCheats.inc: -------------------------------------------------------------------------------- 1 | /*rAntiBuggers by RogueDrifter 2 | -Feb the 10th 2018 3 | -Last updated: June 27th. 4 | -Callbacks: OnPlayerBugAttempt(playerid, bugcode). 5 | _____________________________________________ 6 | 7 | bugcode 0 = AFK ghost bugcode 1 = NPC spoof 8 | bugcode 2 = Fake spawn bugcode 3 = Fake connect 9 | bugcode 4 = cj run 10 | _____________________________________________ 11 | */ 12 | #if defined _RABUGGERS_INCLUDED_ 13 | #endinput 14 | #endif 15 | 16 | #define _RABUGGERS_INCLUDED_ 17 | 18 | #include 19 | 20 | #if !defined FILTERSCRIPT 21 | 22 | forward rAB_SpawnPlayer(playerid); 23 | forward rAB_UsePlayerPedAnims(); 24 | forward rAB_TogglePlayerSpectating(playerid, bool:toggle); 25 | 26 | forward ResetPlayerFall(playerid); 27 | 28 | enum E_BUGS_PLAYER_DATA 29 | { 30 | bool:isPlayerConnected, 31 | bool:isPlayerSpawned, 32 | 33 | fallingTechnique, 34 | 35 | Float:playerOldZ, 36 | 37 | falingTicks, 38 | damageTicks, 39 | pausedTicks 40 | } 41 | 42 | static 43 | playerData[MAX_PLAYERS][E_BUGS_PLAYER_DATA], 44 | bool:g_playerAnims; 45 | 46 | #define RAB_MAX_DMG_TICKS 3 47 | 48 | #if defined OnPlayerBugAttempt 49 | forward OnPlayerBugAttempt(playerid, bugcode); 50 | #endif 51 | 52 | #if defined RAB_OnPlayerConnect 53 | forward RAB_OnPlayerConnect(playerid); 54 | #endif 55 | 56 | #if defined RAB_OnPlayerDisconnect 57 | forward RAB_OnPlayerDisconnect(playerid, reason); 58 | #endif 59 | 60 | #if defined RAB_OnPlayerGiveDamage 61 | forward RAB_OnPlayerGiveDamage(playerid, damagedid, Float:amount, weaponid, bodypart); 62 | #endif 63 | 64 | #if defined RAB_OnPlayerSpawn 65 | forward RAB_OnPlayerSpawn(playerid); 66 | #endif 67 | 68 | #if defined RAB_OnPlayerDeath 69 | forward RAB_OnPlayerDeath(playerid, killerid, reason); 70 | #endif 71 | 72 | #if defined RAB_OnPlayerRequestClass 73 | forward RAB_OnPlayerRequestClass(playerid, classid); 74 | #endif 75 | 76 | #if defined RAB_OnPlayerUpdate 77 | forward RAB_OnPlayerUpdate(playerid); 78 | #endif 79 | 80 | static bool:IsPlayerPaused(playerid) 81 | return (gettime() > (playerData[playerid][pausedTicks]+3)); 82 | 83 | static bool:IsValidSkin(skinid) 84 | return(1 <= skinid <= 73 || 75 <= skinid <= 311); 85 | 86 | public OnPlayerConnect(playerid) 87 | { 88 | playerData[playerid][falingTicks] = -1; 89 | playerData[playerid][playerOldZ] = -999.0; 90 | if(playerData[playerid][isPlayerConnected]) 91 | { 92 | #if defined OnPlayerBugAttempt 93 | OnPlayerBugAttempt(playerid, 3); 94 | #endif 95 | } 96 | 97 | else playerData[playerid][isPlayerConnected] = true; 98 | if(IsPlayerNPC(playerid)) 99 | { 100 | new rAB_PIP[17]; 101 | GetPlayerIp(playerid, rAB_PIP, sizeof(rAB_PIP)); 102 | new rAB_ServerIP[17]; 103 | GetSVarString("bind", rAB_ServerIP, sizeof(rAB_ServerIP)); 104 | if (!!strcmp(rAB_PIP, rAB_ServerIP)) 105 | { 106 | #if defined OnPlayerBugAttempt 107 | OnPlayerBugAttempt(playerid, 1); 108 | #endif 109 | } 110 | } 111 | #if defined RAB_OnPlayerConnect 112 | return RAB_OnPlayerConnect(playerid); 113 | #else 114 | return 1; 115 | #endif 116 | } 117 | 118 | public OnPlayerSpawn(playerid) 119 | { 120 | if(playerData[playerid][isPlayerSpawned]) 121 | { 122 | #if defined OnPlayerBugAttempt 123 | OnPlayerBugAttempt(playerid, 2); 124 | #endif 125 | } 126 | #if defined RAB_OnPlayerSpawn 127 | return RAB_OnPlayerSpawn(playerid); 128 | #else 129 | return 1; 130 | #endif 131 | } 132 | 133 | public OnPlayerDeath(playerid, killerid, reason) 134 | { 135 | playerData[playerid][isPlayerSpawned] = false; 136 | #if defined RAB_OnPlayerDeath 137 | return RAB_OnPlayerDeath(playerid, killerid, reason); 138 | #else 139 | return 1; 140 | #endif 141 | } 142 | 143 | public OnPlayerDisconnect(playerid, reason) 144 | { 145 | playerData[playerid][isPlayerSpawned] = false; 146 | playerData[playerid][isPlayerConnected] = false; 147 | playerData[playerid][fallingTechnique] = 0; 148 | playerData[playerid][damageTicks] = 0; 149 | 150 | #if defined RAB_OnPlayerDisconnect 151 | return RAB_OnPlayerDisconnect(playerid, reason); 152 | #else 153 | return 1; 154 | #endif 155 | } 156 | 157 | public OnPlayerRequestClass(playerid, classid) 158 | { 159 | playerData[playerid][isPlayerSpawned] = false; 160 | #if defined RAB_OnPlayerRequestClass 161 | return RAB_OnPlayerRequestClass(playerid, classid); 162 | #else 163 | return 1; 164 | #endif 165 | } 166 | 167 | public OnPlayerUpdate(playerid) 168 | { 169 | if(playerData[playerid][falingTicks] == -1) playerData[playerid][falingTicks] = gettime(); 170 | new Float:rAB_TempX, Float:rAB_TempY, Float:rAB_TempZ; 171 | if(gettime() - playerData[playerid][falingTicks] >= 1) 172 | { 173 | playerData[playerid][falingTicks] = gettime(); 174 | if(playerData[playerid][playerOldZ] == -999.0) GetPlayerPos(playerid, rAB_TempX, rAB_TempY, rAB_TempZ); 175 | GetPlayerPos(playerid, rAB_TempX, rAB_TempY, rAB_TempZ); 176 | 177 | if(playerData[playerid][fallingTechnique] == 0) 178 | { 179 | if(rAB_TempZ - playerData[playerid][playerOldZ] > 2.0 && rAB_TempZ > 0.0 && playerData[playerid][playerOldZ] > 0.0) 180 | {//Player fell but above the void area. 181 | playerData[playerid][fallingTechnique] = 1; 182 | } 183 | 184 | if(rAB_TempZ + playerData[playerid][playerOldZ] < -2.0 && rAB_TempZ < 0.0 && playerData[playerid][playerOldZ] > 0.0) 185 | {//Player going below surface 186 | playerData[playerid][fallingTechnique] = 1; 187 | } 188 | 189 | if(playerData[playerid][playerOldZ] - rAB_TempZ > 2.0 && playerData[playerid][playerOldZ] < 0.0 && rAB_TempZ < 0.0) 190 | {//Player been falling in the void part 191 | playerData[playerid][fallingTechnique] = 1; 192 | } 193 | if(rAB_TempZ == 0.0 && playerData[playerid][playerOldZ] > 2.0) 194 | {//Player just fell on the ground 195 | playerData[playerid][fallingTechnique] = 1; 196 | } 197 | if(playerData[playerid][playerOldZ] == 0.0 && rAB_TempZ < -2.0) 198 | {//Player just went below surface 199 | playerData[playerid][fallingTechnique] = 1; 200 | } 201 | } 202 | 203 | if(playerData[playerid][playerOldZ] == rAB_TempZ && playerData[playerid][fallingTechnique] == 1) 204 | { 205 | playerData[playerid][fallingTechnique] = 2; 206 | SetTimerEx("ResetPlayerFall", 2000, false, "i", playerid); 207 | } 208 | } 209 | 210 | if(!g_playerAnims) 211 | { 212 | if(GetPlayerAnimationIndex(playerid) == 1231 && IsValidSkin(GetPlayerSkin(playerid)) && GetPlayerWeapon(playerid) != 46 && playerData[playerid][fallingTechnique] == 0) 213 | { 214 | #if defined OnPlayerBugAttempt 215 | OnPlayerBugAttempt(playerid, 4); 216 | #endif 217 | } 218 | } 219 | playerData[playerid][pausedTicks] = gettime(); 220 | GetPlayerPos(playerid, rAB_TempX, rAB_TempY, playerData[playerid][playerOldZ]); 221 | #if defined RAB_OnPlayerUpdate 222 | return RAB_OnPlayerUpdate(playerid); 223 | #else 224 | return 1; 225 | #endif 226 | } 227 | 228 | public OnPlayerGiveDamage(playerid, damagedid, Float:amount, weaponid, bodypart) 229 | { 230 | if(IsPlayerPaused(playerid)) 231 | { 232 | playerData[playerid][damageTicks]++; 233 | if(playerData[playerid][damageTicks] == RAB_MAX_DMG_TICKS) 234 | { 235 | playerData[playerid][damageTicks] = 0; 236 | #if defined OnPlayerBugAttempt 237 | OnPlayerBugAttempt(playerid, 0); 238 | #endif 239 | } 240 | } 241 | #if defined RAB_OnPlayerGiveDamage 242 | return RAB_OnPlayerGiveDamage(playerid, damagedid, Float:amount, weaponid, bodypart); 243 | #else 244 | return 1; 245 | #endif 246 | } 247 | 248 | public rAB_SpawnPlayer(playerid) 249 | { 250 | if(playerid <0 || playerid > MAX_PLAYERS) return 0; 251 | playerData[playerid][isPlayerSpawned] = false; 252 | return SpawnPlayer(playerid); 253 | } 254 | 255 | public rAB_UsePlayerPedAnims() 256 | { 257 | g_playerAnims = true; 258 | return UsePlayerPedAnims(); 259 | } 260 | 261 | public rAB_TogglePlayerSpectating(playerid, bool:toggle) 262 | { 263 | if(playerid <0 || playerid > MAX_PLAYERS) return 0; 264 | if(!toggle) playerData[playerid][isPlayerSpawned] = false; 265 | return TogglePlayerSpectating(playerid, toggle); 266 | } 267 | 268 | public ResetPlayerFall(playerid) 269 | return playerData[playerid][fallingTechnique] = 0; 270 | 271 | #if defined _ALS_OnPlayerConnect 272 | #undef OnPlayerConnect 273 | #else 274 | #define _ALS_OnPlayerConnect 275 | #endif 276 | 277 | #define OnPlayerConnect RAB_OnPlayerConnect 278 | 279 | #if defined _ALS_OnPlayerDisconnect 280 | #undef OnPlayerDisconnect 281 | #else 282 | #define _ALS_OnPlayerDisconnect 283 | #endif 284 | 285 | #define OnPlayerDisconnect RAB_OnPlayerDisconnect 286 | 287 | #if defined _ALS_OnPlayerSpawn 288 | #undef OnPlayerSpawn 289 | #else 290 | #define _ALS_OnPlayerSpawn 291 | #endif 292 | 293 | #define OnPlayerSpawn RAB_OnPlayerSpawn 294 | 295 | #if defined _ALS_OnPlayerUpdate 296 | #undef OnPlayerUpdate 297 | #else 298 | #define _ALS_OnPlayerUpdate 299 | #endif 300 | 301 | #define OnPlayerUpdate RAB_OnPlayerUpdate 302 | 303 | #if defined _ALS_OnPlayerDeath 304 | #undef OnPlayerDeath 305 | #else 306 | #define _ALS_OnPlayerDeath 307 | #endif 308 | 309 | #define OnPlayerDeath RAB_OnPlayerDeath 310 | 311 | #if defined _ALS_OnPlayerGiveDamage 312 | #undef OnPlayerGiveDamage 313 | #else 314 | #define _ALS_OnPlayerGiveDamage 315 | #endif 316 | 317 | #define OnPlayerGiveDamage RAB_OnPlayerGiveDamage 318 | 319 | #if defined _ALS_OnPlayerRequestClass 320 | #undef OnPlayerRequestClass 321 | #else 322 | #define _ALS_OnPlayerRequestClass 323 | #endif 324 | 325 | #define OnPlayerRequestClass RAB_OnPlayerRequestClass 326 | 327 | #if defined _ALS_TogglePlayerSpectating 328 | #undef TogglePlayerSpectating 329 | #else 330 | #define _ALS_TogglePlayerSpectating 331 | #endif 332 | 333 | #define TogglePlayerSpectating rAB_TogglePlayerSpectating 334 | 335 | #if defined _ALS_SpawnPlayer 336 | #undef SpawnPlayer 337 | #else 338 | #define _ALS_SpawnPlayer 339 | #endif 340 | 341 | #define SpawnPlayer rAB_SpawnPlayer 342 | 343 | #if defined _ALS_UsePlayerPedAnims 344 | #undef UsePlayerPedAnims 345 | #else 346 | #define _ALS_UsePlayerPedAnims 347 | #endif 348 | 349 | #define UsePlayerPedAnims rAB_UsePlayerPedAnims 350 | 351 | #else //If it's a FS 352 | 353 | stock rAB_FTogglePlayerSpectating(playerid, bool:toggle) 354 | return CallRemoteFunction("rAB_TogglePlayerSpectating", "ii", playerid, toggle); 355 | 356 | stock rAB_FSpawnPlayer(playerid) 357 | return CallRemoteFunction("rAB_SpawnPlayer", "i", playerid); 358 | 359 | stock rAB_FUsePlayerPedAnims() 360 | return CallRemoteFunction("rAB_UsePlayerPedAnims"); 361 | 362 | #if defined _ALS_TogglePlayerSpectating 363 | #undef TogglePlayerSpectating 364 | #else 365 | #define _ALS_TogglePlayerSpectating 366 | #endif 367 | 368 | #define TogglePlayerSpectating rAB_FTogglePlayerSpectating 369 | 370 | #if defined _ALS_SpawnPlayer 371 | #undef SpawnPlayer 372 | #else 373 | #define _ALS_SpawnPlayer 374 | #endif 375 | 376 | #define SpawnPlayer rAB_FSpawnPlayer 377 | 378 | #if defined _ALS_UsePlayerPedAnims 379 | #undef UsePlayerPedAnims 380 | #else 381 | #define _ALS_UsePlayerPedAnims 382 | #endif 383 | 384 | #define UsePlayerPedAnims rAB_FUsePlayerPedAnims 385 | 386 | #endif 387 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /Anti-Cheat/LaggersDetect.inc: -------------------------------------------------------------------------------- 1 | /* 2 | Laggers filter by Rogue 2018/2/21. 3 | -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 4 | 5 | LAST UPDATED: April 18th. 6 | -=-=-=-=-=-=-=-=-=-=-=-= 7 | 8 | Callbacks: 9 | -=-=-=-=-= 10 | OnPlayerLagout(playerid, lagtype, ping); 11 | -=-=-=-=- 12 | lagtype 1 = ping lag. 13 | lagtype 2 = packet-loss sync. 14 | -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 15 | Inner functions: 16 | -=-=-=-=-=-=-=-= 17 | IsPlayerLagging(playerid); 18 | IsPlayerDesynced(playerid); 19 | -=-=-=-=-=-=-=-=-=-=-=-=-=-= 20 | Defeinitions to use: 21 | -=-=-=-=-=-=-=-=-=-= 22 | #define FL_MAX_WAIT_TIME [number] ( max wait time for the lags check ) 23 | #define FL_MAX_LAG_PING [number] ( max ping to set a warning ) 24 | #define FL_MAX_WARNINGS [number] ( max warnings to call the callback ) 25 | -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 26 | */ 27 | 28 | #if defined _FLaggersIncluded_ 29 | #endinput 30 | #endif 31 | 32 | #define _FLaggersIncluded_ 33 | 34 | #include 35 | 36 | #if !defined FILTERSCRIPT 37 | 38 | #define FL_INVALID_PLAYER_STATS -1 39 | #define FL_ADDED_VALUE 80 40 | #define FL_MAX_DESYNC_WARNS 3 41 | 42 | #define FL_KICK_TYPE_PING_LAG 1 43 | #define FL_KICK_TYPE_DESYNC_LAG 2 44 | 45 | #if !defined FL_MAX_LAG_PING 46 | #define FL_MAX_LAG_PING 450 47 | #endif 48 | 49 | #if !defined FL_MAX_WAIT_TIME 50 | #define FL_MAX_WAIT_TIME 3 51 | #endif 52 | 53 | #if !defined FL_MAX_WARNINGS 54 | #define FL_MAX_WARNINGS 3 55 | #endif 56 | 57 | forward FL_GivePlayerWeapon(playerid, weaponid, ammo); 58 | forward FL_SetPlayerAmmo(playerid, weaponid, ammo); 59 | forward FL_ResetPlayerWeapons(playerid); 60 | 61 | forward CoolOffDesync(playerid); 62 | forward FixSpawnBug(playerid); 63 | forward ProcessLaggersStatistics(playerid); 64 | 65 | #if defined OnPlayerLagout 66 | forward OnPlayerLagout(playerid, lagtype, ping); 67 | #endif 68 | 69 | #if defined FL_OnPlayerConnect 70 | forward FL_OnPlayerConnect(playerid); 71 | #endif 72 | 73 | #if defined FL_OnPlayerDisconnect 74 | forward FL_OnPlayerDisconnect(playerid, reason); 75 | #endif 76 | 77 | #if defined FL_OnPlayerSpawn 78 | forward FL_OnPlayerSpawn(playerid); 79 | #endif 80 | 81 | #if defined FL_OnPlayerUpdate 82 | forward FL_OnPlayerUpdate(playerid); 83 | #endif 84 | 85 | #if defined FL_OnPlayerDeath 86 | forward FL_OnPlayerDeath(playerid, killerid, reason); 87 | #endif 88 | 89 | enum FLAGGERS_PLAYER_INFO 90 | { 91 | bool:isPlayerDesynced, 92 | bool:hasPlayerSpawned, 93 | 94 | pausedTicks, 95 | lagWarnings, 96 | ammoChecks, 97 | playerPing, 98 | desyncWarnings, 99 | 100 | spawnTimer, 101 | connectionTimer 102 | }; 103 | 104 | static 105 | playerData[MAX_PLAYERS][FLAGGERS_PLAYER_INFO]; 106 | 107 | //Inner functions: 108 | static FL_GetWeaponSlot(weaponid) 109 | { 110 | switch(weaponid) 111 | { 112 | case 0..1: return 0; 113 | case 2..9: return 1; 114 | case 22..24: return 2; 115 | case 25..27: return 3; 116 | case 28..29: return 4; 117 | case 32: return 4; 118 | case 30..31: return 5; 119 | case 33..34: return 6; 120 | case 35..38: return 7; 121 | case 16..18: return 8; 122 | case 39: return 8; 123 | case 41..43: return 9; 124 | case 10..15: return 10; 125 | case 44..46: return 11; 126 | case 40: return 12; 127 | } 128 | return 0; 129 | } 130 | 131 | //Exteriors: 132 | stock IsPlayerLagging(playerid) 133 | { 134 | if(playerid > MAX_PLAYERS || playerid < 0) return 0; 135 | return (playerData[playerid][lagWarnings] > 1); 136 | } 137 | stock IsPlayerDesynced(playerid) 138 | { 139 | if(playerid > MAX_PLAYERS || playerid < 0) return 0; 140 | return playerData[playerid][isPlayerDesynced]; 141 | } 142 | 143 | //Hooked functions: 144 | public FL_GivePlayerWeapon(playerid, weaponid, ammo) 145 | { 146 | if(playerid > MAX_PLAYERS || playerid < 0) return 0; 147 | if(FL_GetWeaponSlot(weaponid) == 0) 148 | { 149 | GivePlayerWeapon(playerid, weaponid, ammo); 150 | SetPlayerAmmo(playerid, 0, playerData[playerid][ammoChecks]); 151 | } 152 | 153 | else GivePlayerWeapon(playerid, weaponid, ammo); 154 | return 1; 155 | } 156 | 157 | public FL_SetPlayerAmmo(playerid, weaponid, ammo) 158 | { 159 | if(playerid > MAX_PLAYERS || playerid < 0) return 0; 160 | return (FL_GetWeaponSlot(weaponid) == 0) ? SetPlayerAmmo(playerid, 0, playerData[playerid][ammoChecks]) : SetPlayerAmmo(playerid, weaponid, ammo); 161 | } 162 | 163 | public FL_ResetPlayerWeapons(playerid) 164 | { 165 | if(playerid > MAX_PLAYERS || playerid < 0) return 0; 166 | ResetPlayerWeapons(playerid); 167 | 168 | return SetPlayerAmmo(playerid, 0, playerData[playerid][ammoChecks]); 169 | } 170 | 171 | //Hooked callbacks: 172 | public OnPlayerUpdate(playerid) 173 | { 174 | playerData[playerid][pausedTicks] = gettime(); 175 | 176 | #if defined FL_OnPlayerUpdate 177 | return FL_OnPlayerUpdate(playerid); 178 | #else 179 | return 1; 180 | #endif 181 | } 182 | 183 | public OnPlayerConnect(playerid) 184 | { 185 | playerData[playerid][playerPing] = FL_INVALID_PLAYER_STATS; 186 | 187 | playerData[playerid][connectionTimer] = SetTimerEx("ProcessLaggersStatistics", FL_MAX_WAIT_TIME*1000, true, "i", playerid); 188 | 189 | #if defined FL_OnPlayerConnect 190 | return FL_OnPlayerConnect(playerid); 191 | #else 192 | return 1; 193 | #endif 194 | } 195 | 196 | public OnPlayerDisconnect(playerid, reason) 197 | { 198 | playerData[playerid][isPlayerDesynced] = false; 199 | playerData[playerid][hasPlayerSpawned] = false; 200 | 201 | playerData[playerid][ammoChecks] = 0; 202 | playerData[playerid][lagWarnings] = 0; 203 | playerData[playerid][desyncWarnings] = 0; 204 | 205 | KillTimer(playerData[playerid][connectionTimer]); 206 | 207 | #if defined FL_OnPlayerDisconnect 208 | return FL_OnPlayerDisconnect(playerid, reason); 209 | #else 210 | return 1; 211 | #endif 212 | } 213 | 214 | public OnPlayerSpawn(playerid) 215 | { 216 | KillTimer(playerData[playerid][spawnTimer]); 217 | playerData[playerid][spawnTimer] = SetTimerEx("FixSpawnBug", 3000, false, "i", playerid); 218 | 219 | #if defined FL_OnPlayerSpawn 220 | return FL_OnPlayerSpawn(playerid); 221 | #else 222 | return 1; 223 | #endif 224 | } 225 | 226 | public OnPlayerDeath(playerid, killerid, reason) 227 | { 228 | playerData[playerid][hasPlayerSpawned] = false; 229 | 230 | #if defined FL_OnPlayerDeath 231 | return FL_OnPlayerDeath(playerid, killerid, reason); 232 | #else 233 | return 1; 234 | #endif 235 | } 236 | 237 | //Inner callbacks: 238 | public FixSpawnBug(playerid) 239 | { 240 | SetPlayerAmmo(playerid, 0, playerData[playerid][ammoChecks]); 241 | playerData[playerid][hasPlayerSpawned] = true; 242 | 243 | return 1; 244 | } 245 | 246 | public CoolOffDesync(playerid) 247 | return playerData[playerid][desyncWarnings] = 0; 248 | 249 | public ProcessLaggersStatistics(playerid) 250 | { 251 | new FL_PING = GetPlayerPing(playerid); 252 | 253 | if(playerData[playerid][hasPlayerSpawned] && gettime() < (playerData[playerid][pausedTicks]+2)) 254 | { 255 | if(playerData[playerid][lagWarnings] < FL_MAX_WARNINGS) 256 | { 257 | //Ping filter: 258 | if(FL_PING >= FL_MAX_LAG_PING && playerData[playerid][playerPing] == FL_INVALID_PLAYER_STATS) 259 | { 260 | playerData[playerid][playerPing] = FL_PING; 261 | } 262 | 263 | else if(FL_PING >= playerData[playerid][playerPing] && playerData[playerid][playerPing] != FL_INVALID_PLAYER_STATS) 264 | { 265 | playerData[playerid][lagWarnings]++, 266 | playerData[playerid][playerPing] = FL_PING; 267 | } 268 | 269 | else if(playerData[playerid][playerPing] != FL_INVALID_PLAYER_STATS && FL_PING + FL_ADDED_VALUE < playerData[playerid][playerPing]) 270 | { 271 | if(playerData[playerid][lagWarnings] > 0 ) playerData[playerid][lagWarnings]--; 272 | playerData[playerid][playerPing] = FL_INVALID_PLAYER_STATS; 273 | } 274 | 275 | else if(playerData[playerid][playerPing] != FL_INVALID_PLAYER_STATS) 276 | { 277 | playerData[playerid][playerPing] = FL_INVALID_PLAYER_STATS; 278 | } 279 | } 280 | 281 | //Final-Stage filter: 282 | else if(playerData[playerid][lagWarnings] >= FL_MAX_WARNINGS) 283 | { 284 | playerData[playerid][lagWarnings] = 0; 285 | #if defined OnPlayerLagout 286 | OnPlayerLagout(playerid, 1, FL_PING); 287 | #endif 288 | } 289 | 290 | //Desync filter: 291 | if(playerData[playerid][desyncWarnings] < FL_MAX_DESYNC_WARNS) 292 | { 293 | new 294 | FLaggersWep, 295 | FlaggersAmmo; 296 | 297 | GetPlayerWeaponData(playerid, 0, FLaggersWep, FlaggersAmmo); 298 | 299 | switch(playerData[playerid][ammoChecks]) 300 | { 301 | case 0: 302 | { 303 | playerData[playerid][ammoChecks] = 1; 304 | SetPlayerAmmo(playerid, FLaggersWep, 1); 305 | } 306 | case 1: 307 | { 308 | if(FlaggersAmmo != playerData[playerid][ammoChecks]) 309 | { 310 | if(playerData[playerid][desyncWarnings] == 0) SetTimerEx("CoolOffDesync", 50000, false, "i", playerid); 311 | playerData[playerid][desyncWarnings]++; 312 | SetPlayerAmmo(playerid, FLaggersWep, playerData[playerid][ammoChecks]); 313 | } 314 | playerData[playerid][ammoChecks] = 0; 315 | SetPlayerAmmo(playerid, FLaggersWep, 0); 316 | } 317 | } 318 | } 319 | 320 | else if(playerData[playerid][desyncWarnings] >= FL_MAX_DESYNC_WARNS && !playerData[playerid][isPlayerDesynced]) 321 | { 322 | playerData[playerid][isPlayerDesynced] = true; 323 | #if defined OnPlayerLagout 324 | OnPlayerLagout(playerid, 2, GetPlayerPing(playerid)); 325 | #endif 326 | } 327 | } 328 | 329 | return 1; 330 | } 331 | 332 | //Hookings: 333 | #if defined _ALS_OnPlayerDisconnect 334 | #undef OnPlayerDisconnect 335 | #else 336 | #define _ALS_OnPlayerDisconnect 337 | #endif 338 | 339 | #define OnPlayerDisconnect FL_OnPlayerDisconnect 340 | 341 | #if defined _ALS_OnPlayerConnect 342 | #undef OnPlayerConnect 343 | #else 344 | #define _ALS_OnPlayerConnect 345 | #endif 346 | 347 | #define OnPlayerConnect FL_OnPlayerConnect 348 | 349 | #if defined _ALS_OnPlayerUpdate 350 | #undef OnPlayerUpdate 351 | #else 352 | #define _ALS_OnPlayerUpdate 353 | #endif 354 | 355 | #define OnPlayerUpdate FL_OnPlayerUpdate 356 | 357 | #if defined _ALS_OnPlayerSpawn 358 | #undef OnPlayerSpawn 359 | #else 360 | #define _ALS_OnPlayerSpawn 361 | #endif 362 | 363 | #define OnPlayerSpawn FL_OnPlayerSpawn 364 | 365 | #if defined _ALS_OnPlayerDeath 366 | #undef OnPlayerDeath 367 | #else 368 | #define _ALS_OnPlayerDeath 369 | #endif 370 | 371 | #define OnPlayerDeath FL_OnPlayerDeath 372 | 373 | #if defined _ALS_GivePlayerWeapon 374 | #undef GivePlayerWeapon 375 | #else 376 | #define _ALS_GivePlayerWeapon 377 | #endif 378 | 379 | #define GivePlayerWeapon FL_GivePlayerWeapon 380 | 381 | #if defined _ALS_SetPlayerAmmo 382 | #undef SetPlayerAmmo 383 | #else 384 | #define _ALS_SetPlayerAmmo 385 | #endif 386 | 387 | #define SetPlayerAmmo FL_SetPlayerAmmo 388 | 389 | #if defined _ALS_ResetPlayerWeapons 390 | #undef ResetPlayerWeapons 391 | #else 392 | #define _ALS_ResetPlayerWeapons 393 | #endif 394 | 395 | #define ResetPlayerWeapons FL_ResetPlayerWeapons 396 | 397 | #else //if it's a filterscript 398 | 399 | //Linking to the gamemode: 400 | stock FLA_GivePlayerWeapon(playerid, weaponid, ammo) 401 | return CallRemoteFunction("FL_GivePlayerWeapon", "iii", playerid, weaponid, ammo); 402 | 403 | stock FLA_SetPlayerAmmo(playerid, weaponid, ammo) 404 | return CallRemoteFunction("FL_SetPlayerAmmo", "iii", playerid, weaponid, ammo); 405 | 406 | stock FLA_ResetPlayerWeapons(playerid) 407 | return CallRemoteFunction("FL_ResetPlayerWeapons", "i", playerid); 408 | 409 | //Hookings: 410 | #if defined _ALS_GivePlayerWeapon 411 | #undef GivePlayerWeapon 412 | #else 413 | #define _ALS_GivePlayerWeapon 414 | #endif 415 | 416 | #define GivePlayerWeapon FLA_GivePlayerWeapon 417 | 418 | #if defined _ALS_SetPlayerAmmo 419 | #undef SetPlayerAmmo 420 | #else 421 | #define _ALS_SetPlayerAmmo 422 | #endif 423 | 424 | #define SetPlayerAmmo FLA_SetPlayerAmmo 425 | 426 | #if defined _ALS_ResetPlayerWeapons 427 | #undef ResetPlayerWeapons 428 | #else 429 | #define _ALS_ResetPlayerWeapons 430 | #endif 431 | 432 | #define ResetPlayerWeapons FLA_ResetPlayerWeapons 433 | 434 | #endif -------------------------------------------------------------------------------- /Anti-Cheat/GunCheats.inc: -------------------------------------------------------------------------------- 1 | /* 2 | Anti weapons/ammo cheat by Rogue-=-=-= Created on 2018/3/26. 3 | =-=-==--=-=-=-=-= 4 | Last updated on June 27th. 5 | -=-=-=-=-=-=-=-=-=-==-=-=-=-=- 6 | OnPlayerGunCheat(playerid, weaponid, ammo, hacktype); 7 | -=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=-= 8 | playerid = the cheater 9 | weaponid = the weapon used 10 | ammo = the ammo used 11 | hacktype 1 = weapon cheat (spoofed weapon) 12 | hacktype 2 = ammo cheat (spoofed ammo ) 13 | hacktype 3 = freeze ammo cheat (self explained) 14 | hacktype 4 = Rapid fire (also super fast cbugging) 15 | -=-=-=-=-=-=-=-=-=-= 16 | */ 17 | 18 | #if defined _rAgc_Included_ 19 | #endinput 20 | #endif 21 | 22 | #define _rAgc_Included_ 23 | 24 | #include 25 | 26 | #if !defined FILTERSCRIPT 27 | 28 | forward rAgc_ResetPlayerWeapons(playerid); 29 | forward rAgc_SetPlayerAmmo(playerid, weaponid, ammo); 30 | forward rAgc_GivePlayerWeapon(playerid, weaponid, ammo); 31 | 32 | forward HandleVariablesReset(handleid, handletype); 33 | forward DetectCheaters(playerid); 34 | forward DelayRapidShots(playerid, weapon, ammo); 35 | 36 | #define rAgc_MAX_WEAPONIDS 47 37 | #define RAGC_IMMU_TIME 2000 38 | #define RAGC_MAX_RAPID_TIME_NORMAL 200 39 | #define RAGC_MAX_WARNINGS_FREEZE 4 40 | #define RAGC_MAX_SPOOF_WARNS 3 41 | 42 | #if defined OnPlayerGunCheat 43 | forward OnPlayerGunCheat(playerid, weaponid, ammo, hacktype); 44 | #endif 45 | 46 | #if defined rAgc_OnPlayerConnect 47 | forward rAgc_OnPlayerConnect(playerid); 48 | #endif 49 | 50 | #if defined rAgc_OnPlayerDisconnect 51 | forward rAgc_OnPlayerDisconnect(playerid, reason); 52 | #endif 53 | 54 | #if defined rAgc_OnPlayerSpawn 55 | forward rAgc_OnPlayerSpawn(playerid); 56 | #endif 57 | 58 | #if defined rAgc_OnPlayerUpdate 59 | forward rAgc_OnPlayerUpdate(playerid); 60 | #endif 61 | 62 | #if defined rAgc_OnPlayerWeaponShot 63 | forward rAgc_OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ); 64 | #endif 65 | 66 | enum E_WEAPONS_DATA 67 | { 68 | basicPlayerAmmo, 69 | basicPlayerWeapons, 70 | 71 | newPlayerAmmo, 72 | oldPlayerAmmo 73 | } 74 | 75 | enum E_PLAYER_DATA 76 | { 77 | bool:resetWeaponsImmunity, 78 | bool:changeAmmoImmunity, 79 | 80 | ammoWarnings, 81 | firstTrigger, 82 | secondTrigger, 83 | firstShot, 84 | secondShot, 85 | constantWeapon, 86 | pausedTicks, 87 | freezeWarnings, 88 | 89 | rapidShotsTimer, 90 | connectionTimer 91 | } 92 | 93 | static 94 | weaponsData[MAX_PLAYERS][E_WEAPONS_DATA][rAgc_MAX_WEAPONIDS], 95 | playerData[MAX_PLAYERS][E_PLAYER_DATA]; 96 | 97 | static bool:IsWeaponAmmoable(Weapon) 98 | return ( 22 <= Weapon <= 43 || 16 <= Weapon <= 18 ); 99 | 100 | static bool:IsWeaponValid(Weapon) 101 | return ( 0 <= Weapon <= 18 || 22 <= Weapon <= 46 ); 102 | 103 | static bool:IsWeaponSystemized(Weapon) 104 | return (Weapon == 46 || Weapon == 0 || Weapon == 40); 105 | 106 | static bool:IsPlayerPaused(playerid) 107 | return (gettime() > (playerData[playerid][pausedTicks]+2)); 108 | 109 | static RAGC_GetTickDiff(newtick, oldtick) 110 | { 111 | if(oldtick < 0 && newtick >= 0) 112 | { 113 | return newtick - oldtick; 114 | } 115 | else if(oldtick >= 0 && newtick < 0 || oldtick > newtick) 116 | { 117 | return (cellmax - oldtick + 1) - (cellmin - newtick); 118 | } 119 | return newtick - oldtick; 120 | } 121 | 122 | static bool:IsWeaponRapid(Weapon) 123 | { 124 | switch(Weapon) 125 | { 126 | case 26, 27, 23, 22, 30, 31, 28, 29, 32, 34, 38: return true; 127 | } 128 | return false; 129 | } 130 | 131 | static GetWeaponSlot(weaponid) 132 | { 133 | switch(weaponid) 134 | { 135 | case 0..1: return 0; 136 | case 2..9: return 1; 137 | case 22..24: return 2; 138 | case 25..27: return 3; 139 | case 28..29: return 4; 140 | case 32: return 4; 141 | case 30..31: return 5; 142 | case 33..34: return 6; 143 | case 35..38: return 7; 144 | case 16..18: return 8; 145 | case 39: return 8; 146 | case 41..43: return 9; 147 | case 10..15: return 10; 148 | case 44..46: return 11; 149 | case 40: return 12; 150 | } 151 | return 0; 152 | } 153 | 154 | 155 | public OnPlayerConnect(playerid) 156 | { 157 | rAgc_ResetPlayerWeapons(playerid); 158 | playerData[playerid][connectionTimer] = SetTimerEx("DetectCheaters", 1000, true, "i", playerid); 159 | #if defined rAgc_OnPlayerConnect 160 | return rAgc_OnPlayerConnect(playerid); 161 | #else 162 | return 1; 163 | #endif 164 | } 165 | 166 | public OnPlayerSpawn(playerid) 167 | { 168 | for(new s; s RAGC_MAX_RAPID_TIME_NORMAL && playerData[playerid][constantWeapon] == rAgcTempWeap && !IsWeaponRapid(rAgcTempWeap) && GetPlayerState(playerid) != 3) 220 | {//Anti rapid fire for slow weapons 221 | CallLocalFunction("OnPlayerGunCheat", "iiii", playerid, rAgcTempWeap, rAgcTempAmmos, 4); 222 | playerData[playerid][firstTrigger] = 0; 223 | playerData[playerid][secondTrigger]= 0; 224 | return 0; 225 | } 226 | else 227 | { 228 | playerData[playerid][firstTrigger] =0; 229 | playerData[playerid][secondTrigger]=0; 230 | } 231 | 232 | if(playerData[playerid][firstShot] == playerData[playerid][secondShot] && playerData[playerid][constantWeapon] == rAgcTempWeap 233 | && IsWeaponAmmoable(rAgcTempWeap) && !IsWeaponRapid(rAgcTempWeap) && GetPlayerState(playerid) != 3) 234 | {//Anti ammo freeze for slow ammo weapons 235 | playerData[playerid][freezeWarnings]++; 236 | if(playerData[playerid][freezeWarnings] == RAGC_MAX_WARNINGS_FREEZE) 237 | { 238 | playerData[playerid][firstShot] =0; 239 | playerData[playerid][secondShot]=0; 240 | playerData[playerid][freezeWarnings] = 0; 241 | if(!IsPlayerPaused(playerid)) 242 | { 243 | CallLocalFunction("OnPlayerGunCheat", "iiii", playerid, rAgcTempWeap, rAgcTempAmmos, 3); 244 | } 245 | return 0; 246 | } 247 | } 248 | else if(playerData[playerid][constantWeapon] == rAgcTempWeap && IsWeaponAmmoable(rAgcTempWeap) && (IsWeaponRapid(rAgcTempWeap) || GetPlayerState(playerid) == 3)) 249 | {//Anti ammo freeze for fast ammo weapons 250 | KillTimer(playerData[playerid][rapidShotsTimer]); 251 | playerData[playerid][rapidShotsTimer] = SetTimerEx("DelayRapidShots", 700, false, "iii", playerid, rAgcTempWeap, rAgcTempAmmos); 252 | } 253 | else 254 | { 255 | playerData[playerid][firstShot] =0; 256 | playerData[playerid][secondShot]=0; 257 | } 258 | } 259 | #if defined rAgc_OnPlayerWeaponShot 260 | return rAgc_OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ); 261 | #else 262 | return 1; 263 | #endif 264 | } 265 | 266 | public OnPlayerUpdate(playerid) 267 | { 268 | playerData[playerid][pausedTicks] = gettime(); 269 | 270 | #if defined rAgc_OnPlayerUpdate 271 | return rAgc_OnPlayerUpdate(playerid); 272 | #else 273 | return 1; 274 | #endif 275 | } 276 | 277 | public rAgc_ResetPlayerWeapons(playerid) 278 | { 279 | if(playerid <0 || playerid > MAX_PLAYERS) return 0; 280 | if(!playerData[playerid][resetWeaponsImmunity]) SetTimerEx("HandleVariablesReset", RAGC_IMMU_TIME, false, "d", playerid, 0); 281 | playerData[playerid][resetWeaponsImmunity] = true; 282 | 283 | for(new s; s MAX_PLAYERS) return 0; 299 | if(!IsWeaponValid(weaponid) || (IsWeaponAmmoable(weaponid) && ammo ==0)) return 0; 300 | weaponsData[playerid][newPlayerAmmo][weaponid] = 0; 301 | weaponsData[playerid][oldPlayerAmmo][weaponid] = 0; 302 | 303 | if(!playerData[playerid][resetWeaponsImmunity]) SetTimerEx("HandleVariablesReset", RAGC_IMMU_TIME, false, "d", playerid, 0); 304 | playerData[playerid][resetWeaponsImmunity] = true; 305 | 306 | switch(IsWeaponAmmoable(weaponid)) 307 | { 308 | case 0: 309 | { 310 | weaponsData[playerid][basicPlayerAmmo][weaponid] = 1; 311 | SetPlayerAmmo(playerid, weaponid, 1); 312 | } 313 | case 1: 314 | { 315 | weaponsData[playerid][basicPlayerAmmo][weaponid] = ammo; 316 | SetPlayerAmmo(playerid, weaponid, ammo); 317 | } 318 | } 319 | return 1; 320 | } 321 | 322 | public rAgc_GivePlayerWeapon(playerid, weaponid, ammo) 323 | { 324 | if(playerid <0 || playerid > MAX_PLAYERS) return 0; 325 | if(!IsWeaponValid(weaponid) || (IsWeaponAmmoable(weaponid) && ammo ==0)) return 0; 326 | weaponsData[playerid][newPlayerAmmo][weaponid] = 0; 327 | weaponsData[playerid][oldPlayerAmmo][weaponid] = 0; 328 | if(!playerData[playerid][resetWeaponsImmunity]) SetTimerEx("HandleVariablesReset", RAGC_IMMU_TIME, false, "d", playerid, 0); 329 | playerData[playerid][resetWeaponsImmunity] = true; 330 | switch(IsWeaponAmmoable(weaponid)) 331 | { 332 | case 0: 333 | { 334 | if(weaponsData[playerid][basicPlayerWeapons][weaponid] == weaponid) 335 | { 336 | weaponsData[playerid][basicPlayerAmmo][weaponid] = 1; 337 | GivePlayerWeapon(playerid, weaponid, 1); 338 | } 339 | else 340 | { 341 | weaponsData[playerid][basicPlayerWeapons][weaponid] = weaponid; 342 | weaponsData[playerid][basicPlayerAmmo][weaponid] = 1; 343 | GivePlayerWeapon(playerid, weaponid, 1); 344 | } 345 | } 346 | case 1: 347 | { 348 | if(weaponsData[playerid][basicPlayerWeapons][weaponid] == weaponid) 349 | { 350 | if(!playerData[playerid][changeAmmoImmunity]) SetTimerEx("HandleVariablesReset", RAGC_IMMU_TIME, false, "d", playerid, 1); 351 | playerData[playerid][changeAmmoImmunity] = true; 352 | new rAgcFixWep, rAgcFixAmmo; 353 | GivePlayerWeapon(playerid, weaponid, ammo); 354 | GetPlayerWeaponData(playerid, GetWeaponSlot(weaponid), rAgcFixWep, rAgcFixAmmo); 355 | weaponsData[playerid][basicPlayerAmmo][weaponid] = rAgcFixAmmo + ammo; 356 | } 357 | else 358 | { 359 | weaponsData[playerid][basicPlayerWeapons][weaponid] = weaponid; 360 | weaponsData[playerid][basicPlayerAmmo][weaponid] = ammo; 361 | GivePlayerWeapon(playerid, weaponid, ammo); 362 | } 363 | } 364 | } 365 | return 1; 366 | } 367 | 368 | public DelayRapidShots(playerid, weapon, ammo) 369 | { 370 | if(playerData[playerid][firstShot] == playerData[playerid][secondShot]) 371 | { 372 | playerData[playerid][freezeWarnings]++; 373 | if(playerData[playerid][freezeWarnings] == RAGC_MAX_WARNINGS_FREEZE) 374 | { 375 | playerData[playerid][freezeWarnings] = 0; 376 | /*if(!IsPlayerPaused(playerid)) 377 | { 378 | if(GetWeaponSlot(weapon) != 0) CallLocalFunction("OnPlayerGunCheat", "iiii", playerid, weapon, ammo, 3); 379 | }*/ 380 | } 381 | } 382 | playerData[playerid][firstShot] =0; 383 | playerData[playerid][secondShot]=0; 384 | return 1; 385 | } 386 | 387 | public DetectCheaters(playerid) 388 | { 389 | if(!IsPlayerPaused(playerid)) 390 | { 391 | //Weapon cheat detector: 392 | new rAgcAmmo, rAgcWep; 393 | for(new s; s 0) 315 | { 316 | VMPlayerWarns{playerid}++; 317 | if(VMPlayerWarns{playerid} == VM_MAX_PWARNS) 318 | { 319 | VMPlayerWarns{playerid} = 0; 320 | CallLocalFunction("OnVehicleModEx", "iiiii", playerid, vehicleid, componentid, true); 321 | } 322 | } 323 | else CallLocalFunction("OnVehicleModEx", "iiiii", playerid, vehicleid, componentid, true); 324 | #else 325 | CallLocalFunction("OnVehicleModEx", "iiiii", playerid, vehicleid, componentid, true); 326 | #endif 327 | } 328 | 329 | else CallLocalFunction("OnVehicleModEx", "iiiii", playerid, vehicleid, componentid, false); 330 | 331 | #if defined VM_OnVehicleMod 332 | return VM_OnVehicleMod(playerid, vehicleid, componentid); 333 | #else 334 | return 1; 335 | #endif 336 | } 337 | 338 | #if defined _ALS_OnPlayerConnect 339 | #undef OnPlayerConnect 340 | #else 341 | #define _ALS_OnPlayerConnect 342 | #endif 343 | 344 | #define OnPlayerConnect VM_OnPlayerConnect 345 | 346 | #if defined VM_OnPlayerConnect 347 | forward VM_OnPlayerConnect(playerid); 348 | #endif 349 | 350 | #if defined _ALS_OnEnterExitModShop 351 | #undef OnEnterExitModShop 352 | #else 353 | #define _ALS_OnEnterExitModShop 354 | #endif 355 | 356 | #define OnEnterExitModShop VM_OnEnterExitModShop 357 | 358 | #if defined VM_OnEnterExitModShop 359 | forward VM_OnEnterExitModShop(playerid, enterexit, interiorid); 360 | #endif 361 | 362 | #if defined _ALS_OnVehicleMod 363 | #undef OnVehicleMod 364 | #else 365 | #define _ALS_OnVehicleMod 366 | #endif 367 | 368 | #define OnVehicleMod VM_OnVehicleMod 369 | 370 | #if defined VM_OnVehicleMod 371 | forward VM_OnVehicleMod(playerid, vehicleid, componentid); 372 | #endif 373 | 374 | #endif -------------------------------------------------------------------------------- /Anti-Cheat/CarTroll.inc: -------------------------------------------------------------------------------- 1 | /* 2 | Anti car troll include by RogueDrifter Jan 15th 2018. 3 | -=-=-=-=-=- 4 | 5 | Last updated on June 28th. 6 | -=-=-=-=-=-=-=-=-=-=-=-= 7 | 8 | Callback: 9 | -=-=-=-=- 10 | 11 | OnPlayerCarTroll(playerid, vehicleid, trolledid, trolltype); 12 | -=-=-=-=-=-=-=-=--=-=-=-= 13 | 14 | Type 1: Teleporting between vehicles (can give cheaters chance to control other's players) (also lag cheat detected here). 15 | Type 2: Control other player's cars or spin/rotate (Done by checking the player's actual vehicle). 16 | Type 3: Fast kick/rotate or teleporting inside drivers. (detectd by position change) 17 | Type 4: Teleporting inside a vehicle illegally as a driver (without PutPlayerInVehicle or OnPlayerEnterVehicle). 18 | Type 5: Teleporting inside a vehicle illegally as a passenger (without PutPlayerInVehicle or OnPlayerEnterVehicle). 19 | Type 6: Remote kick a player by tping a vehicle inside of him. (Too fast the server reads it as an unoccupied vehicle). 20 | */ 21 | 22 | #if defined _AntiCarTroll_included 23 | #endinput 24 | #endif 25 | 26 | #define _AntiCarTroll_included 27 | 28 | #include 29 | 30 | #if !defined FILTERSCRIPT 31 | 32 | enum E_TROLL_PLAYER_DATA 33 | { 34 | bool:playerAntiSpam, 35 | bool:playerAntiJack, 36 | bool:playerFalseDetection, 37 | bool:playerPosProtection, 38 | bool:playerCarsFix, 39 | bool:isPlayerCheater, 40 | bool:playerSpawnProtection, 41 | bool:playerPassenger, 42 | bool:playerJustDied, 43 | bool:playerDoubleProtection, 44 | bool:playerAnimationProtection, 45 | bool:playerCallSpam, 46 | 47 | Float:playerPosX, 48 | Float:playerPosY, 49 | Float:playerPosZ, 50 | 51 | playerActualCar, 52 | playerStateVehicle, 53 | pauseTicks, 54 | playerUpdateVehicle, 55 | vehicleRangeID, 56 | 57 | playerInVehicleFix, 58 | resetPlayerDeath, 59 | resetPlayerSpawn, 60 | playerStateTimer, 61 | connectionTimer, 62 | resetVehicleOwner 63 | }; 64 | 65 | enum E_TROLL_VEHICLE_DATA 66 | { 67 | broadVehicleOwner, 68 | specificVehicleOwner, 69 | 70 | bool:enterVehicleFix 71 | }; 72 | 73 | static 74 | playerData[MAX_PLAYERS][E_TROLL_PLAYER_DATA], 75 | vehicleData[MAX_VEHICLES][E_TROLL_VEHICLE_DATA], 76 | s_safeTimer; 77 | 78 | #if !defined IsValidVehicle 79 | native IsValidVehicle(vehicleid); // Unlock the hidden native 80 | #endif 81 | 82 | #define RACT_BETWEEN_VEHICLES 1 83 | #define RACT_CONTROL_CARS_SPIN 2 84 | #define RACT_SKICK_CAR 3 85 | #define RACT_TELEPORT_DRIVER 4 86 | #define RACT_TELEPORT_PASSENGER 5 87 | #define RACT_KICKPLAYER_CAR 6 88 | 89 | forward ActTogglePlayerSpectating(playerid, bool:toggle); 90 | forward ActPutPlayerInVehicle(playerid, vehicleid, seatid); 91 | forward ActSetPlayerPos(playerid, Float:x, Float:y, Float:z); 92 | forward ActRemovePlayerFromVehicle(playerid); 93 | 94 | forward DelayPlayerState(playerid, delaytype); 95 | forward ResetVariableValues(handleid, handletype); 96 | forward FixPlayerPutInVehicle(playerid, vehicleid, seatid); 97 | forward BroadVehicleReset(); 98 | 99 | #if defined OnPlayerEnterVehicleACT 100 | forward OnPlayerEnterVehicleACT(playerid, vehicleid, ispassenger); 101 | #endif 102 | 103 | #if defined OnPlayerUpdateACT 104 | forward OnPlayerUpdateACT(playerid); 105 | #endif 106 | 107 | #if defined OnPlayerConnectACT 108 | forward OnPlayerConnectACT(playerid); 109 | #endif 110 | 111 | #if defined OnPlayerDisconnectACT 112 | forward OnPlayerDisconnectACT(playerid, reason); 113 | #endif 114 | 115 | #if defined OnPlayerExitVehicleACT 116 | forward OnPlayerExitVehicleACT(playerid, vehicleid); 117 | #endif 118 | 119 | #if defined OnPlayerDeathACT 120 | forward OnPlayerDeathACT(playerid, killerid, reason); 121 | #endif 122 | 123 | #if defined OnPlayerStateChangeACT 124 | forward OnPlayerStateChangeACT(playerid, newstate, oldstate); 125 | #endif 126 | 127 | #if defined OnGameModeInitACT 128 | forward OnGameModeInitACT(); 129 | #endif 130 | 131 | #if defined OnGameModeExitACT 132 | forward OnGameModeExitACT(); 133 | #endif 134 | 135 | #if defined OnPlayerSpawnAct 136 | forward OnPlayerSpawnAct(playerid); 137 | #endif 138 | 139 | #if defined OnUnoccupiedVehicleUpdateAct 140 | forward OnUnoccupiedVehicleUpdateAct(vehicleid, playerid, passenger_seat, Float:new_x, Float:new_y, Float:new_z, Float:vel_x, Float:vel_y, Float:vel_z); 141 | #endif 142 | 143 | static DetectTrollCheat(playerid, vehicleid, trolledid, trolltype) 144 | { 145 | #pragma unused trolltype, vehicleid 146 | 147 | if(playerData[playerid][playerCallSpam]) return 0; 148 | if(!playerData[playerid][isPlayerCheater]) 149 | { 150 | if(trolledid != INVALID_PLAYER_ID) 151 | { 152 | if(!playerData[trolledid][isPlayerCheater]) playerData[playerid][isPlayerCheater] = true; 153 | } 154 | else 155 | { 156 | playerData[playerid][isPlayerCheater] = true; 157 | } 158 | } 159 | 160 | if(trolledid != INVALID_PLAYER_ID) 161 | { 162 | if(!playerData[trolledid][isPlayerCheater]) 163 | { 164 | #if defined OnPlayerCarTroll 165 | OnPlayerCarTroll(playerid, vehicleid, trolledid, trolltype); 166 | #endif 167 | } 168 | } 169 | else 170 | { 171 | #if defined OnPlayerCarTroll 172 | OnPlayerCarTroll(playerid, vehicleid, trolledid, trolltype); 173 | #endif 174 | } 175 | playerData[playerid][playerCallSpam] = true; 176 | SetTimerEx("ResetVariableValues", 3000, false, "ii", playerid, 1); 177 | return 1; 178 | } 179 | 180 | static bool:IsPlayerEnterExitCar(playerid) 181 | { 182 | switch(GetPlayerAnimationIndex(playerid)) 183 | { 184 | case 1010..1012: return true; 185 | case 1024..1025: return true; 186 | case 1043..1045: return true; 187 | case 1009, 1041: return true; 188 | } 189 | if(GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_ENTER_VEHICLE) return true; 190 | return false; 191 | } 192 | 193 | static bool:IsPlayerDown(playerid) 194 | { 195 | switch(GetPlayerAnimationIndex(playerid)) 196 | { 197 | case 1208..1209: return true; 198 | case 1155..1156: return true; 199 | } 200 | return false; 201 | } 202 | 203 | static bool:IsPlayerNearVehicle(playerid, vehicleid, Float:range) 204 | { 205 | new Float:x, Float:y, Float:z; 206 | GetVehiclePos(vehicleid, x, y, z); 207 | return (IsPlayerInRangeOfPoint(playerid, range, x, y, z)) ? true : false; 208 | } 209 | 210 | static bool:IsPlayerPaused(playerid) 211 | return (gettime() > (playerData[playerid][pauseTicks]+2)); 212 | 213 | public DelayPlayerState(playerid, delaytype) 214 | { 215 | KillTimer(playerData[playerid][playerStateTimer]); 216 | switch(delaytype) 217 | { 218 | case 1: 219 | { 220 | if(!playerData[playerid][playerFalseDetection] && GetPlayerState(playerid) == 2 && !playerData[playerid][playerAntiSpam] && !playerData[playerid][playerSpawnProtection] && !playerData[playerid][playerDoubleProtection] && !playerData[playerid][playerAnimationProtection]) 221 | { 222 | playerData[playerid][playerAntiSpam]=true; 223 | SetTimerEx("ResetVariableValues", 2500, false, "ii", playerid, 2); 224 | DetectTrollCheat(playerid, GetPlayerVehicleID(playerid), INVALID_PLAYER_ID, RACT_TELEPORT_DRIVER); 225 | } 226 | else if(playerData[playerid][playerFalseDetection]) playerData[playerid][playerFalseDetection] = false; 227 | } 228 | case 2: 229 | { 230 | if(!playerData[playerid][playerFalseDetection] && GetPlayerState(playerid) == 3 && !playerData[playerid][playerAntiSpam] && !playerData[playerid][playerSpawnProtection] && !playerData[playerid][playerDoubleProtection] && !playerData[playerid][playerAnimationProtection]) 231 | { 232 | playerData[playerid][playerAntiSpam]=true; 233 | SetTimerEx("ResetVariableValues", 2500, false, "ii", playerid, 2); 234 | DetectTrollCheat(playerid, GetPlayerVehicleID(playerid), INVALID_PLAYER_ID, RACT_TELEPORT_PASSENGER); 235 | } 236 | else if(playerData[playerid][playerFalseDetection]) playerData[playerid][playerFalseDetection] = false; 237 | } 238 | } 239 | return 1; 240 | } 241 | 242 | public BroadVehicleReset() 243 | { 244 | memoryset(vehicleData[MAX_VEHICLES-1][broadVehicleOwner], INVALID_PLAYER_ID); 245 | for(new i, j = GetPlayerPoolSize(); i <= j; i++) 246 | { 247 | if(!IsPlayerConnected(i)) continue; 248 | if(GetPlayerState(i)== PLAYER_STATE_DRIVER) 249 | vehicleData[GetPlayerVehicleID(i)][broadVehicleOwner]= i; 250 | } 251 | return 1; 252 | } 253 | 254 | #if defined OnPlayerCarTroll 255 | forward OnPlayerCarTroll(playerid, vehicleid, trolledid, trolltype); 256 | 257 | #endif 258 | 259 | public OnPlayerUpdate(playerid) 260 | { 261 | new ActVeh = GetPlayerVehicleID(playerid); 262 | 263 | if(IsPlayerEnterExitCar(playerid) && !playerData[playerid][playerAnimationProtection]) 264 | { 265 | playerData[playerid][playerAnimationProtection] = true; 266 | SetTimerEx("ResetVariableValues", 5000, false, "ii", playerid, 13); 267 | } 268 | 269 | if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER && playerData[playerid][playerActualCar] != ActVeh && !playerData[playerid][playerFalseDetection]) 270 | { 271 | playerData[playerid][playerActualCar] = ActVeh; 272 | 273 | if(vehicleData[ActVeh][broadVehicleOwner] != playerid && vehicleData[ActVeh][broadVehicleOwner] != INVALID_PLAYER_ID) 274 | { 275 | DetectTrollCheat(playerid, ActVeh, vehicleData[ActVeh][broadVehicleOwner], RACT_CONTROL_CARS_SPIN); 276 | } 277 | else DetectTrollCheat(playerid, ActVeh, INVALID_PLAYER_ID, RACT_CONTROL_CARS_SPIN); 278 | 279 | SetVehicleToRespawn(ActVeh); 280 | SetPlayerHealth(playerid, 0); 281 | } 282 | 283 | if(IsPlayerEnterExitCar(playerid)) 284 | { 285 | new Float:PPOSX, Float:PPOSY, Float:PPOSZ; 286 | GetPlayerPos(playerid, PPOSX, PPOSY, PPOSZ); 287 | 288 | if(GetVehicleDistanceFromPoint(playerData[playerid][vehicleRangeID], PPOSX, PPOSY, PPOSZ) >= 5 && !playerData[playerid][playerFalseDetection]) 289 | { 290 | if(!playerData[playerid][playerFalseDetection]) ClearAnimations(playerid); 291 | } 292 | } 293 | 294 | if(GetPlayerState(playerid) == PLAYER_STATE_PASSENGER && ActVeh != playerData[playerid][playerUpdateVehicle]) 295 | { 296 | if(!playerData[playerid][playerFalseDetection]) 297 | { 298 | playerData[playerid][playerUpdateVehicle] = ActVeh; 299 | 300 | if(vehicleData[ActVeh][broadVehicleOwner] != playerid && vehicleData[ActVeh][broadVehicleOwner] != INVALID_PLAYER_ID) 301 | { 302 | DetectTrollCheat(playerid, ActVeh, vehicleData[ActVeh][broadVehicleOwner], RACT_BETWEEN_VEHICLES); 303 | } 304 | else DetectTrollCheat(playerid, ActVeh, INVALID_PLAYER_ID, RACT_BETWEEN_VEHICLES); 305 | 306 | SetVehicleToRespawn(ActVeh); 307 | SetPlayerHealth(playerid, 0); 308 | } 309 | } 310 | 311 | if(!IsPlayerInRangeOfPoint(playerid, 25.0, playerData[playerid][playerPosX], playerData[playerid][playerPosY], playerData[playerid][playerPosZ]) 312 | && playerData[playerid][playerPosX] != 0 && playerData[playerid][playerPosY] != 0 && !IsPlayerEnterExitCar(playerid) && !playerData[playerid][playerPassenger] && !playerData[playerid][playerJustDied] 313 | && playerData[playerid][playerPosZ] != 0 && !playerData[playerid][playerPosProtection] && !IsPlayerDown(playerid) 314 | && GetPlayerSurfingVehicleID(playerid) == INVALID_VEHICLE_ID && GetPlayerState(playerid) == PLAYER_STATE_ONFOOT && GetPlayerInterior(playerid) == 0) 315 | { 316 | for(new i, j = GetPlayerPoolSize(); i <= j; i++) 317 | { 318 | if(!IsPlayerConnected(i)) continue; 319 | new Float:ActTempX, Float:ActTempY, Float:ActTempZ; 320 | GetPlayerPos(i, ActTempX, ActTempY, ActTempZ); 321 | if(IsPlayerInRangeOfPoint(playerid, 1.2, ActTempX, ActTempY, ActTempZ) 322 | && !playerData[i][playerAntiSpam] && GetPlayerState(i) == PLAYER_STATE_DRIVER 323 | && i != playerid && IsPlayerNearVehicle(playerid, GetPlayerVehicleID(i), 5.0) && GetPlayerState(playerid) == PLAYER_STATE_ONFOOT) 324 | { 325 | playerData[i][playerAntiSpam]=true; 326 | SetVehicleToRespawn(GetPlayerVehicleID(i)); 327 | TogglePlayerControllable(i, 0); 328 | SetPlayerPos(i, ActTempX, ActTempY, ActTempZ); 329 | SetPlayerHealth(playerid, 0.0); 330 | 331 | SetTimerEx("ResetVariableValues", 1500, false, "ii", i, 7); 332 | SetTimerEx("ResetVariableValues", 1500, false, "ii", i, 2); 333 | DetectTrollCheat(playerid, GetPlayerVehicleID(i), i, RACT_SKICK_CAR); 334 | } 335 | } 336 | } 337 | playerData[playerid][pauseTicks] = gettime(); 338 | 339 | #if defined OnPlayerUpdateACT 340 | return OnPlayerUpdateACT(playerid); 341 | #else 342 | return 1; 343 | #endif 344 | } 345 | 346 | public OnGameModeInit() 347 | { 348 | s_safeTimer = SetTimer("BroadVehicleReset", 2500, true); 349 | 350 | #if defined OnGameModeInitACT 351 | return OnGameModeInitACT(); 352 | #else 353 | return 1; 354 | #endif 355 | } 356 | 357 | public OnGameModeExit() 358 | { 359 | KillTimer(s_safeTimer); 360 | 361 | #if defined OnGameModeExitACT 362 | return OnGameModeExitACT(); 363 | #else 364 | return 1; 365 | #endif 366 | } 367 | 368 | public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger) 369 | { 370 | playerData[playerid][vehicleRangeID] = vehicleid; 371 | 372 | if(ispassenger) playerData[playerid][playerUpdateVehicle] = vehicleid; 373 | if(!ispassenger) playerData[playerid][playerActualCar] = vehicleid; 374 | 375 | playerData[playerid][playerFalseDetection] = true; 376 | 377 | if(!ispassenger && !playerData[playerid][playerAntiJack] && vehicleData[vehicleid][broadVehicleOwner] != INVALID_PLAYER_ID && vehicleData[vehicleid][broadVehicleOwner] != playerid) 378 | { 379 | playerData[playerid][playerAntiJack]=true; 380 | SetTimerEx("ResetVariableValues", 6000, false, "ii", playerid, 6); 381 | 382 | playerData[vehicleData[vehicleid][broadVehicleOwner]][playerAntiJack]=true; 383 | SetTimerEx("ResetVariableValues", 6000, false, "ii", vehicleData[vehicleid][broadVehicleOwner], 6); 384 | } 385 | 386 | else if(!vehicleData[vehicleid][enterVehicleFix] && !ispassenger && vehicleData[vehicleid][broadVehicleOwner] == INVALID_PLAYER_ID) 387 | { 388 | vehicleData[vehicleid][enterVehicleFix] = true; 389 | vehicleData[vehicleid][specificVehicleOwner] = playerid; 390 | 391 | SetTimerEx("ResetVariableValues", 3000, false, "ii", vehicleid, 4); 392 | } 393 | 394 | #if defined OnPlayerEnterVehicleACT 395 | return OnPlayerEnterVehicleACT(playerid, vehicleid, ispassenger); 396 | #else 397 | return 1; 398 | #endif 399 | } 400 | 401 | public OnPlayerConnect(playerid) 402 | { 403 | playerData[playerid][playerAntiSpam]=false; 404 | playerData[playerid][playerAntiJack]=false; 405 | playerData[playerid][connectionTimer] = SetTimerEx("ResetVariableValues", 1000, true, "ii", playerid, 0); 406 | 407 | #if defined OnPlayerConnectACT 408 | return OnPlayerConnectACT(playerid); 409 | #else 410 | return 1; 411 | #endif 412 | } 413 | 414 | public OnPlayerSpawn(playerid) 415 | { 416 | if(!playerData[playerid][playerPosProtection]) SetTimerEx("ResetVariableValues", 2100, false, "ii", playerid, 3); 417 | playerData[playerid][playerPosProtection] = true; 418 | GetPlayerPos(playerid, playerData[playerid][playerPosX], playerData[playerid][playerPosY], playerData[playerid][playerPosZ]); 419 | 420 | KillTimer(playerData[playerid][resetPlayerDeath]); 421 | playerData[playerid][playerJustDied] = true; 422 | playerData[playerid][resetPlayerDeath] = SetTimerEx("ResetVariableValues", 5000, false, "ii", playerid, 11); 423 | 424 | KillTimer(playerData[playerid][resetPlayerSpawn]); 425 | playerData[playerid][resetPlayerSpawn] = SetTimerEx("ResetVariableValues", 5500, false, "ii", playerid, 9); 426 | playerData[playerid][playerSpawnProtection] = true; 427 | #if defined OnPlayerSpawnAct 428 | return OnPlayerSpawnAct(playerid); 429 | #else 430 | return 1; 431 | #endif 432 | } 433 | 434 | public OnUnoccupiedVehicleUpdate(vehicleid, playerid, passenger_seat, Float:new_x, Float:new_y, Float:new_z, Float:vel_x, Float:vel_y, Float:vel_z) 435 | { 436 | new Float:TempFloatX, Float:TempFloatY, Float:TempFloatZ; 437 | new ActTempState, ActTempCar; 438 | if(vel_z >= 300.000000) 439 | { 440 | SetVehicleToRespawn(vehicleid); 441 | GetVehiclePos(vehicleid, TempFloatX, TempFloatY, TempFloatZ); 442 | for(new x; x < MAX_VEHICLES; x++) 443 | { 444 | if(!IsValidVehicle(x) || vehicleData[x][broadVehicleOwner] != INVALID_PLAYER_ID) continue; 445 | if(GetVehicleDistanceFromPoint(vehicleid, TempFloatX, TempFloatY, TempFloatZ) <= 20) SetVehicleToRespawn(x); 446 | } 447 | for(new i, j = GetPlayerPoolSize(); i <= j; i++) 448 | { 449 | ActTempState = GetPlayerState(i); 450 | ActTempCar = GetPlayerVehicleID(i); 451 | 452 | if(!IsPlayerConnected(i)) continue; 453 | if(IsPlayerInRangeOfPoint(i, 4.0, new_x, new_y, new_z)) 454 | { 455 | if (i != playerid) 456 | { 457 | if(ActTempState != PLAYER_STATE_ONFOOT) GetVehiclePos(ActTempCar, TempFloatX, TempFloatY, TempFloatZ); 458 | SetPlayerHealth(playerid, 0.0); 459 | 460 | if(ActTempState == PLAYER_STATE_ONFOOT && !playerData[i][playerCarsFix]) 461 | { 462 | playerData[i][playerCarsFix] = true, 463 | TogglePlayerControllable(i, 0), 464 | SetTimerEx("ResetVariableValues", 2500, false, "ii", i, 7); 465 | } 466 | else if(ActTempState != PLAYER_STATE_ONFOOT && !playerData[i][playerCarsFix]) 467 | { 468 | SetVehicleToRespawn(ActTempCar); 469 | 470 | playerData[i][playerCarsFix] = true, 471 | TogglePlayerControllable(i, 0), 472 | SetTimerEx("ResetVariableValues", 2500, false, "ii", i, 7); 473 | } 474 | 475 | DetectTrollCheat(playerid, vehicleid, i, RACT_KICKPLAYER_CAR); 476 | break; 477 | } 478 | } 479 | } 480 | } 481 | 482 | #if defined OnUnoccupiedVehicleUpdateAct 483 | return OnUnoccupiedVehicleUpdateAct(vehicleid, playerid, passenger_seat, Float:new_x, Float:new_y, Float:new_z, Float:vel_x, Float:vel_y, Float:vel_z); 484 | #else 485 | return 1; 486 | #endif 487 | } 488 | 489 | public OnPlayerStateChange(playerid, newstate, oldstate) 490 | { 491 | switch(newstate) 492 | { 493 | case 1: 494 | { 495 | KillTimer(playerData[playerid][playerStateTimer]); 496 | switch(oldstate) 497 | { 498 | case 2: 499 | { 500 | playerData[playerid][resetVehicleOwner] = SetTimerEx("ResetVariableValues", 500, false, "ii", playerid, 5); 501 | playerData[playerid][playerFalseDetection]= false; 502 | } 503 | case 3: 504 | { 505 | playerData[playerid][playerPassenger] = true; 506 | SetTimerEx("ResetVariableValues", 2000, false, "ii", playerid, 10); 507 | playerData[playerid][playerFalseDetection]= false; 508 | } 509 | } 510 | } 511 | 512 | case 2: 513 | { 514 | playerData[playerid][playerStateVehicle] = GetPlayerVehicleID(playerid); 515 | if(vehicleData[playerData[playerid][playerStateVehicle]][broadVehicleOwner] != INVALID_PLAYER_ID && vehicleData[playerData[playerid][playerStateVehicle]][broadVehicleOwner] != playerid && IsPlayerPaused(vehicleData[playerData[playerid][playerStateVehicle]][broadVehicleOwner])) 516 | { 517 | new Float:ActPosX, Float:ActPosY, Float:ActPosZ; 518 | GetPlayerPos(vehicleData[playerData[playerid][playerStateVehicle]][broadVehicleOwner], ActPosX, ActPosY, ActPosZ); 519 | SetPlayerPos(vehicleData[playerData[playerid][playerStateVehicle]][broadVehicleOwner], ActPosX, ActPosY, ActPosZ+2); 520 | } 521 | 522 | KillTimer(playerData[playerid][playerStateTimer]); 523 | playerData[playerid][playerStateTimer] = SetTimerEx("DelayPlayerState", 350, false, "ii", playerid, 1); 524 | 525 | if(vehicleData[playerData[playerid][playerStateVehicle]][broadVehicleOwner] == INVALID_PLAYER_ID) 526 | { 527 | KillTimer(playerData[playerid][resetVehicleOwner]); 528 | vehicleData[playerData[playerid][playerStateVehicle]][broadVehicleOwner] = playerid; 529 | } 530 | } 531 | 532 | case 3: 533 | { 534 | KillTimer(playerData[playerid][playerStateTimer]); 535 | playerData[playerid][playerStateTimer] = SetTimerEx("DelayPlayerState", 350, false, "ii", playerid, 2); 536 | } 537 | } 538 | 539 | #if defined OnPlayerStateChangeACT 540 | return OnPlayerStateChangeACT(playerid, newstate, oldstate); 541 | #else 542 | return 1; 543 | #endif 544 | } 545 | 546 | public OnPlayerDeath(playerid, killerid, reason) 547 | { 548 | playerData[playerid][playerAntiSpam]=false; 549 | 550 | if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER) playerData[playerid][resetVehicleOwner] = SetTimerEx("ResetVariableValues", 500, false, "ii", playerid, 5); 551 | 552 | KillTimer(playerData[playerid][resetPlayerDeath]); 553 | playerData[playerid][playerJustDied] = true; 554 | playerData[playerid][resetPlayerDeath] = SetTimerEx("ResetVariableValues", 10000, false, "ii", playerid, 11); 555 | #if defined OnPlayerDeathACT 556 | return OnPlayerDeathACT(playerid, killerid, reason); 557 | #else 558 | return 1; 559 | #endif 560 | } 561 | 562 | public OnPlayerExitVehicle(playerid, vehicleid) 563 | { 564 | playerData[playerid][resetVehicleOwner] = SetTimerEx("ResetVariableValues", 500, false, "ii", playerid, 5); 565 | 566 | #if defined OnPlayerExitVehicleACT 567 | return OnPlayerExitVehicleACT(playerid, vehicleid); 568 | #else 569 | return 1; 570 | #endif 571 | } 572 | 573 | public OnPlayerDisconnect(playerid, reason) 574 | { 575 | KillTimer(playerData[playerid][connectionTimer]); 576 | new gplayerStateVehicle; 577 | gplayerStateVehicle = GetPlayerVehicleID(playerid); 578 | 579 | playerData[playerid][playerCallSpam] = false; 580 | playerData[playerid][playerAnimationProtection] = false; 581 | playerData[playerid][playerJustDied] = false; 582 | playerData[playerid][playerSpawnProtection] = false; 583 | playerData[playerid][isPlayerCheater] = false; 584 | playerData[playerid][playerPosProtection] = false; 585 | playerData[playerid][playerFalseDetection]= false; 586 | playerData[playerid][playerCarsFix] = false; 587 | playerData[playerid][playerPassenger] = false; 588 | playerData[playerid][playerDoubleProtection]= false; 589 | 590 | if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER) 591 | vehicleData[gplayerStateVehicle][broadVehicleOwner] = INVALID_PLAYER_ID; 592 | 593 | #if defined OnPlayerDisconnectACT 594 | return OnPlayerDisconnectACT(playerid, reason); 595 | #else 596 | return 1; 597 | #endif 598 | } 599 | 600 | public ResetVariableValues(handleid, handletype) 601 | { 602 | switch(handletype) 603 | { 604 | case 0: 605 | { 606 | GetPlayerPos(handleid, playerData[handleid][playerPosX], playerData[handleid][playerPosY], playerData[handleid][playerPosZ]); 607 | } 608 | case 1: 609 | { 610 | playerData[handleid][playerCallSpam] = false; 611 | } 612 | case 2: 613 | { 614 | playerData[handleid][playerAntiSpam] = false; 615 | } 616 | case 3: 617 | { 618 | playerData[handleid][playerPosProtection] = false; 619 | } 620 | case 4: 621 | { 622 | vehicleData[handleid][enterVehicleFix] = false, 623 | vehicleData[handleid][specificVehicleOwner] = INVALID_PLAYER_ID; 624 | } 625 | case 5: 626 | { 627 | vehicleData[ playerData[handleid][playerStateVehicle] ][broadVehicleOwner] = INVALID_PLAYER_ID; 628 | } 629 | case 6: 630 | { 631 | playerData[handleid][playerAntiJack] = false; 632 | } 633 | case 7: 634 | { 635 | TogglePlayerControllable(handleid, 1); 636 | playerData[handleid][playerCarsFix] = false; 637 | } 638 | case 8: 639 | { 640 | playerData[handleid][playerFalseDetection] = false; 641 | } 642 | case 9: 643 | { 644 | playerData[handleid][playerSpawnProtection] = false; 645 | } 646 | case 10: 647 | { 648 | playerData[handleid][playerPassenger] = false; 649 | } 650 | case 11: 651 | { 652 | playerData[handleid][playerJustDied] = false; 653 | } 654 | case 12: 655 | { 656 | playerData[handleid][playerDoubleProtection] = false; 657 | } 658 | case 13: 659 | { 660 | playerData[handleid][playerAnimationProtection] = false; 661 | } 662 | } 663 | return 1; 664 | } 665 | 666 | public FixPlayerPutInVehicle(playerid, vehicleid, seatid) 667 | { 668 | playerData[playerid][playerFalseDetection] = true; 669 | return PutPlayerInVehicle(playerid, vehicleid, seatid); 670 | } 671 | 672 | public ActTogglePlayerSpectating(playerid, bool:toggle) 673 | { 674 | if(playerid > MAX_PLAYERS || playerid < 0) return 0; 675 | if(!playerData[playerid][playerFalseDetection]) SetTimerEx("ResetVariableValues", 2100, false, "ii", playerid, 8); 676 | playerData[playerid][playerFalseDetection] = true; 677 | return TogglePlayerSpectating(playerid, toggle); 678 | } 679 | 680 | public ActRemovePlayerFromVehicle(playerid) 681 | { 682 | if(playerid > MAX_PLAYERS || playerid < 0) return 0; 683 | if(!playerData[playerid][playerDoubleProtection]) SetTimerEx("ResetVariableValues", 2100, false, "ii", playerid, 12); 684 | playerData[playerid][playerDoubleProtection] = true; 685 | return RemovePlayerFromVehicle(playerid); 686 | } 687 | 688 | public ActPutPlayerInVehicle(playerid, vehicleid, seatid) 689 | { 690 | if(playerid > MAX_PLAYERS || playerid < 0 || vehicleid < 0 || vehicleid > MAX_VEHICLES) return 0; 691 | if(vehicleData[vehicleid][enterVehicleFix]) ClearAnimations(vehicleData[vehicleid][specificVehicleOwner]); 692 | playerData[playerid][playerFalseDetection] = true; 693 | 694 | if(seatid != 0 ) playerData[playerid][playerUpdateVehicle] = vehicleid; 695 | if(seatid == 0 ) playerData[playerid][playerActualCar] = vehicleid; 696 | 697 | if(GetPlayerState(playerid) == 2 || GetPlayerState(playerid) == 3) 698 | { 699 | KillTimer(playerData[playerid][playerInVehicleFix]); 700 | new Float:PX, Float:PY, Float:PZ; 701 | GetPlayerPos(playerid, PX, PY, PZ); 702 | SetPlayerPos(playerid, PX, PY, PZ+2); 703 | playerData[playerid][playerInVehicleFix] = SetTimerEx("FixPlayerPutInVehicle", 1000 , false, "iii", playerid, vehicleid, seatid); 704 | } 705 | 706 | else PutPlayerInVehicle(playerid, vehicleid, seatid); 707 | return 1; 708 | } 709 | 710 | public ActSetPlayerPos(playerid, Float:x, Float:y, Float:z) 711 | { 712 | if(playerid > MAX_PLAYERS || playerid < 0) return 0; 713 | if(!playerData[playerid][playerPosProtection]) SetTimerEx("ResetVariableValues", 4000, false, "ii", playerid, 3); 714 | playerData[playerid][playerPosProtection] = true; 715 | return SetPlayerPos(playerid, x, y, z); 716 | } 717 | 718 | #if defined _ALS_OnUnoccupiedVehicleUpdate 719 | #undef OnUnoccupiedVehicleUpdate 720 | #else 721 | #define _ALS_OnUnoccupiedVehicleUpdate 722 | #endif 723 | 724 | #if defined _ALS_OnPlayerStateChange 725 | #undef OnPlayerStateChange 726 | #else 727 | #define _ALS_OnPlayerStateChange 728 | #endif 729 | 730 | #if defined _ALS_OnPlayerConnect 731 | #undef OnPlayerConnect 732 | #else 733 | #define _ALS_OnPlayerConnect 734 | #endif 735 | 736 | #if defined _ALS_OnPlayerSpawn 737 | #undef OnPlayerSpawn 738 | #else 739 | #define _ALS_OnPlayerSpawn 740 | #endif 741 | 742 | #if defined _ALS_OnPlayerDisconnect 743 | #undef OnPlayerDisconnect 744 | #else 745 | #define _ALS_OnPlayerDisconnect 746 | #endif 747 | 748 | #if defined _ALS_OnPlayerExitVehicle 749 | #undef OnPlayerExitVehicle 750 | #else 751 | #define _ALS_OnPlayerExitVehicle 752 | #endif 753 | 754 | #if defined _ALS_OnPlayerDeath 755 | #undef OnPlayerDeath 756 | #else 757 | #define _ALS_OnPlayerDeath 758 | #endif 759 | 760 | #if defined _ALS_OnGameModeInit 761 | #undef OnGameModeInit 762 | #else 763 | #define _ALS_OnGameModeInit 764 | #endif 765 | 766 | #if defined _ALS_OnGameModeExit 767 | #undef OnGameModeExit 768 | #else 769 | #define _ALS_OnGameModeExit 770 | #endif 771 | 772 | #if defined _ALS_OnPlayerEnterVehicle 773 | #undef OnPlayerEnterVehicle 774 | #else 775 | #define _ALS_OnPlayerEnterVehicle 776 | #endif 777 | 778 | #if defined _ALS_OnPlayerUpdate 779 | #undef OnPlayerUpdate 780 | #else 781 | #define _ALS_OnPlayerUpdate 782 | #endif 783 | 784 | #if defined _ALS_PutPlayerInVehicle 785 | #undef PutPlayerInVehicle 786 | #else 787 | #define _ALS_PutPlayerInVehicle 788 | #endif 789 | 790 | #if defined _ALS_SetPlayerPos 791 | #undef SetPlayerPos 792 | #else 793 | #define _ALS_SetPlayerPos 794 | #endif 795 | 796 | #if defined _ALS_TogglePlayerSpectating 797 | #undef TogglePlayerSpectating 798 | #else 799 | #define _ALS_TogglePlayerSpectating 800 | #endif 801 | 802 | #if defined _ALS_RemovePlayerFromVehicle 803 | #undef RemovePlayerFromVehicle 804 | #else 805 | #define _ALS_RemovePlayerFromVehicle 806 | #endif 807 | 808 | #define OnUnoccupiedVehicleUpdate OnUnoccupiedVehicleUpdateAct 809 | #define OnPlayerExitVehicle OnPlayerExitVehicleACT 810 | #define OnGameModeInit OnGameModeInitACT 811 | #define OnPlayerDeath OnPlayerDeathACT 812 | #define OnPlayerDisconnect OnPlayerDisconnectACT 813 | #define OnPlayerSpawn OnPlayerSpawnAct 814 | #define OnPlayerConnect OnPlayerConnectACT 815 | #define OnPlayerStateChange OnPlayerStateChangeACT 816 | #define OnGameModeExit OnGameModeExitACT 817 | #define OnPlayerEnterVehicle OnPlayerEnterVehicleACT 818 | #define OnPlayerUpdate OnPlayerUpdateACT 819 | 820 | #define TogglePlayerSpectating ActTogglePlayerSpectating 821 | #define RemovePlayerFromVehicle ActRemovePlayerFromVehicle 822 | #define PutPlayerInVehicle ActPutPlayerInVehicle 823 | #define SetPlayerPos ActSetPlayerPos 824 | 825 | #else //If it's a filterscript 826 | 827 | #if defined _ALS_RemovePlayerFromVehicle 828 | #undef RemovePlayerFromVehicle 829 | #else 830 | #define _ALS_RemovePlayerFromVehicle 831 | #endif 832 | 833 | #if defined _ALS_PutPlayerInVehicle 834 | #undef PutPlayerInVehicle 835 | #else 836 | #define _ALS_PutPlayerInVehicle 837 | #endif 838 | 839 | #if defined _ALS_SetPlayerPos 840 | #undef SetPlayerPos 841 | #else 842 | #define _ALS_SetPlayerPos 843 | #endif 844 | 845 | #if defined _ALS_TogglePlayerSpectating 846 | #undef TogglePlayerSpectating 847 | #else 848 | #define _ALS_TogglePlayerSpectating 849 | #endif 850 | 851 | #define RemovePlayerFromVehicle ActFRemovePlayerFromVehicle 852 | #define TogglePlayerSpectating ActFTogglePlayerSpectating 853 | #define PutPlayerInVehicle ActFPutPlayerInVehicle 854 | #define SetPlayerPos ActFSetPlayerPos 855 | 856 | stock ActFRemovePlayerFromVehicle(playerid) 857 | return CallRemoteFunction("ActRemovePlayerFromVehicle", "i", playerid); 858 | 859 | stock ActFTogglePlayerSpectating(playerid, bool:toggle) 860 | return CallRemoteFunction("ActTogglePlayerSpectating", "ii", playerid, toggle); 861 | 862 | stock ActFPutPlayerInVehicle(playerid, vehicleid, seatid) 863 | return CallRemoteFunction("ActPutPlayerInVehicle", "iii", playerid, vehicleid, seatid); 864 | 865 | stock ActFSetPlayerPos(playerid, Float:x, Float:y, Float:z) 866 | return CallRemoteFunction("ActSetPlayerPos", "ifff", playerid, x, y, z); 867 | 868 | #endif 869 | 870 | static memoryset(aArray[], iValue, iSize = sizeof(aArray)) { //I didn't create this 871 | new 872 | iAddress 873 | ; 874 | 875 | // Store the address of the array 876 | #emit LOAD.S.pri 12 877 | #emit STOR.S.pri iAddress 878 | 879 | // Convert the size from cells to bytes 880 | iSize *= 4; 881 | 882 | // Loop until there is nothing more to fill 883 | while (iSize > 0) { 884 | // I have to do this because the FILL instruction doesn't accept a dynamic number. 885 | if (iSize >= 4096) { 886 | #emit LOAD.S.alt iAddress 887 | #emit LOAD.S.pri iValue 888 | #emit FILL 4096 889 | 890 | iSize -= 4096; 891 | iAddress += 4096; 892 | } else if (iSize >= 1024) { 893 | #emit LOAD.S.alt iAddress 894 | #emit LOAD.S.pri iValue 895 | #emit FILL 1024 896 | 897 | iSize -= 1024; 898 | iAddress += 1024; 899 | } else if (iSize >= 256) { 900 | #emit LOAD.S.alt iAddress 901 | #emit LOAD.S.pri iValue 902 | #emit FILL 256 903 | 904 | iSize -= 256; 905 | iAddress += 256; 906 | } else if (iSize >= 64) { 907 | #emit LOAD.S.alt iAddress 908 | #emit LOAD.S.pri iValue 909 | #emit FILL 64 910 | 911 | iSize -= 64; 912 | iAddress += 64; 913 | } else if (iSize >= 16) { 914 | #emit LOAD.S.alt iAddress 915 | #emit LOAD.S.pri iValue 916 | #emit FILL 16 917 | 918 | iSize -= 16; 919 | iAddress += 16; 920 | } else { 921 | #emit LOAD.S.alt iAddress 922 | #emit LOAD.S.pri iValue 923 | #emit FILL 4 924 | 925 | iSize -= 4; 926 | iAddress += 4; 927 | } 928 | } 929 | 930 | // aArray is used, just not by its symbol name 931 | #pragma unused aArray 932 | } 933 | --------------------------------------------------------------------------------