I play CS:GO with my roommate against bots and we like to make custom games, say 2 CT's (us) vs 5 T's. Doing this in CS:GO requires some console commands. My question is, can we batch these commands somehow, or make a script that runs on server startup? The goal being to jump right into our custom setup without typing in a bunch of console commands and then restarting the server by hand.
LorenzoDB was on track although probably a touch more complex than it needed to be.
The most straightforward solution would be to create a config file with a custom name. And inside of that config file put all the command you would manually type.
Then when you want to play, load up CS:GO and do
exec my_script.cfg in the console. It'll just run all of your commands batched and you should be good to go.
You could also bind it to a button on your keyboard (say an unused f key or something, but I'd lean towards a script you'd execute (per my first suggestion). You probably only need to run it at the start and then the match would just go from there.
You need to have a file called server.cfg
The server.cfg file can be found under \csgo\cfg. (make it if it doesn't exist)'
Here is an example of a very simple server.cfg file:
hostname "Counter-Strike: Global Offensive Dedicated Server"
sv_password "" //Only set this if you intend to have a private server!
From here, you can add additional commands to customize your server's game play experience:
mp_freezetime 5 //The amount of time players are frozen to buy items
mp_join_grace_time 15 //The amount of time players can join teams after a round has started
mp_match_end_restart 0 // Defines whether a map should be restarted after a game has ended
sv_cheats 0 //This should always be set, so you know it's not on
sv_lan 0 //This should always be set, so you know it's not on
//**The bot commands below are mostly default with the exception of
//**The following commands manage kicks and bans
Set every command you want to use in this file and it will load at the start of the server.
For what you want I think it is
mp_autobalance 0; add_bot_T;add_bot_T;add_bot_T;add_bot_T;add_bot_T;sv_restart 1
If you don't want to set all the command in this file, make another file "GameModeName".cfg and type in the server.cfg file: "exec 'GameModeName".cfg