wiki:Hooks

Version 5 (modified by Alloc, 7 years ago) (diff)

--

Hooks are a way to add additional behaviour to the scripts. They are basically custom scripts that are called upon specific events. For example one could define a hook which is called on player connects and then send a message in the in-game chat to greet the new player.

All hooks have to executable files in SDTD_BASE/<name of hook>/<any name>.sh. The folder <name of hook> has to be in exactly the same case as the hook name column in the table below shows it.

If you think a hook for another event could be interesting please create a ticket or contact me.

Currently the following hooks are defined:

Hook name

Called on event

Passed parameters

playerConnect

After a player has connected

  1. Instance name
  2. Player ID
  3. Entity ID
  4. Nickname
  5. Steam ID

playerDisconnect

After a player has disconnected

serverPreStart

Before an instance is started

  1. Instance name

serverPostStart

After an instance was started

serverPreStop

Before an instance is stopped

serverPostStop

After an instance was stopped

backup

After a backup was created

  1. Path of new backup folder

chat

After message was sent in the chat

  1. Instance name
  2. Message including player name

Attachments (3)

Download all attachments as: .zip