4 OpenTTD supports scripts.
7 - 'autoexec.scr' is executed on gamestart [all - use this for custom aliases per ex.]
10 should be used to set client optimization settings:
11 - 'on_client.scr' is executed when you join a server [all clients]
13 - 'on_server_connect.scr' is executed on the server when a client has joined (MOTD)
15 should be used to set the servers port/ip and/or server optimization settings/patches:
16 - 'pre_server.scr' is executed before the servers tcp stack is started [in-game only]
17 - 'pre_dedicated.scr' is executed before the servers tcp stack is started [dedicated only]
19 should be used to set the servers name, password and so on:
20 - 'on_server.scr' is executed after starting a server [dedicated and in-game]
21 - 'on_dedicated.scr' is additionally executed after starting a server [dedicated only]
23 For examples how a script can look, check the .example examples.