2020-09-09 03:31:48 -05:00
|
|
|
import { TEAMKILL } from 'squad-server/events';
|
2020-05-18 13:40:47 -05:00
|
|
|
|
2020-08-20 15:21:03 -05:00
|
|
|
export default {
|
|
|
|
name: 'auto-tk-warn',
|
2020-08-22 08:32:39 -05:00
|
|
|
description:
|
2020-09-10 08:17:27 -05:00
|
|
|
'The <code>auto-tk-warn</code> 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: {
|
|
|
|
required: false,
|
2020-09-10 08:17:27 -05:00
|
|
|
description: 'The message to warn players with.',
|
2020-08-20 15:21:03 -05:00
|
|
|
default: 'Please apologise for ALL TKs in ALL chat!',
|
2020-09-10 08:17:27 -05:00
|
|
|
example: 'Test'
|
2020-08-20 15:21:03 -05:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2020-09-02 07:20:44 -05:00
|
|
|
init: async (server, options) => {
|
2020-09-09 03:31:48 -05:00
|
|
|
server.on(TEAMKILL, (info) => {
|
2020-08-20 15:21:03 -05:00
|
|
|
// ignore suicides
|
|
|
|
if (info.attacker.steamID === info.victim.steamID) return;
|
2020-09-02 07:20:44 -05:00
|
|
|
server.rcon.warn(info.attacker.steamID, options.message);
|
2020-08-20 15:21:03 -05:00
|
|
|
});
|
|
|
|
}
|
|
|
|
};
|