Project Zomboid – RCON setup server & commands

Project Zomboid – RCON setup server & commands 1 - steamlists.com
Project Zomboid – RCON setup server & commands 1 - steamlists.com

Simple RCON setup and the relevant commands for Project Zomboid.
 
 

Initial Setup

You will need:
 

 
Navigate to and open your server ini file (servertest.ini or serveroptions.ini at the time of writing, whichever you find), in my case on Windows it is located at C:\Users\[username]\Zomboid\Server\servertest.ini. On Linux it may be located at ~/zomboid/server/servertest.ini.
 
 
In the server configuration ini file there will be 2 fields to change:
 

  • RCONPort=16261
  • RCONPassword=give_me_a_password

 
I recommend changing the port for additional security through obscurity (but remember it!) however you may also leave it as is. Remember to port-forward the port if you do change it! Be sure to change the RCON password to your own. Save the file and re-launch your server if it is running.
 
 
Once the server is up you can test the RCON commands in the next step.
 
 
 

RCON Commands & Usage

I have included the full list of commands a bit farther below, however we are really only interested in two commands: servermsg and save.
 
 

CommandDescription
servermsgBroadcast a message to all connected players. Use: /servermsg \”text\”
saveSaves the current game world

 
Go to the location of your RCON-CLI install and it should contain an executable, on Windows this is rcon.exe. You will need to use CMD/terminal to pass server commands to rcon.exe, which in turn will attempt to send the commands to the server for execution.
 
 
Open CMD in the directory that rcon.exe is located. Now we can execute RCON commands. We will now attempt to send a server message. The syntax for rcon.exe is as follows:
 
 

rcon -a your_ip_address:your_port -p your_password "servermsg \"server is restarting in 5min\""

 
which in my example, translates to:
 
 

rcon -a 127.0.0.1:16261 -p mystrongpassword "servermsg \"server is restarting in 5min\""

 
We are telling rcon.exe that our address is 127.0.0.1:16261 (ip:port), then we tell it the password to use, followed by the command and the commands input. So servermsg has an input of your desired text to broadcast. Be careful with the speech marks and slashes, they are necessary.
 
 
If you were to execute a command without a required input, e.g. save, it would be as follows:
 
 

rcon -a 127.0.0.1:16261 -p mystrongpassword "save"

 
 
 

Putting it all together

Managed Server Hosts

 
If you are using a hosting service such as GPORTAL or GTX GAMING these often provide a service for automatically rebooting your server. It is necessary to utilize this feature if you aren’t using a self-hosted server or VPS.
 
 
In this case you will only need to send servermsg commands up until the time that your hosts scheduler is set to auto reboot the server. So let’s assume we set our server host of GTX GAMING to auto reboot our server every hour. We would need to send messages just before every hour in order to warn of the impending reboot. E.g.
 
 

rcon -a 127.0.0.1:16261 -p mystrongpassword "servermsg \"server is restarting in 5min\""
sleep 60
rcon -a 127.0.0.1:16261 -p mystrongpassword "servermsg \"server is restarting in 4min\""
sleep 60
rcon -a 127.0.0.1:16261 -p mystrongpassword "servermsg \"server is restarting in 3min\""
sleep 60
rcon -a 127.0.0.1:16261 -p mystrongpassword "servermsg \"server is restarting in 2min\""
sleep 60
rcon -a 127.0.0.1:16261 -p mystrongpassword "servermsg \"server is restarting in 1min\""
sleep 40
rcon -a 127.0.0.1:16261 -p mystrongpassword "servermsg \"server is restarting NOW!!!\""
sleep 2
rcon -a 127.0.0.1:16261 -p mystrongpassword "save"

 
 
Notice we don’t actually send a reboot command, because the hosts scheduler does this for us.
 
 

Self Hosting

 
If you are using a VPS or your own computer then you will likely have a different script entirely which sends restart message alerts followed by actually rebooting the game server.
 
 
You may use the same code as above for the warning messages and saving the server state, however your restart will have to be scheduled via Windows Task Scheduler or in Linux as a CRON job.
 
 
 

Server Commands for RCON

