This script will log the time the player enters a cell, and then depending on the resetTime (default 1 hour of real time), run the console command 'RA'
Save this file as npcReset.lua in the mp-stuff\scripts\ directory.
These edits will be made in the same directory in the serverCore.lua file.
-
Add:
npcReset = require("npcReset")
under:menuHelper = require("menuHelper")
~line 13 -
Add:
npcReset.OnServerPostInit()
under:ResetAdminCounter()
~line 284 -
Add:
npcReset.OnCellLoad(pid, cellDescription)
under:eventHandler.OnCellLoad(pid, cellDescription)
~line 457
If you'd like to change the default 1 hour reset, you can edit the local resetMinutes = 60
variable on line 19 of my script.
After installing the script, when the server is started the json file will be created.
After the file is created when a player first moves to a cell, the cell and current time (in minutes since midnight, converted to UTC) are added to the json file. When the cell is later visited again, the time is checked. If the cell hasn't been visited in 1 hour (by default), the time is updated and the 'RA' console command is run.