Because of the hotfix patch of 42.20.4 and the knee-jerk removal of loadstring for "security-reasons", This anti-cheat is no-longer possible to run. If you need to generate code, you will need to do it in the workshop mod itself, exposing this algorithm to cheat clients to bypass. The only solution is to frequently update your code to avoid lua-bouncers and perform heart-beat checks to check for non-valid responses.
I am not updating this mod. Use this code at your own risk.
The ModLoader library allows for mods that require it to request code from the server-side of a Project Zomboid game. There are a lot of benefits to this framework:
- Hot reload - If you are in a dynamic environment with lots of players that requires active development support,
reloading code could be an option. Code that is designed to
load()andunload()can reload in this environment. - Anti-Cheat - If you are writing sensitive code that needs to be protected, serving it from the machine of the server can act as a deterant for code being digested and countered by various hacks made to cheat in multiplayer servers.
- In-House mod protection - If you are writing home-brewed mods for a Project Zomboid server, uploading all of it to the Steam Workshop can put your mod at risk for theft. Sending over portions of the code from the server can add security where the code could otherwise not work if not served on another server attempting to use your mod.
Additionally, ModLoader provides a template for sending code over encrypted. If you load your files and cache them, code can be encrypted in a way where only handled by the client-side receiving the code.
Check the Wiki for examples!
If you like what I do and helped your community a lot, feel free to buy me a coffee! https://ko-fi.com/jabdoesthings
