FiveM Jail Scrip / Jail Mod (HELP!)

HI!
I am looking for some help putting together a community Jail Script/mod.

So far i have found the following:
handcuff script (enables chat commands): https://github.com/mecwerks/fiverebornstuff/tree/master/mxhandcuff
Simple Jail Script (Requires essentialmode) [Release] Simple Jail System

***NOTE: all credit for the scripts above (and below) should be given to the respected creators!
***Disclaimer: I am merely a scrip kidddy attempting to modify the files in efforts to get a jail system running via chat commands.

So far the handcuff scrip is running like a dream. Thus, i have edited the following files in efforts to interact with the jail scrip (the same way you interact with the handcuff script - VIA chat commands).

My files are being streamed to the server as followed:
server\resources\Jail
within the jail folder: __resource.lua, jail.lua, server.lua
Within the files i have the following scripts:

------------------------------- __Resource.lua -----------------------------

resource_manifest_version ‘77731fab-63ca-442c-a67b-abc70f28dfa5’ – Manifest version

client_script ‘jaillocations.lua’ – Client side script

server_script ‘server.lua’ – Server side script

server_script ‘detained.lua’ – Server side script

------------------------------- server.lua -----------------------------

require “resources/xxxxxxx/lib/MySQL”

RegisterServerEvent(“toJailOrNot”)
AddEventHandler(“toJailOrNot”, function(playerid)
local identifier = GetPlayerIdentifiers(source)[1]

local executed_query = MySQL:executeQuery(“SELECT * FROM users WHERE identifier = ‘@name’”, {[’@name’] = identifier})
local result = MySQL:getResults(executed_query, {‘permission_level’, ‘money’, ‘identifier’,‘detained’}, “identifier”)
local getModel = result[1]

if (getModel[‘detained’] == “1”)then
TriggerClientEvent(‘detainedOrNot’, source)
end
end)

------------------------------- Jaillocations.lua -----------------------------

jaillocation = {
{ 462.77, -993.73, 24.91},
{ 462.77, -998.28, 24.91},
{ 462.90, -1001.88, 24.91},
{ 463.69, -991.85, 24.91},
{ 464.29, -1004.47, 24.91}
}

Citizen.CreateThread(function ()
while true do
Citizen.Wait(0)
for i = 1, #jaillocation do
jailCoords2 = jaillocation[i]
if(GetDistanceBetweenCoords(jailCoords2[1], jailCoords2[2], jailCoords2[3],GetEntityCoords(PlayerPedId())) < 1)then

       TriggerServerEvent('JustToJail', PlayerId())
                         end
                    end   
            end

end)

RegisterNetEvent(‘detainedOrNot’)
AddEventHandler(‘detainedOrNot’, function(user)
SetEntityCoords(GetPlayerPed(-1), 459.741, -994.561, 24.914, 1, 0, 0, 1)
states.frozenPos = pos
end)

------------------------------- detained.lua -----------------------------

AddEventHandler(‘chatMessage’, function(source, n, message) – capture ‘chatMessage’ events
local args = stringsplit(message, " ") – Split the message up into an array of words

if (args[1] == “/jail”) then – if the first “word” is /jail
CancelEvent() – dont pass this chat message further, we’re handling it

if (args[2] ~= nil) then -- make sure we have an actual second "word"
  local playerID = tonumber(args[2]) -- Store the playerID that was passed, as a number
  -- If this is not a valid player
  if (playerID < 1 or playerID > 32) then
    -- tell the sender they have an invalid target
    TriggerClientEvent('chatMessage', source, "SYSTEM", {200, 0, 0}, "Invalid PlayerID!")
    return -- dont continue any further
  end
  -- at this point we should have a valid PlayerID to target, so lets send him a jailed event
  TriggerClientEvent('Jail', playerID) -- Sends event 'Jail' to playerID
else -- if args[2] does equal nil (doesnt exist)
  local event = 'chatMessage' -- What event are we sending
  local eventTarget = source -- Who do we send the event too (-1 means all)
  local messageSender = "SYSTEM" -- Message sender
  local messageSenderColor = {200, 0, 0} -- Message sender color
  local message = "Usage: /jail <PlayerID>" -- show a `how-to-use` message
  -- This could be shortened into just one line, it was exanded to show what each parameter does
  TriggerClientEvent(event, eventTarget, messageSender, messageSenderColor, message) -- send the event
  -- NOTE: the variables after "eventTarget" will be passed to the event handlers function
  -- you will see in jail.lua, that the 'jail' event does not take any arguements
  -- hence why it is sent above with only the event name and target ID
end

end
end)

– utility function to turn a string into an array of words
function stringsplit(self, delimiter)
local a = self:Split(delimiter)
local t = {}

for i = 0, #a - 1 do
table.insert(t, a[i])
end

return t
end

Im hoping someone with script knowledge can review the above edits and explain how i royally F–Ked up?

still nothing huh?..

The server is triggering client event Jail, however I do not see that client event in your code

does this work? if so i’d love u forever

no not that i’ve seen but im recoding this to make it work pm me for more info and to be a beta tester

are you still recording the jail script?

NOT MAKING IT ANYMORE USE @albo1125 Jail Script