SquadJS/squad-server/plugins
2023-02-15 18:08:37 -05:00
..
auto-kick-unassigned.js ESLint & README Generation 2021-01-12 23:31:59 +00:00
auto-tk-warn.js dafault victim message to disabled 2022-07-12 18:11:28 -04:00
base-plugin.js Fix out of date version system 2020-12-08 17:16:32 +00:00
cbl-info.js CBL v2 2022-06-28 11:03:41 -07:00
chat-commands.js Added toLowerCase to address case sensitive config 2021-02-25 16:53:54 -05:00
db-log.js update dblog name when player name changes 2023-02-15 18:08:37 -05: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 Added Admins Online to admin-request module 2021-03-15 16:07:53 -04:00
discord-base-message-updater.js Fix support for multiple servers to discord-base-message-updater plugin 2021-05-17 22:15:04 +01:00
discord-base-plugin.js Apply codestyle 2023-01-29 12:27:38 +01: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 Fix typo in DiscordFOBHABExplosionDamage plugin 2021-03-08 19:13:54 +00:00
discord-killfeed.js Updating SCBL references to CBL - Community Ban List 2022-06-28 10:00:52 -07: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-roundended.js Update discord-roundended.js 2022-10-06 23:08:04 -04:00
discord-server-status.js Changed layer images to new hosting location. 2021-10-29 21:44:21 -04:00
discord-squad-created.js Updating SCBL references to CBL - Community Ban List 2022-06-28 10:00:52 -07:00
discord-subsystem-restarter.js Forget return after condition is ment 2021-01-01 19:40:52 +01:00
discord-teamkill.js Updating SCBL references to CBL - Community Ban List 2022-06-28 10:00:52 -07:00
fog-of-war.js Add FogOfWar plugin 2021-04-07 16:48:00 +01:00
index.js Revamp DiscordServerStatus plugin 2021-03-09 20:31:33 +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 Update SquadJS repository url 2022-04-15 13:15:21 +01:00
seeding-mode.js Making the code more efficient and light 2021-03-08 12:54:45 +01:00
socket-io-api.js Add event SQUAD_CREATED 2021-10-26 23:12:04 +02: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.