From 3254fb949c227e3ed7b7ca93506d6b8a0560406e Mon Sep 17 00:00:00 2001 From: GenZmeY Date: Mon, 7 Nov 2022 05:28:50 +0300 Subject: [PATCH] Auto enable cheats --- AAL/Classes/AAL.uc | 41 ++++++++++++++++++++++++++++++++++++----- 1 file changed, 36 insertions(+), 5 deletions(-) diff --git a/AAL/Classes/AAL.uc b/AAL/Classes/AAL.uc index 7703ed9..6a26b1f 100644 --- a/AAL/Classes/AAL.uc +++ b/AAL/Classes/AAL.uc @@ -1,15 +1,19 @@ class AAL extends Info config(AAL); -const LatestVersion = 1; +const LatestVersion = 2; + +const ProfileURL = "https://steamcommunity.com/profiles/"; const CfgAdminList = class'AdminList'; var private config int Version; var private config E_LogLevel LogLevel; +var private config bool bAutoEnableCheats; var private OnlineSubsystem OS; var private Array AdminUIDList; +var private Array AdminUIDListActive; public simulated function bool SafeDestroy() { @@ -62,6 +66,9 @@ private function PreInit() case `NO_CONFIG: `Log_Info("Config created"); + case 1: + bAutoEnableCheats = false; + case MaxInt: `Log_Info("Config updated to version" @ LatestVersion); break; @@ -116,7 +123,6 @@ public function NotifyLogin(Controller C) local PlayerReplicationInfo PRI; local String UniqueID; local String SteamID; - local String Profile; `Log_Trace(); @@ -127,16 +133,25 @@ public function NotifyLogin(Controller C) if (AdminUIDList.Find('Uid', PRI.UniqueId.Uid) != INDEX_NONE) { PRI.bAdmin = true; + } + + if (PRI.bAdmin) + { + AdminUIDListActive.AddItem(PRI.UniqueId); UniqueID = OS.UniqueNetIdToString(PRI.UniqueId); PC = PlayerController(C); + + if (PC != None && bAutoEnableCheats) + { + PC.AddCheats(true); + } + if (PC != None && !PC.bIsEosPlayer) { SteamID = OS.UniqueNetIdToInt64(PRI.UniqueId); - Profile = "https://steamcommunity.com/profiles/" $ SteamID; - - `Log_Info("Admin login:" @ PRI.PlayerName @ "(" $ UniqueID $ "," @ SteamID $ "," @ Profile $ ")"); + `Log_Info("Admin login:" @ PRI.PlayerName @ "(" $ UniqueID $ "," @ SteamID $ "," @ ProfileURL $ SteamID $ ")"); } else { @@ -147,7 +162,23 @@ public function NotifyLogin(Controller C) public function NotifyLogout(Controller C) { + local PlayerReplicationInfo PRI; + local String UniqueID; + local String SteamID; + `Log_Trace(); + + if (C == None || C.PlayerReplicationInfo == None) return; + + PRI = C.PlayerReplicationInfo; + + if (PRI.bAdmin || AdminUIDListActive.Find('Uid', PRI.UniqueId.Uid) != INDEX_NONE) + { + AdminUIDListActive.RemoveItem(PRI.UniqueId); + UniqueID = OS.UniqueNetIdToString(PRI.UniqueId); + SteamID = OS.UniqueNetIdToInt64(PRI.UniqueId); + `Log_Info("Admin logout:" @ PRI.PlayerName @ "(" $ UniqueID $ "," @ SteamID $ "," @ ProfileURL $ SteamID $ ")"); + } } defaultproperties