diff --git a/GameFiles/_integration.gsc b/GameFiles/_integration.gsc index b6f2237f..80e32395 100644 --- a/GameFiles/_integration.gsc +++ b/GameFiles/_integration.gsc @@ -269,10 +269,10 @@ InitializeGameMethods() { level.overrideMethods["noclip"] = ::NoClip; } - + if ( level.eventBus.gamename == "IW5" ) - { //PlutoIW5 only allows Godmode and NoClip if cheats are on.. - level.overrideMethods["god"] = ::IW5_God; + { //PlutoIW5 only allows Godmode and NoClip if cheats are on.. + level.overrideMethods["god"] = ::IW5_God; level.overrideMethods["noclip"] = ::IW5_NoClip; } } @@ -772,7 +772,9 @@ NoClipImpl() if ( !IsAlive( self ) ) { self IPrintLnBold( "You are not alive" ); - return; + // Due to bug when sometimes disabling noclip game thinks you're dead + // removing the return and allowing them to go back into noclip is probably better. + //return; } self SetClientDvar( "sv_cheats", 1 ); @@ -783,17 +785,19 @@ NoClipImpl() self call [[level.overrideMethods["noclip"]]]( true ); self Hide(); + self.isNoClipped = true; + self IPrintLnBold( "NoClip enabled" ); } NoClipOffImpl() { - if ( !IsAlive( self ) ) + if ( !IsDefined( self.isNoClipped ) || !self.isNoClipped ) { - self IPrintLnBold( "You are not alive" ); + self IPrintLnBold( "You are not no-clipped" ); return; } - + self SetClientDvar( "sv_cheats", 1 ); self SetClientDvar( "cg_thirdperson", 0 ); self SetClientDvar( "sv_cheats", 0 ); @@ -803,6 +807,16 @@ NoClipOffImpl() self Show(); self IPrintLnBold( "NoClip disabled" ); + + if ( !IsAlive( self ) && self.isNoClipped ) + { + // Sometimes you will bug exiting noclip where the game thinks you're dead + // but you're not. You will retain godmode but be able to run around and kill people. + // So, it's important to let the user know. + self IPrintLnBold( "^1You are bugged! ^4Swap team." ); + } + + self.isNoClipped = false; } HideImpl() @@ -817,7 +831,7 @@ HideImpl() self SetClientDvar( "cg_thirdperson", 1 ); self SetClientDvar( "sv_cheats", 0 ); - if ( !IsDefined( self.savedHealth ) || self.health < 1000 ) + if ( !IsDefined( self.savedHealth ) || self.health < 1000 ) { self.savedHealth = self.health; self.savedMaxHealth = self.maxhealth; @@ -826,6 +840,8 @@ HideImpl() self call [[level.overrideMethods["god"]]]( true ); self Hide(); + self.isHidden = true; + self IPrintLnBold( "You are now ^5hidden ^7from other players" ); } @@ -849,6 +865,8 @@ UnhideImpl() self call [[level.overrideMethods["god"]]]( false ); self Show(); + + self.isHidden = false; self IPrintLnBold( "You are now ^5visible ^7to other players" ); } diff --git a/IW4MAdmin.sln b/IW4MAdmin.sln index b59f4a03..42c29352 100644 --- a/IW4MAdmin.sln +++ b/IW4MAdmin.sln @@ -52,6 +52,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ScriptPlugins", "ScriptPlug Plugins\ScriptPlugins\ParserPlutoniumT4COZM.js = Plugins\ScriptPlugins\ParserPlutoniumT4COZM.js Plugins\ScriptPlugins\GameInterface.js = Plugins\ScriptPlugins\GameInterface.js Plugins\ScriptPlugins\SubnetBan.js = Plugins\ScriptPlugins\SubnetBan.js + Plugins\ScriptPlugins\BanBroadcasting.js = Plugins\ScriptPlugins\BanBroadcasting.js EndProjectSection EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AutomessageFeed", "Plugins\AutomessageFeed\AutomessageFeed.csproj", "{F5815359-CFC7-44B4-9A3B-C04BACAD5836}" diff --git a/Plugins/ScriptPlugins/BanBroadcasting.js b/Plugins/ScriptPlugins/BanBroadcasting.js new file mode 100644 index 00000000..8f82e76c --- /dev/null +++ b/Plugins/ScriptPlugins/BanBroadcasting.js @@ -0,0 +1,48 @@ +const broadcastMessage = (server, message) => { + server.Manager.GetServers().forEach(s => { + s.Broadcast(message); + }); +}; + +const plugin = { + author: 'Amos', + version: 1.0, + name: 'Broadcast Bans', + + onEventAsync: function (gameEvent, server) { + if (!this.enableBroadcastBans) { + return; + } + + if (gameEvent.TypeName === 'Ban') { + let penalty = undefined; + gameEvent.Origin.AdministeredPenalties?.forEach(p => { + penalty = p.AutomatedOffense; + }) + + if (gameEvent.Origin.ClientId === 1 && penalty !== undefined) { + let localization = _localization.LocalizationIndex['PLUGINS_BROADCAST_BAN_ACMESSAGE'].replace('{{targetClient}}', gameEvent.Target.CleanedName); + broadcastMessage(server, localization); + } else { + let localization = _localization.LocalizationIndex['PLUGINS_BROADCAST_BAN_MESSAGE'].replace('{{targetClient}}', gameEvent.Target.CleanedName); + broadcastMessage(server, localization); + } + } + }, + + onLoadAsync: function (manager) { + this.configHandler = _configHandler; + this.enableBroadcastBans = this.configHandler.GetValue('EnableBroadcastBans'); + + if (this.enableBroadcastBans === undefined) { + this.enableBroadcastBans = false; + this.configHandler.SetValue('EnableBroadcastBans', this.enableBroadcastBans); + } + }, + + onUnloadAsync: function () { + }, + + onTickAsync: function (server) { + } +}; diff --git a/Plugins/ScriptPlugins/ParserH1MOD.js b/Plugins/ScriptPlugins/ParserH1MOD.js new file mode 100644 index 00000000..3ba0de8b --- /dev/null +++ b/Plugins/ScriptPlugins/ParserH1MOD.js @@ -0,0 +1,42 @@ +var rconParser; +var eventParser; + +var plugin = { + author: 'fed', + version: 0.1, + name: 'H1-Mod Parser', + isParser: true, + + onEventAsync: function(gameEvent, server) {}, + + onLoadAsync: function(manager) { + rconParser = manager.GenerateDynamicRConParser(this.name); + eventParser = manager.GenerateDynamicEventParser(this.name); + + rconParser.Configuration.CommandPrefixes.Kick = 'kickClient {0} "{1}"'; + rconParser.Configuration.CommandPrefixes.Ban = 'kickClient {0} "{1}"'; + rconParser.Configuration.CommandPrefixes.TempBan = 'kickClient {0} "{1}"'; + rconParser.Configuration.CommandPrefixes.Tell = 'tellraw {0} "{1}"'; + rconParser.Configuration.CommandPrefixes.Say = 'sayraw "{0}"'; + rconParser.Configuration.CommandPrefixes.RConResponse = '\xff\xff\xff\xffprint'; + rconParser.Configuration.Dvar.Pattern = '^ *\\"(.+)\\" is: \\"(.+)?\\" default: \\"(.+)?\\"'; + rconParser.Configuration.Status.Pattern = '^ *([0-9]+) +-?([0-9]+) +(Yes|No) +((?:[A-Z]+|[0-9]+)) +((?:[a-z]|[0-9]){8,32}|(?:[a-z]|[0-9]){8,32}|bot[0-9]+|(?:[0-9]+)) *(.{0,32}) +(\\d+\\.\\d+\\.\\d+.\\d+\\:-*\\d{1,5}|0+.0+:-*\\d{1,5}|loopback|unknown|bot) +(-*[0-9]+) *$'; + rconParser.Configuration.StatusHeader.Pattern = 'num +score +bot +ping +guid +name +address +qport *'; + rconParser.Configuration.Status.AddMapping(102, 4); + rconParser.Configuration.Status.AddMapping(103, 5); + rconParser.Configuration.Status.AddMapping(104, 6); + rconParser.Configuration.WaitForResponse = false; + rconParser.Configuration.DefaultRConPort = 27016; + + eventParser.Configuration.GameDirectory = ''; + + rconParser.Version = 'H1 MP 1.15 build 1251288 Tue Jul 23 13:38:30 2019 win64'; + rconParser.GameName = 11; // H1 + eventParser.Version = 'H1 MP 1.15 build 1251288 Tue Jul 23 13:38:30 2019 win64'; + eventParser.GameName = 11; // H1 + }, + + onUnloadAsync: function() {}, + + onTickAsync: function(server) {} +};