2020-05-18 13:40:47 -05:00
|
|
|
import { LOG_PARSER_TEAMKILL } from 'squad-server/events/log-parser';
|
|
|
|
|
2020-08-20 15:21:03 -05:00
|
|
|
export default {
|
|
|
|
name: 'auto-tk-warn',
|
2020-08-22 08:32:39 -05:00
|
|
|
description:
|
|
|
|
'The `auto-tk-warn` plugin will automatically warn players in game to apologise for teamkills when they ' +
|
|
|
|
'teamkill another player.',
|
2020-05-18 13:40:47 -05:00
|
|
|
|
2020-08-22 10:54:05 -05:00
|
|
|
defaultEnabled: true,
|
2020-08-20 15:21:03 -05:00
|
|
|
optionsSpec: {
|
|
|
|
message: {
|
|
|
|
type: 'String',
|
|
|
|
required: false,
|
|
|
|
default: 'Please apologise for ALL TKs in ALL chat!',
|
|
|
|
description: 'The message to warn players with.'
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
init: async (server, connectors, options) => {
|
|
|
|
server.on(LOG_PARSER_TEAMKILL, (info) => {
|
|
|
|
// ignore suicides
|
|
|
|
if (info.attacker.steamID === info.victim.steamID) return;
|
|
|
|
server.rcon.execute(`AdminWarn "${info.attacker.steamID}" ${options.message}`);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
};
|