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 that are either placed in ''SDTD_BASE/hooks//.sh'' for global hooks that apply to all instances or ''SDTD_BASE/instances//hooks//.sh'' for hooks that only apply to that specific instance. The folder '''' has to be in exactly the same case as the hook name column in the table below shows it. If you want to use the functions of the management scripts in your hook you can add this to the start of your script: {{{ #!/bin/bash . /usr/local/lib/7dtd/common.sh }}} An example can be found in the greet.sh hook for playerConnect. Note that you have to use Bash as interpreter for your script if you want to use the script functions! An example on how to use '''PHP''' for hooks can be found [http://7daystodie.com/forums/showthread.php?11184-Native-Linux-server-(with-management-scripts)&p=128726&viewfull=1#post128726 on the forum]. If you think a hook for another event could be interesting please [/newticket create a ticket] or [[Author|contact me]]. Currently the following hooks are defined: {{{#!th align=center Hook name }}} {{{#!th align=center Called on event }}} {{{#!th align=center Passed parameters }}} {{{#!th align=center Examples }}} {{{#!th align=center Notes }}} |-------------------------------- {{{#!td align=left playerConnect }}} {{{#!td align=left After a player has connected }}} {{{#!td align=left rowspan=2 1. Instance name 1. Entity ID 1. Nickname 1. Steam ID 1. Client IP 1. Steam Owner ID }}} {{{#!td align=left * [/attachment/wiki/Hooks/greet.sh greet.sh] * [/attachment/wiki/Hooks/greet_sayplayer.sh greet_sayplayer.sh] }}} {{{#!td align=left }}} |-------------------------------- {{{#!td align=left playerDisconnect }}} {{{#!td align=left After a player has disconnected }}} {{{#!td align=left }}} {{{#!td align=left }}} |-------------------------------- {{{#!td align=left serverPreStart }}} {{{#!td align=left Before an instance is started }}} {{{#!td align=left rowspan=4 1. Instance name }}} {{{#!td align=left }}} {{{#!td align=left }}} |-------------------------------- {{{#!td align=left serverPostStart }}} {{{#!td align=left After an instance was started }}} {{{#!td align=left }}} {{{#!td align=left }}} |-------------------------------- {{{#!td align=left serverPreStop }}} {{{#!td align=left Before an instance is stopped }}} {{{#!td align=left }}} {{{#!td align=left }}} |-------------------------------- {{{#!td align=left serverPostStop }}} {{{#!td align=left After an instance was stopped }}} {{{#!td align=left * [/attachment/wiki/Hooks/backup.sh backup.sh] }}} {{{#!td align=left }}} |-------------------------------- {{{#!td align=left serverPreBackup }}} {{{#!td align=left Before the actual backup routine is started }}} {{{#!td align=left }}} {{{#!td align=left }}} {{{#!td align=left Only as global hook, not per instance. }}} |-------------------------------- {{{#!td align=left serverPostBackup }}} {{{#!td align=left After a backup was created }}} {{{#!td align=left 1. Path of new backup folder }}} {{{#!td align=left }}} {{{#!td align=left Only as global hook, not per instance. }}} |-------------------------------- {{{#!td align=left backup }}} {{{#!td align=left After a backup was created }}} {{{#!td align=left 1. Path of new backup folder }}} {{{#!td align=left }}} {{{#!td align=left '''Deprecated:''' Use serverPostBackup instead }}} |-------------------------------- {{{#!td align=left playerSpawned }}} {{{#!td align=left After a player has spawned in the world }}} {{{#!td align=left 1. Instance name 1. Entity ID 1. Steam ID 1. Steam Owner ID 1. Nickname 1. Spawn reason 1. Position }}} {{{#!td align=left }}} {{{#!td align=left Spawning in the world includes deaths, teleports etc. Check the reason if the event is valid for your purpose. }}} |-------------------------------- {{{#!td align=left chat }}} {{{#!td align=left After message was sent in the chat }}} {{{#!td align=left 1. Instance name 1. Sending player's name 1. Message 1. SteamID of sender (if sent by a player, "-non-player-" otherwise) 1. EntityID of sender (if sent by a player, -1 otherwise) 1. Message target type }}} {{{#!td align=left }}} {{{#!td align=left }}} |-------------------------------- {{{#!td align=left gmsg }}} {{{#!td align=left After a game message was sent in the chat (e.g. player killed) }}} {{{#!td align=left 1. Instance name 1. Game message including player name(s) }}} {{{#!td align=left }}} {{{#!td align=left }}} |-------------------------------- {{{#!td align=left remoteCommand }}} {{{#!td align=left After a command was executed from a client }}} {{{#!td align=left 1. Instance name 1. Executed command 1. Player name }}} {{{#!td align=left }}} {{{#!td align=left }}} |-------------------------------- {{{#!td align=left telnetCommand }}} {{{#!td align=left After a command was executed from a telnet session }}} {{{#!td align=left 1. Instance name 1. Executed command 1. Client IP }}} {{{#!td align=left }}} {{{#!td align=left }}}