I’m looking for a “jail script” that allows jail time to tick down even when the player is offline or when the player is playing on another character.
At present, the server is built on ESX, so if it works with esx_policejob, that is a big plus.
I’m new to this with scripting and stuff but I¨m learning more and more everyday :). Hope there is some kind soul who knows what I mean and who wants to help me find what I am looking for!
A lot of the jail scripts out there are extremely weird, to be honest with you.
You could look into working with TIMESTAMP in SQL and then having that work with Lua.
Try looking into os.time or some existing scripts.
I doubt you are going to find a script out there that does that. I mean one of the main reasons of jailing is to stop sh*tlording, and your request literally allows that to happen in your server with no repercussions. But if that is something you are okay with, simply update the jail time via the DB. Something along the lines of this server side code:
Citizen.CreateThread(function()
while true do
Citizen.Wait(60000)
MySQL.Async.execute("UPDATE users SET jail = jail - 1 WHERE jail > 0")
end
end)
This would update the DB every minute and decrease jail time by 1 for every user in the db that has a jail time.
If you use esx_kasharacters, download esx_jb_realtimejailer. That works fine. And if you won’t add this jailer table inside DB into kasharacters server handling, the jail time should automatically apply to all characters from one account. If that’s what you want.