Python class for interacting with Project Zomboid servers using RCON
Project description
Zomboid-rcon: Python RCON for Project Zomboid Servers
Version: 1.0.2
Zomboid-rcon enables you to easily communicate with your Project Zomboid servers via RCON. With zomboid-rcon, you can send commands to your server, manage players, and more, all from within your Python script.
Installation
To get started, simply install zomboid-rcon using pip:
pip install zomboid-rcon
Usage
Using zomboid-rcon is easy. Here's a basic example:
from zomboid_rcon import ZomboidRCON
if __name__ == "__main__":
pz = ZomboidRCON(ip='localhost', port=12345, password='myPassword')
command = pz.serverMsg("You dead yet?")
print(command.response)
This example connects to a server running on your local machine and sends the message "You dead yet?".
Zomboid-rcon provides several built-in methods for common server management tasks, such as getting a list of connected players:
from zomboid_rcon import ZomboidRCON
if __name__ == "__main__":
pz = ZomboidRCON(ip='localhost', port=12345, password='myPassword')
print(pz.players().response)
This example prints a list of all players currently connected to the server.
Available Commands
Zomboid-rcon provides built-in methods for the available RCON commands within Project Zomboid.
General Commands
additem("user", "item")
: Items can be found on the PZ wiki: https://pzwiki.net/wiki/Itemsaddvehicle("user")
: Spawns a vehicle.addxp("user", "perk", xp)
: Gives XP to a player.alarm()
: Sounds a building alarm at the admin's position. Must be in a room.changeoption("option", "newOption")
: Changes a server option.chopper()
: Places a helicopter event on a random player.changepwd("pwd", "newPwd")
: Changes your password.createhorde("number")
: Spawns a horde near a player.godmode("user")
: Makes a player invincible.gunshot()
: Makes a gunshot noise near the player.help()
: Brings up the help menu. (Lists native RCON commands. For all zomboid_rcon commands, refer to this list)invisible("user")
: Makes a player invisible to zombies.noclip("user")
: Allows a player to pass through solid objects.quit()
: Saves and quits the server.releasesafehouse()
: Releases a safehouse you own.reloadlua("filename")
: Reload a lua script on the server.reloadoptions()
: Reloads server options.replay("user", [-record | -play | -stop], "filename")
: Records and plays a replay for a moving player.save()
: Saves the current world.sendpulse()
: Toggles sending server performance info to the client.showoptions()
: Shows a list of current server options and values.startrain()
: Starts rain on the server.stoprain()
: Stops rain on the server.teleport("user", "toUser")
: Teleports to a player.teleportto(x, y, z)
: Teleports to certain coordinates.
Moderation Commands
addalltowhitelist()
: Adds all current users connected with a password to the whitelist.adduser("user", "pwd")
: Adds a new user to the whitelist.addusertowhitelist("user")
: Adds a single user connected with a password to the whitelist.removeuserfromwhitelist("user")
: Removes a single user connected with a password to the whitelist.banid("SteamID")
: Bans a Steam ID.unbanid("SteamID")
: Unbans a Steam ID.banuser("user")
: Bans a user.unbanuser("user")
: Unbans a user.checkModsNeedUpdate()
: Indicates whether a mod has been updated. Writes answer to log file.grantadmin("user")
: Gives admin rights to a user.removeadmin("user")
: Removes admin rights to a user.kickuser("user")
: Kicks a user from the server.players()
: Lists all connected players.servermsg("message")
: Broadcast a message to all players. (Spaces are replaced with underscores for compatibility)setaccesslevel("user", [admin | moderator | overseer | gm | observer])
: Set the access/permission level of a player.voiceban("user", [-true | -false])
: Ban a user from using the voice feature.
Command not listed?
You can execute any custom command using the command method:
pz.command("command", "arg1", "arg2", "etc")
Demonstration
Known Issues
Please note that zomboid-rcon uses the timeout_decorator package, which is currently only compatible with Unix/Linux systems. As a result, timeouts may cause errors on Windows machines. We are actively working on finding an alternative solution for Windows users.
Contributing
We welcome contributions from anyone! If you would like to contribute to the project, please open an issue or submit a pull request on Github.
License
Zomboid-rcon is licensed under the GPL-3.0 license.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for zomboid_rcon-1.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 538a0bd830abfc5e706eb813241db6c60e3de3a6c9d998418cd966df66ad3d85 |
|
MD5 | eb832efe391f7a22f5eeeda0b7ba4536 |
|
BLAKE2b-256 | ec58f18b75648a4b680f1eb796ff0abaa50d084904882d81a8736e7f21b19162 |