[Release] esx_jail

May implement some kind of unjailing tonight. Don’t except anything fancy, but I’m thinking a circle in mission row PD where you can unjail people

I can get this to work via chat command but not from the police menu

iam stuck here,

image

dose this update keep /jail and /unjail for admins?

you need to go into your files and into where the translations are and add it

1 Like

I cant get the script to load, i keep getting the error, Failed to load script serverJailer.lua??
From what i can tell this script never had a serverJailer.lua?

How to jail
Use the esx_jailer:sendToJail(target, jailTime) server side trigger
Use the /jail playerID jailTime command (only admins)
Use the /unjail playerID to unjail a player (only admins)

Where it should be written in which file

how would one make it so it show who jailed who on chat?

has anyone found a fix to where the if cuffed and you put them in jail it will uncuff them so they can move around?

Just trigger the handcuff event on them?

how to add? apply to policejob and crash all police

Is it possible to change from seconds to minutes?

Can someone paste there main.lua from esx_police, i am fairly new and am having some issues putting it in. Thanks

Hey what do you mean go into the files, i am having this too

Hello,

People using LuaInjector are able to send everybody on the server in jail at the same time because there are no check if it’s a police…

I tryed to do it but it’s only detecting the “ELSE” part and it’s ignoring the rest even tough I am a police…

-- send to jail and register in database
RegisterServerEvent('esx_jailer:sendToJail')
AddEventHandler('esx_jailer:sendToJail', function(target, jailTime)
	local xPlayer = ESX.GetPlayerFromId(source)
 	if xPlayer.job.name == 'police' then
	local identifier = GetPlayerIdentifiers(target)[1]
	MySQL.Async.fetchAll('SELECT * FROM jail WHERE identifier=@id', {['@id'] = identifier}, function(result)
		if result[1] ~= nil then
			MySQL.Async.execute("UPDATE jail SET jail_time=@jt WHERE identifier=@id", {['@id'] = identifier, ['@jt'] = jailTime})
		else
			MySQL.Async.execute("INSERT INTO jail (identifier,jail_time) VALUES (@identifier,@jail_time)", {['@identifier'] = identifier, ['@jail_time'] = jailTime})
		end
	end)	
		TriggerClientEvent('chat:addMessage', -1, { args = { _U('judge'), _U('jailed_msg', GetPlayerName(target), ESX.Round(jailTime / 60)) }, color = { 147, 196, 109 } })
		TriggerClientEvent('esx_policejob:unrestrain', target)
		TriggerClientEvent('esx_jailer:jail', target, jailTime)
	else
		TriggerServerEvent('_chat:messageEntered', GetPlayerName(id), { 255, 0, 0 }, '^1J\'ai essayer d\'envoyer quelqu\'un en prison sans avoir les permissions.')	
		--print(('esx_jailer: %s attempted to drag out from vehicle (not cop)!'):format(xPlayer.identifier))
	end
end)

Error running call reference function for resource essentialmode: citizen:/scripting/lua/scheduler.lua:351: server/main.lua:218: attempt to index a nil value (field ‘?’)
stack traceback:
server/main.lua:218: in upvalue ‘ref’
citizen:/scripting/lua/scheduler.lua:337: in function citizen:/scripting/lua/scheduler.lua:336
[C]: in function ‘xpcall’
citizen:/scripting/lua/scheduler.lua:336: in function citizen:/scripting/lua/scheduler.lua:335
stack traceback:
[C]: in function ‘error’
citizen:/scripting/lua/scheduler.lua:351: in function citizen:/scripting/lua/scheduler.lua:322

Can you help me what can i do? I cant jail anyone.

Is there any way to get rid of the you cannot escape form jail option?

so i have added the prison script and im trying to change the coordinates in my jail script but for some reason it does not work. Does anyone know why i cant change the coords? thx

Did anyone have a problem with the esx_jailer script? The script adds to the database, and nothing else happens, only this error pops up.

Error running call reference function for resource essential: citizen: /scripting/lua/scheduler.lua: 351: server / main.lua: 218: attempt to index a nil value (field ‘?’)
traceback stack:
server / main.lua: 218: in upvalue ‘ref’
citizen: /scripting/lua/scheduler.lua: 337: in function
[C]: in function ‘xpcall’
citizen: /scripting/lua/scheduler.lua: 336: in function
traceback stack:
[C]: in function ‘error’
citizen: /scripting/lua/scheduler.lua: 351: in function

last time i try to use the latest updated on this it would not let me use /jail or unjail anymore