Merge pull request #251 from SeanWalsh95/autotk-warn-victim

Add option to warn victims of teamkills via AutoTKWarn plugin
This commit is contained in:
Thomas Smyth 2022-07-25 19:55:09 +01:00 committed by GitHub
commit a01889a62b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -11,10 +11,15 @@ export default class AutoTKWarn extends BasePlugin {
static get optionsSpecification() {
return {
message: {
attackerMessage: {
required: false,
description: 'The message to warn players with.',
description: 'The message to warn attacking players with.',
default: 'Please apologise for ALL TKs in ALL chat!'
},
victimMessage: {
required: false,
description: 'The message that will be sent to the victim.',
default: null // 'You were killed by your own team.'
}
};
}
@ -34,8 +39,11 @@ export default class AutoTKWarn extends BasePlugin {
}
async onTeamkill(info) {
if (!info.attacker) return;
await this.server.rcon.warn(info.attacker.steamID, this.options.message);
if (info.attacker && this.options.attackerMessage) {
this.server.rcon.warn(info.attacker.steamID, this.options.attackerMessage);
}
if (info.victim && this.options.victimMessage) {
this.server.rcon.warn(info.victim.steamID, this.options.victimMessage);
}
}
}