Broadcast bans (Anti-cheat and manuals) script plugin
This commit is contained in:
parent
83a469cae3
commit
31da5d352e
@ -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}"
|
||||
|
48
Plugins/ScriptPlugins/BanBroadcasting.js
Normal file
48
Plugins/ScriptPlugins/BanBroadcasting.js
Normal file
@ -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) {
|
||||
}
|
||||
};
|
Loading…
Reference in New Issue
Block a user