This is my simple jailer resource I whipped up a long time ago as a little project to help myself learn LUA.
I’ve updated it a little so it works with FXServer. It’s standalone and works with a configurable password (default pswd).
Imporant information quoted from the ReadMe you likely wouldn’t have read :
Commands to type in chat (T):
/jailme SECS - Jails yourself, if SECS not given defaults to 180.
/unjail PSWD PLAYERID - Unjails the player with PLAYERID (hold up arrow ingame to see) if PSWD matches specified jail password.
/jail PSWD PLAYERID SECS - Jails the player with PLAYERID (hold up arrow ingame to see) if PSWD matches specified jail password. If SECS not given, defaults to 180.
Changelog:
1.1.0.0:
Made the default jail time easily customisable in serverJailer.lua.
Made the maximum jail time easily customisable in serverJailer.lua
As mentioned it is standalone by default, but there is nothing stopping you from changing the command registration in serverJailer.lua slightly so it works with your desired base resource.
It doesn’t. If this is something you would like to add, you’d ideally have a database. You could add a column to your users table and alter the table when a user gets put into jail and released.
The implementation is dependent on which base resource/server setup you use.
I made this last minute almost a gaurantee this won’t work (this is JUST TO GIVE AN IDEA as to what you should put in/add in for async, ect.
serverJailer.lua
RegisterServerEvent('jailer:save')
AddEventHandler('jailer:save', function(jail)
local identifier = GetPlayerPed(-1)
MySQL.Async.execute(
'UPDATE users SET `jail` = @jail WHERE identifier = @identifier',
{
['@jail'] = jT,
['@identifier'] = identifier
}
)
end)
add ^that under the ---------------------------------
clientJailer.lua
local jail = nil
TriggerEvent('jailer:save', function(jail)
jail = jT
end)
SQL:
CREATE TABLE IF NOT EXISTS `users` (
`jail` VARCHAR(255) NULL DEFAULT '0' COLLATE 'utf8mb4_bin'
)
COLLATE='utf8mb4_bin'
ENGINE=InnoDB
;
I didn’t have enough time to check if player has jT, but add something like this (this shouldn’t work, this is just an example as to what it SHOULD be LIKE)
local Offline = IsPlayerOnline(false)
local Online = IsPlayerOnline(true)
if jT > 10
if IsPlayerOnline(true) then
(code to fetch data)
TriggerClientEvent("JP", tPID, jT)
end
end)
Nice and greate share But, there are one problem in your script.
Why you have “if D > 90 then” and “if D > 100 then” ?
“if D > 100 then” is never possible because at 90 we are teleported back to the jail
It is possible, this is to differentiate between an innocent “stray walking” and trying to use a trainer to teleport out of jail (in which case more jail time is added).
You’re likely entering the wrong password. Please read the main post or the readme to find out how you can customise the password to your liking and to see what the default password is.
do we need to replace any chat like with the one i shut down yesterday cuz you didnt make it public cause i wouldn’t like to make changes to chat if so