SquadJS/squad-server/plugins
2021-03-08 18:51:08 +00:00
..
auto-kick-unassigned.js ESLint & README Generation 2021-01-12 23:31:59 +00:00
auto-tk-warn.js Fix error in auto-tk-warn 2021-01-28 20:13:53 +00:00
base-plugin.js Fix out of date version system 2020-12-08 17:16:32 +00:00
chat-commands.js Added toLowerCase to address case sensitive config 2021-02-25 16:53:54 -05:00
db-log.js ESLint & README Generation 2021-03-05 17:32:31 +00:00
discord-admin-broadcast.js DBLog Plugin 2020-12-08 12:13:53 +00:00
discord-admin-cam-logs.js Track admin cam usage over RCON instead of logs 2021-02-03 19:17:25 +00:00
discord-admin-request.js DBLog Plugin 2020-12-08 12:13:53 +00:00
discord-base-plugin.js Add SCBL plugin 2021-01-07 20:52:55 +00:00
discord-chat.js DBLog Plugin 2020-12-08 12:13:53 +00:00
discord-debug.js DBLog Plugin 2020-12-08 12:13:53 +00:00
discord-fob-hab-explosion-damage.js Add plugin to log FOB/HAB explosion damage 2021-03-08 18:51:08 +00:00
discord-placeholder.js Fix for the placeholder plugin 2021-03-05 17:45:45 +01:00
discord-rcon.js DBLog Plugin 2020-12-08 12:13:53 +00:00
discord-round-winner.js Fix round winner layer name 2021-02-03 20:44:55 +00:00
discord-server-status.js Use current layer and not history in status 2021-02-27 10:24:44 +00:00
discord-subsystem-restarter.js Forget return after condition is ment 2021-01-01 19:40:52 +01:00
discord-teamkill.js DBLog Plugin 2020-12-08 12:13:53 +00:00
index.js Sort plugins alphabetically 2021-01-30 17:01:52 +00:00
intervalled-broadcasts.js Intervalled Broadcasts on the line 47 causes a crash because of undefined. The code should have been this.options.broadcasts instead of this.broadcasts 2021-02-25 21:26:40 +01:00
readme.md Rename readme 2021-01-07 16:38:59 +00:00
scbl-info.js Replacing githubraw with CDN(jsDelivr) 2021-03-05 17:00:38 +01:00
seeding-mode.js Making the code more efficient and light 2021-03-08 12:54:45 +01:00
socket-io-api.js Adding Event Broadcast To The Plugin SocketIOAPI 2021-03-07 23:45:53 +01:00
team-randomizer.js DBLog Plugin 2020-12-08 12:13:53 +00:00

Creating Your Own Plugins

To create your own plugin you need a basic knowledge of JavaScript.

Typical plugins are functions that take the server as an argument in order to allow the plugin to access information about the server or manipulate it in some way:

function aPluginToLogServerID(server){
  console.log(server.id);
}

Stored in the server object are a range of different properties that store information about the server.

  • id - ID of the server.
  • serverName - Name of the server.
  • maxPlayers - Maximum number of players on the server.
  • publicSlots - Maximum number of public slots.
  • reserveSlots - Maximum number of reserved slots.
  • publicQueue - Length of the public queue.
  • reserveQueue - Length of the reserved queue.
  • matchTimeout - Time until match ends?
  • gameVersion - Game version.
  • layerHistory - Array history of layers used with most recent at the start. Each entry is an object with layer info in.
  • currentLayer - The current layer.
  • nextLayer - The next layer.
  • players - Array of players. Each entry is a PlayerObject with various bits of info in.

One approach to making a plugin would be to run an action periodically, in the style of the original SquadJS:

function aPluginToLogPlayerCountEvery60Seconds(server){
  setInterval(() => {
    console.log(server.players.length);
  }, 60 * 1000);
}

A more common approach in this version of SquadJS is to react to an event happening:

function aPluginToLogTeamkills(server){
  server.on('TEAMKILL', info => {
    console.log(info);
  });
}

Various actions can be completed in a plugin. Most of these will involve outside system, e.g. Discord.js to run a Discord bot, so they are not documented here. However, you may run RCON commands using server.rcon.execute("Command");.

If you're struggling to create a plugin, the existing plugins are a good place to go for examples or feel free to ask for help in the Squad RCON Discord.