Hi Survivors,
First, I would like to say that I am neither a developer in the true sense of the word, nor a fully trained administrator or anything like that. Everything in the following I have taught myself, and that only for the reason that it is fun for me.
So if you discover technical gaps or find out that things are done differently nowadays, feel free to contact me, because I like to take advice that helps me to have even more fun and joy with this project.
But now back to the topic.
My plan is, that I show you ( because I enjoy it ) in this post regularly some nice things, and how I implemented them with PHP, bash, XML, ... this post should be the introduction.
If you have any questions, of course feel free to ask, that's why we are here.
What is it actually about?
Nowadays, running a server is basically very simple. Download, adjust the configuration and maybe a few mods for optics and special items purely, start and ready. But it can be so much better and with so much more functionality, because 7D2D can do great things with a few small tools and the API.
What can a server look like?
Operating system: Linux ( I prefer Ubuntu ).
This includes then for the operation in the operating system installed
Kernel-Mods
Besides all the mods that make the game itself prettier, there are mods that drastically expand the range of functions and should therefore be mandatory.
Allocs Server-Fixes and Live-Map ( https://7dtd.illy.bz/wiki/Server fixes#Download )
Without this mod(s) basically nothing would work, because without the API all efforts with PHP or bash would be waste. So the API is the core for everything else.
CPM - CSMM Patron's Mod ( https://docs.csmm.app/en/CPM/ )
This mod provides a number of useful functions that can be used in the console. Among other things, teleports, spawning of hordes or functions that allow the player to pack items in the backpack and much more.
7dtd-ServerTools ( https://github.com/dmustanger/7dtd-ServerTools )
Similar to CPM, the server tools provide a lot of functionality to help you run the server and make it even cooler.
From my point of view, the biggest strength of the server tools is the management of the zones via live XMLs. Moreover, it is OpenSource.
There are certainly a few more mods in this direction, but with these three I have had the best experience so far.
All beginnings are difficult
To run the first command with PHP or bash it is necessary to set one important thing. Namely, the API token.
This must be done in the webpermissions.xml which is usually located in the main directory of the saves.
Here is an example:
<?xml version="1.0" encoding="UTF-8"?>
<webpermissions>
<admintokens>
<token name="myadmintoken" token="verysecrettoken" permission_level="0"/>
</admintokens>
<permissions>
<!-- permissions for the map -->
</permissions>
</webpermissions>
This token opens up endless possibilities with the help of the API. At this point, it is important to choose the right 'permission_level', because some things only work correctly with level = 0 (which is the admin level).
Once that is set, you immediately have the ability to send commands through the API using Curl, a browser, or even Postman.
Example in bash for displaying the help:
Once that is done, and it works, the rest is pretty easy to implement in vanilla PHP.
Simple example in PHP:
$url = 'http://<serverip>:<mapport>/api/executeconsolecommand?adminuser=myadmintoken&admintoken=verysecrettoken&raw=true&command=' . urlencode('help');
$ch = curl_init();
curl_setopt_array($ch, [CURLOPT_RETURNTRANSFER => true, CURLOPT_URL => $url]);
$result = curl_exec($ch);
curl_close($ch);
Important at this point is to make a 'urlencode' for the actual command, because many commands have additional parameters and already a space can become a problem.
Now you can do almost everything you want or what is possible with console commands.
This includes, for example (I will describe all of them little by little in following posts):
but in addition you can do other great things with PHP like creating XML files that are otherwise very complex.
Like for example entitygroups or tooltips.
This should be enough to get you started. As the next post, I will try to explain how to make an own event, similar to the Horde Night.
CU and gladly asks questions. You are welcome ...
First, I would like to say that I am neither a developer in the true sense of the word, nor a fully trained administrator or anything like that. Everything in the following I have taught myself, and that only for the reason that it is fun for me.
So if you discover technical gaps or find out that things are done differently nowadays, feel free to contact me, because I like to take advice that helps me to have even more fun and joy with this project.
But now back to the topic.
My plan is, that I show you ( because I enjoy it ) in this post regularly some nice things, and how I implemented them with PHP, bash, XML, ... this post should be the introduction.
If you have any questions, of course feel free to ask, that's why we are here.

What is it actually about?
Nowadays, running a server is basically very simple. Download, adjust the configuration and maybe a few mods for optics and special items purely, start and ready. But it can be so much better and with so much more functionality, because 7D2D can do great things with a few small tools and the API.
What can a server look like?
Operating system: Linux ( I prefer Ubuntu ).
This includes then for the operation in the operating system installed
- PHP (best in a 7 version) in the client version (PHP-CLI)
- xmlstarlet (to read or edit XML files in bash)
- LinuxGSM ( https://linuxgsm.com/servers/sdtdserver/ ) great tool to install, update, run the server
Kernel-Mods
Besides all the mods that make the game itself prettier, there are mods that drastically expand the range of functions and should therefore be mandatory.
Allocs Server-Fixes and Live-Map ( https://7dtd.illy.bz/wiki/Server fixes#Download )
Without this mod(s) basically nothing would work, because without the API all efforts with PHP or bash would be waste. So the API is the core for everything else.
CPM - CSMM Patron's Mod ( https://docs.csmm.app/en/CPM/ )
This mod provides a number of useful functions that can be used in the console. Among other things, teleports, spawning of hordes or functions that allow the player to pack items in the backpack and much more.
7dtd-ServerTools ( https://github.com/dmustanger/7dtd-ServerTools )
Similar to CPM, the server tools provide a lot of functionality to help you run the server and make it even cooler.
From my point of view, the biggest strength of the server tools is the management of the zones via live XMLs. Moreover, it is OpenSource.
There are certainly a few more mods in this direction, but with these three I have had the best experience so far.
All beginnings are difficult

To run the first command with PHP or bash it is necessary to set one important thing. Namely, the API token.
This must be done in the webpermissions.xml which is usually located in the main directory of the saves.
Here is an example:
<?xml version="1.0" encoding="UTF-8"?>
<webpermissions>
<admintokens>
<token name="myadmintoken" token="verysecrettoken" permission_level="0"/>
</admintokens>
<permissions>
<!-- permissions for the map -->
</permissions>
</webpermissions>
This token opens up endless possibilities with the help of the API. At this point, it is important to choose the right 'permission_level', because some things only work correctly with level = 0 (which is the admin level).
Once that is set, you immediately have the ability to send commands through the API using Curl, a browser, or even Postman.
Example in bash for displaying the help:
Code:
curl http://<serverip>:<mapport>/api/executeconsolecommand?adminuser=myadmintoken&admintoken=verysecrettoken&raw=true&command=help
Once that is done, and it works, the rest is pretty easy to implement in vanilla PHP.
Simple example in PHP:
$url = 'http://<serverip>:<mapport>/api/executeconsolecommand?adminuser=myadmintoken&admintoken=verysecrettoken&raw=true&command=' . urlencode('help');
$ch = curl_init();
curl_setopt_array($ch, [CURLOPT_RETURNTRANSFER => true, CURLOPT_URL => $url]);
$result = curl_exec($ch);
curl_close($ch);
Important at this point is to make a 'urlencode' for the actual command, because many commands have additional parameters and already a space can become a problem.
Now you can do almost everything you want or what is possible with console commands.
This includes, for example (I will describe all of them little by little in following posts):
- spawn zombies or other entities (also in hordes)
- teleport players
- give items to players
- apply buffs and also query them
- show tooltips
- play sounds
- send messages to the chat
- monitor and query the log and also the chat
- determine player positions
- open up windows
- execute twitch commands
- create own events
- show infos in a ticker way with tooltips
- give quests to the player
- watch server events like:
join/left
- die
- kill
- levelup
but in addition you can do other great things with PHP like creating XML files that are otherwise very complex.
Like for example entitygroups or tooltips.
This should be enough to get you started. As the next post, I will try to explain how to make an own event, similar to the Horde Night.
CU and gladly asks questions. You are welcome ...