CommandDescription
addalltowhitelistAdd all the current users who are connected with a password to the whitelist, so their account is protected.
additemGive an item to a player. If no username is given then you will receive item. Count is optional. Use: /additem \”username\” /”module.item/” – [22module.item]  count, ex : additem rj Base.Axe 1
adduserUse this command to add a new user to a whitelisted server. Use: /adduser \”username\” \”pwd\” ex: adduser rj 12345
addusertowhitelistAdd a user connected with a password to the whitelist, so their account is protected. Use: /addusertowhitelist \”username\” ex: addusertowhitelist rj
addvehicleSpawn a vehicle. Use: /addvehicle \”script\” \”user or x,y,z\”, ex: addvehicle Base.VanAmbulance rj
addxpGive experience points to a player. Use: /addxp \”playername\” perkname=xp, ex: addxp rj Woodwork=2
alarmSound a building alarm at the Admin’s position. (Must be in a room.)
banidBan a SteamID. Use: banid SteamID
banuserBan a user. Add a -ip to also ban the IP. Add a -r \”reason\” to specify a reason for the ban. Use: /banuser \”username\” -ip -r \”reason\”. For example: banuser rj -ip -r spawn kill
changeoptionChange a server option. Use: /changeoption optionName \”newValue\” ex: changeoption SleepAllowed true
chopperPlace a helicopter event on a random player
createhordeSpawn a horde near a player. Use : /createhorde count \”username\”, ex: createhorde 150 rj, username is optional except from the server console.
createhorde2Unknown (ERROR: Missing translation “UI_ServerOptionDesc_CreateHorde2”)
godmodeMake a player invincible. No username set will toggle self-invincibility. Use: /godmode \”username\” -value, ex godmode rj -true (could be -false)
gunshotPlace gunshot sounds on a random player
helpOutputs a list and description of admin commands
invisibleMake a player invisible to zombies. No username provided will toggle invisibility on yourself. Use: /invisible \”username\” -value, ex: invisible rj -true (could be -false).
kickuserKick a user. Add a -r \”reason\” to specify a reason for the kick. Use: /kickuser \”username\” -r \”reason\”
noclipMakes a player pass through walls and structures. Toggles with no value. Use: /noclip \”username\” -value, ex: noclip rj -true (could be -false)
playersList all connected players
quitSave and shut down the server
releasesafehouseRelease a safehouse you own. Use: /safehouse release
reloadluaReload a Lua script. Use: /reloadlua \”filename\”
reloadoptionsReload server options (servertest.ini) and send to the clients. Useful for implementing game setting changes while players are connected.
removeuserfromwhitelistRemove a user from the whitelist. Use: /removeuserfromwhitelist \”username\”
removezombiesCommand name self-explanatory, but have not tested. (ERROR: Missing translation “UI_ServerOptionDesc_RemoveZombies”)
replayRecord and play replay for moving player. Use: /replay \”playername\” -record\-play\-stop \filename.\ Example: /replay user1 -record test.bin
saveSaves the current game world
sendpulseToggle sending server performance info to this client. Use: /sendpulse
servermsgBroadcast a message to all connected players. Use: /servermsg \”text\”
setaccesslevelSet access level of a player. Current levels: admin, moderator, overseer, gm, observer. E.g. setaccesslevel userName admin / Note: To remove any access level, use “none” in place of admin.
showoptionsShow the list of current server options and values.
startrainStart rain on the server
stoprainStop rain on the server
teleportTeleport to a player. Use: /teleport \”playername\” or /teleport \”player1\” \”player2\”, ex /teleport \”rj\” or /teleport \”rj\” \”toUser\”
teleporttoTeleport to coordinates. Use: /teleportto x,y,z, ex /teleportto 100098,189980,0
unbanidUnban a SteamID. Use: /unbanid SteamID
unbanuserUnban a player. Use : /unbanuser \”username\”
voicebanBlock voice from user \”username\”. Use : /voiceban \”username\” -value, ex /voiceban \”rj\” -true (could be -false)

 
 

Written by RIDAI

 
 
I hope you enjoy the Guide we share about Project Zomboid – RCON setup server & commands; if you think we forget to add or we should add more information, please let us know via commenting below! See you soon!
 
 


Be the first to comment

Leave a Reply

Your email address will not be published.


*