Skip to content

Commit

Permalink
Merge pull request #251 from SeanWalsh95/autotk-warn-victim
Browse files Browse the repository at this point in the history
Add option to warn victims of teamkills via AutoTKWarn plugin
  • Loading branch information
Thomas-Smyth authored Jul 25, 2022
2 parents 77fbdd9 + 6b48502 commit a01889a
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions squad-server/plugins/auto-tk-warn.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.'
}
};
}
Expand All @@ -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);
}
}
}

0 comments on commit a01889a

Please sign in to comment.