How to run a command
PZwiki is short on the rules, and they are worth knowing before the list. Commands work either in the server console window or in game, where each one starts with a forward slash. In game you need admin status. Usernames and most text values go in double quotes, as in all of PZwiki's examples. Some values are case-sensitive: PZwiki's example is that Base.Axe works and base.axe does not.
When you are unsure of a command's exact form on your build, ask the server. /help lists every command, and /help followed by a command name shows that command's help text.
The first admin is the account the server creates on its first start, when it asks for an admin password. Our Project Zomboid server setup guide walks through that first start, the ports and the settings files.
- In game: /servermsg "Restart in 5 minutes"
- Server console: the same command without the slash
- /help lists all commands; /help "command" explains one
- Item IDs are case-sensitive: Base.Axe, not base.axe
Access levels and staff
Rights are given with one command, setaccesslevel, which takes a username and a level. PZwiki lists the current levels as user, priority, observer, gm, moderator and admin. Giving each helper their own level on their own account is better than sharing the admin login, because you can take it away again without changing a password everyone knows.
PZwiki lists the levels without describing what each one may do, so try a helper's everyday commands on their level before you rely on them. To take rights away, set the player back to user.
setpassword changes a user's password, which helps when a player has forgotten theirs.
- /setaccesslevel "rj" "moderator": give a player a level
- /setaccesslevel "rj" "user": take the rights away again
- Levels: user, priority, observer, gm, moderator, admin
- /setpassword "username" "newpassword": reset a player's password
Players, whitelist and bans
/players lists everyone connected, which is where to start when you need an exact username. Kicking and banning both accept a reason with -r, and banuser also bans the player's IP address when you add -ip. PZwiki's table names the kick command kick but writes its usage as /kickuser, so if one form is refused on your build, use the other, or check with /help.
There are three ways to ban: by username, by SteamID with banid, and by IP with banip, each with a matching unban command.
On a server that is closed to new accounts, adduser creates an account with a password, and removeuserfromwhitelist takes one off. addsteamid and removesteamid manage the list of SteamIDs allowed on the server. voiceban blocks a player's voice chat without removing them.
- /kickuser "username" -r "reason": remove a player
- /banuser "rj" -ip -r "spawn kill": ban a user and their IP, with a reason
- /banid SteamID and /unbanid SteamID: ban and unban by SteamID
- /banip IP and /unbanip IP: ban and unban an address
- /unbanuser "username": lift a username ban
- /adduser "username" "password" and /removeuserfromwhitelist "username"
- /voiceban "rj" -true: block a player's voice chat, -false to undo
Saving, stopping and changing server options
Two commands keep the world safe. /save saves the current world, and /quit saves and then stops the server, which makes it the way to shut the server down rather than closing the console window.
Server options can be read and changed without opening the ini file. /showoptions prints every current option and its value, and /changeoption sets one, as in /changeoption optionName "newValue". If you edit the ini file by hand instead, /reloadoptions reloads the server options and sends them to the players who are connected.
For modded servers, /checkModsNeedUpdate reports whether a mod has been updated and writes its answer to the log file. When a Workshop mod updates while the server runs, players get version errors at login, which our Workshop item version fix covers step by step. /servermsg broadcasts a message to everyone, the polite first step before any restart.
- /save: save the world now
- /quit: save and stop the server
- /showoptions and /changeoption optionName "newValue"
- /reloadoptions: reload the options file and send it to players
- /checkModsNeedUpdate: writes the answer to the log file
- /servermsg "My Message": broadcast to everyone
Teleporting, items and helping players
Most admin time goes on fixing things for players, and these are the commands for it. /teleport takes you to a player, or moves the first player to the second when you give two names. /teleportto takes coordinates written x,y,z.
additem gives an item by its full ID with an optional count, and gives it to you if you leave the username out. addxp gives experience in a skill, written as the perk name, an equals sign and the amount. addvehicle spawns a vehicle by its script name next to a player or at coordinates, and addkey gives a key by its ID.
Three toggles take -true or -false: godmode makes a player invincible, invisible makes them invisible to zombies, and noclip lets them pass through walls. PZwiki notes a spelling error in the game: both godmod and godmode work. Each also has a version for another player, such as godmodeplayer and invisibleplayer.
- /teleport "rj" or /teleport "rj" "toUser"
- /teleportto 10000,11000,0
- /additem "rj" Base.Axe 5 and /removeitem Base.Axe 5
- /addxp "rj" Woodwork=2
- /addvehicle "Base.VanAmbulance" "rj"
- /godmode "rj" -true, /invisible "rj" -true, /noclip "rj" -true
Weather, hordes and events
The last group changes the world around the players, for events or for testing a base's defences. /createhorde spawns a number of zombies near a player, and around you if you leave the name out, though the name is required from the server console. /chopper places a helicopter event on a random player and /gunshot a gunshot sound on a random player. /alarm sounds a building alarm at your position and only works inside a room.
Weather has its own set. /startrain takes an optional intensity from 1 to 100, /startstorm an optional duration in game hours, and /stoprain and /stopweather end them. /lightning and /thunder target a player, with the name again required from the console.
Use these with care on a server people play seriously: a horde of 150 is an event for one group and the end of the run for another. When you are ready to host a world of your own, the Project Zomboid game page shows what a server with full console access includes.
- /createhorde 150 "rj": spawn a horde near a player
- /chopper and /gunshot: events on a random player
- /alarm: building alarm at your position, inside a room
- /startrain 50, /startstorm 2, /stoprain, /stopweather
- /lightning "username" and /thunder "username"