When a person goes to prison and leaves the prison, he walks quietly through the city, but when the person leaves the city and returns to the city, she returns to the place where she leaves the prison, understood?
@Jager_Bom can you please repair the part of this script for releasing a prisonā¦ when someone gets put in jailā¦ and goes off line than the server reboots and they join back in AND there jail time is fully UP they dont get teleported out they just log in and nothing happens
i ll look it into again , but yet not much time for debugging but will do in these days
Iāve come across a new issue. The menu wonāt open now with the latest policejob. Thatās the only thing I have changed before it stopped working.
When Iām not near a player it says no player nearby and when a player is close no menu pops up. Iāve had this since release and love it.
I have it set up with multiple jails and it has worked great up until recently. I get no errors in the console and the code checks out in lua checkers.
I updated to the latest version of yours to make sure it was fresh and updated. The problem still persists. I have the code copied in to make menus and like i said itās worked great up until recently so Iām not sure what I need to change.
I was assuming it was this openJailMenu(GetPlayerServerId(closestPlayer))
but I have no idea where to actually trigger that. When I replace function openJailMenu(playerid)
with that the policejob just stops working.
I am happy to copy the code over to you to check but Iām certain itās done right as itās worked great for some time now.
Thanks in advance for any advice and help.
Show me the code in police job
Iāve pmd you. Itās a lot lol
Hey! Is it possible to make this work with chat commands, like /cell1 [id] [minutes] and so on?
Did you get a chance to take a look yet?
yes just trigger client event
Any way there could be an update that makes it work with latest policejob? Im not that good at coding otherwise i would have done it
itāis clearly written what to do ā¦
It just says * 5b trigger somewhere in your menus : openJailMenu(GetPlayerServerId(closestPlayer))
I donāt know where i should trigger it from. I guess its the police client file. But where in it?
Also it should be changed to triggerclientevent
so i guess it would be: triggerclientevent openJailMenu(GetPlayerServerId(closestPlayer))
well look for clostest player and you ll see where you ll need to put that line. and no there is no need to triggerclientevent because this is a function
So i guess then it should be here?
ESX.UI.Menu.Open(
'default', GetCurrentResourceName(), 'citizen_interaction',
{
title = _U('citizen_interaction'),
align = 'top-left',
elements = elements
}, function(data2, menu2)
local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer()
if closestPlayer ~= -1 and closestDistance <= 3.0 then
local action = data2.current.value
if action == 'identity_card' then
OpenIdentityCardMenu(closestPlayer)
elseif action == 'body_search' then
TriggerServerEvent('esx_policejob:message', GetPlayerServerId(closestPlayer), _U('being_searched'))
OpenBodySearchMenu(closestPlayer)
elseif action == 'handcuff' then
TriggerServerEvent('esx_policejob:handcuff', GetPlayerServerId(closestPlayer))
elseif action == 'drag' then
TriggerServerEvent('esx_policejob:drag', GetPlayerServerId(closestPlayer))
elseif action == 'put_in_vehicle' then
TriggerServerEvent('esx_policejob:putInVehicle', GetPlayerServerId(closestPlayer))
elseif action == 'out_the_vehicle' then
TriggerServerEvent('esx_policejob:OutVehicle', GetPlayerServerId(closestPlayer))
elseif action == 'fine' then
OpenFineMenu(closestPlayer)
elseif action == 'license' then
ShowPlayerLicense(closestPlayer)
elseif action == 'unpaid_bills' then
OpenUnpaidBillsMenu(closestPlayer)
elseif action == 'unpaid_bills' then
openJailMenu(GetPlayerServerId(closestPlayer))
end
Like that, but its not showing up in the menu.
*Edit
Okay, so i have been trying and trying and looking into other scripts to try figure it out.
This is how i have it now
if action == 'identity_card' then
OpenIdentityCardMenu(closestPlayer)
elseif action == 'body_search' then
TriggerServerEvent('esx_policejob:message', GetPlayerServerId(closestPlayer), _U('being_searched'))
OpenBodySearchMenu(closestPlayer)
elseif action == 'handcuff' then
TriggerServerEvent('esx_policejob:handcuff', GetPlayerServerId(closestPlayer))
elseif action == 'drag' then
TriggerServerEvent('esx_policejob:drag', GetPlayerServerId(closestPlayer))
elseif action == 'put_in_vehicle' then
TriggerServerEvent('esx_policejob:putInVehicle', GetPlayerServerId(closestPlayer))
elseif action == 'out_the_vehicle' then
TriggerServerEvent('esx_policejob:OutVehicle', GetPlayerServerId(closestPlayer))
elseif action == 'fine' then
OpenFineMenu(closestPlayer)
elseif action == 'license' then
ShowPlayerLicense(closestPlayer)
elseif action == 'unpaid_bills' then
OpenUnpaidBillsMenu(closestPlayer)
elseif action == 'jail' then
openJailMenu(GetPlayerServerId(closestPlayer))
At the end iāve added that code, i guess im right now?
yes you did quite well
It works almost fine, when sending someone to prison i get this error https://i.imgur.com/g4VeUgF.jpg
like it says identifier column cannot be null, did you change something in the script ?
Nope nothing but setting it to minutes. I will try to reinstall is see if it helps then, problem is that i canāt check it until tomorrow when a friend signs in. Also, is this a error in the script or in the SQL db?
Damn you really fast to answer, nice!
Still getting the same error message after reinstall and also after re-adding the jail sql
[MySQL] [esx_jb_realtimejailer] [2ms] INSERT INTO jail (identifier,isjailed,J_Time,J_Cell,Jailer,Jailer_ID) VALUES (@Identifier,true,'2018-11-13 1:19:14','JailPoliceStation1','FortuN','steam:110000101e65344') ON DUPLICATE KEY UPDATE identifier='steam:110000107c3fab2',isjailed=true,J_Time='2018-11-13 1:19:14', J_Cell='JailPoliceStation1', Jailer='FortuN', Jailer_ID='steam:110000101e65344'
[ERROR] [MySQL] [esx_jb_realtimejailer] An error happens on MySQL for query "[object Object]": ER_BAD_NULL_ERROR: Column 'identifier' cannot be null
e[91mError: (node:15886) UnhandledPromiseRejectionWarning: Error: ER_BAD_NULL_ERROR: Column 'identifier' cannot be null
at Query.Sequence._packetToError (mysql-async.js:244:14)
at Query.ErrorPacket (mysql-async.js:2109:18)
at Protocol._parsePacket (mysql-async.js:5941:23)
at Parser.write (mysql-async.js:6198:12)
at Protocol.write (mysql-async.js:5701:16)
at Socket.<anonymous> (mysql-async.js:693:28)
at emitOne (events.js:116:13)
at Socket.emit (events.js:211:7)
at addChunk (_stream_readable.js:263:12)
at readableAddChunk (_stream_readable.js:250:11)```
Hmm i downgraded to a old 2.1.1 mysql-async and then it works. Not with 3.0.1 or 3.0.8. So it seems to be problematic with newer versions.
*Edit
Atleast i thought. Now it was added in the mysql db but getting this error instead
[ERROR] [MySQL] An critical error happens on MySQL for query "SELECT * FROM jail WHERE identifier=@id {@id=steam:110000107c3fab2}": Unable to convert MySQL date/time to System.DateTime. at MySqlConnector.Core.Row.ParseDateTime (System.ArraySegment`1[T] value) [0x00068] in <149068887d4e4bc08e7b4c05a59a923b>:0
at MySqlConnector.Core.Row.GetValue (System.Int32 ordinal) [0x0030e] in <149068887d4e4bc08e7b4c05a59a923b>:0
at MySql.Data.MySqlClient.MySqlDataReader.GetValue (System.Int32 ordinal) [0x0000b] in <149068887d4e4bc08e7b4c05a59a923b>:0
at MySQLAsync.FetchAll+<ReaderAsync>d__2.MoveNext () [0x000dc] in <6f835765886c4fada3e5ffb1ffcd6998>:0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <49fde7938a9b47b480042d844e818c7e>:0
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <49fde7938a9b47b480042d844e818c7e>:0
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <49fde7938a9b47b480042d844e818c7e>:0
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <49fde7938a9b47b480042d844e818c7e>:0
at System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () [0x00000] in <49fde7938a9b47b480042d844e818c7e>:0
at MySQLAsync.Operation`1+<ExecuteAsync>d__7[TResult].MoveNext () [0x00169] in <6f835765886c4fada3e5ffb1ffcd6998>:0
[esx_jb_jailer] Mettre en prison en JailPoliceStation1 :FortuN pour 60 secs - commande entree par one click ``