[Release][FX] Jailer 1.1.0.0

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 :stuck_out_tongue::

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

Enjoy.
Jailer.zip (2.4 KB)

24 Likes

Wow great job! Is compatible with vrp?

1 Like

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.

OK thank you very much. When a prisoner disengages, he stays in jail when he reconnects?

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.

Can You help me please? I’m use vrp fx server! Congraturations for your wonderful scripts for LSPDFR :smiley:

1 Like

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)

I will fix when I get back on and have the time :wink:

2 Likes

@albo1125 Nice! I had a friend help me port this over. It was a bitch and a half

Tested with vRP just now. Perfect!

Thank you so much!

1 Like

Yes work on vRP but have you idea to save in database if the player jailed when disconnect?

Thanks for the release!

1 Like

Great resource !!

Is it set to work for law enforcement only?

Nice and greate share :slight_smile: 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).

@albo1125 1 question here, why when i set the jail to more than 1000secs it won’t works. Only 1000secs work
ps:Sorry for my bad english :frowning:

@albo1125 Hmm… ok :smiley: I have edited for add time everytime personnaly ^^
@weiseang0855 ServerJailer.lua -> Edit “jT > 1000” and “jT = 1000”

Updated the download to 1.1.0.0:

1.1.0.0:
Made the default jail time easily customisable in serverJailer.lua.
Made the maximum jail time easily customisable in serverJailer.lua

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.

I got it working. I was using the userlist ID instead of playerlist. Thank you for this script works amazing!

1 Like

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