OpenTTD has the option to run one of a number of scripts when it starts up.
The scripts should comprise a regular text file that's been renamed to whatever is relevent (see below). They should be put into the "scripts" directory in your OTTD install.
Local Scripts
autoexec.scr - This Script is executed on gamestart [all - use this for custom aliases per ex.]
Network Scripts
on_client.scr - This Script is executed whenever you join a server
on_server_connect.scr - This script will be executed by the server whenever a client connects (useful for motd)
These scripts should be used to set the servers port/ip and/or server optimization settings/patches.
pre_server.scr is executed before the servers tcp stack is started - in-game server only.
pre_dedicated.scr is executed before the servers tcp stack is started - Dedicated server only.
These network scripts should be used to set the servers name, password and so on.
on_server.scr is executed after starting a server - Both dedicated and in-game servers.
on_dedicated.scr is additionally executed after starting a server - dedicated serveronly.
game_start.scr is additionally executed after starting a game, If you want to start_ai in a dedicated server, config it here.