diff --git a/ND_Jailing/config_client.lua b/ND_Jailing/config_client.lua
new file mode 100644
index 0000000..6d23295
--- /dev/null
+++ b/ND_Jailing/config_client.lua
@@ -0,0 +1,24 @@
+config = {
+ maxJailTime = 10, -- Max time in seconds that someone can jail another player.
+ jailDistance = 90.0, -- How far can the player go from the Jail coordinates. If the player is further than the set amount they will be teleported back.
+
+ jailCoords = {x = 1680.21, y = 2513.25, z = 44.56, h = 6.53},
+ releaseCoords = {x = 1840.22, y = 2608.42, z = 45.58, h = 270.09},
+
+ -- Where can players access it from.
+ accessLocation = {
+ {x = -449.61, y = 6012.42, z = 31.72}, -- Paleto Bay Sheriff's Office
+ {x = 1853.08, y = 3690.2, z = 34.27}, -- Sandy Shores Sheriff's Office
+ {x = 459.84, y = -989.15, z = 24.91}, -- Mission Row PD
+ },
+
+ -- Departments that can access the jail tablet.
+ accessDepartments = {
+ "SAHP",
+ "LSPD",
+ "BCSO"
+ },
+
+ -- How close does the player have to be to the coordiantes to be able to open the tablet.
+ accessDistance = 0.5,
+}
\ No newline at end of file
diff --git a/ND_Jailing/config_server.lua b/ND_Jailing/config_server.lua
new file mode 100644
index 0000000..7a357b1
--- /dev/null
+++ b/ND_Jailing/config_server.lua
@@ -0,0 +1,3 @@
+config = {
+ discordWebhook = "https://discord.com/api/webhooks/873744008122335252/zk53XWv0ZfD-BD2Su6VYGPzUgNW0NjLrj7hVBQFVgp_ByO0f0rpMwx7fsNNNjyVp4GUT",
+}
\ No newline at end of file
diff --git a/ND_Jailing/fxmanifest.lua b/ND_Jailing/fxmanifest.lua
new file mode 100644
index 0000000..900843c
--- /dev/null
+++ b/ND_Jailing/fxmanifest.lua
@@ -0,0 +1,38 @@
+------------------------------------------------------------------------
+------------------------------------------------------------------------
+-- DO NOT EDIT IF YOU DON'T KNOW WHAT YOU'RE DOING --
+-- --
+-- For support join my discord: https://discord.gg/Z9Mxu72zZ6 --
+------------------------------------------------------------------------
+------------------------------------------------------------------------
+
+version "1.0"
+description "Jail tablet"
+author "Andyyy#7666"
+
+fx_version "cerulean"
+game "gta5"
+lua54 "yes"
+
+escrow_ignore {
+ "config_client.lua",
+ "config_server.lua"
+}
+
+ui_page "source/ui/index.html"
+
+files {
+ "source/ui/index.html",
+ "source/ui/js/jquery-3.6.0.min.js",
+ "source/ui/js/listener.js",
+ "source/ui/style.css"
+}
+
+server_scripts {
+ "source/server.lua",
+ "config_server.lua"
+}
+client_scripts {
+ "source/client.lua",
+ "config_client.lua"
+}
\ No newline at end of file
diff --git a/ND_Jailing/source/client.lua b/ND_Jailing/source/client.lua
new file mode 100644
index 0000000..8681554
--- /dev/null
+++ b/ND_Jailing/source/client.lua
@@ -0,0 +1,151 @@
+local display = false
+local isJailed = false
+
+function SetDisplay(bool)
+ display = bool
+ SetNuiFocus(bool, bool)
+ SendNUIMessage({
+ type = "ui",
+ status = bool
+ })
+end
+
+function alert(msg)
+ BeginTextCommandDisplayHelp("STRING")
+ AddTextComponentSubstringPlayerName(msg)
+ EndTextCommandDisplayHelp(0, 0, 1, -1)
+end
+
+-- Jail a player and loop to keep them in jail every second.
+RegisterNetEvent("ND_Jailing:jailPlayer")
+AddEventHandler("ND_Jailing:jailPlayer", function(time)
+ local player = PlayerPedId()
+ isJailed = true
+ SetEntityCoords(player, config.jailCoords.x, config.jailCoords.y, config.jailCoords.z, false, false, false, false)
+ SetEntityHeading(player, config.jailCoords.h)
+
+ while isJailed do
+ time = time -1
+ local pedCoords = GetEntityCoords(player)
+
+ if #(pedCoords - vector3(config.jailCoords.x, config.jailCoords.y, config.jailCoords.z)) > config.jailDistance then
+ SetEntityCoords(player, config.jailCoords.x, config.jailCoords.y, config.jailCoords.z, false, false, false, false)
+ end
+ if time == 0 then
+ SetEntityCoords(player, config.releaseCoords.x, config.releaseCoords.y, config.releaseCoords.z, false, false, false, false)
+ SetEntityHeading(player, config.releaseCoords.h)
+ Citizen.Wait(100)
+ TaskGoStraightToCoord(player, config.releaseCoords.x + 10, config.releaseCoords.y, config.releaseCoords.z, 1.0, 8000, config.releaseCoords.h, 0)
+ isJailed = false
+ end
+ Citizen.Wait(1000)
+ end
+end)
+
+-- Chat suggestion for command.
+TriggerEvent("chat:addSuggestion", "/jail", "Jail a player", {
+ {name="Id", help="Player Id"},
+ {name="time", help="time to jail (seconds)"},
+ {name="Reason", help="Short reason or list of charges."}
+})
+
+-- Same jail function but with a command.
+RegisterCommand("jail", function(source, args, rawCommand)
+ local id = tonumber(args[1])
+ local time = tonumber(args[2])
+ local reason = args[3]
+ local hasAccess = false
+ for _, dept in pairs(config.accessDepartments) do
+ if exports["ND_Core"]:getCharacterInfo(6) == dept then
+ hasAccess = true
+ break
+ end
+ end
+ if hasAccess then
+ local name = GetPlayerName(GetPlayerFromServerId(id))
+ if not GetPlayerFromServerId(id) then
+ TriggerEvent("chat:addMessage", {
+ color = { 255, 0, 0},
+ multiline = true,
+ args = {"[Error]", "couldn't find a player with id " .. id .. "."}
+ })
+ elseif time > config.maxJailTime then
+ TriggerEvent("chat:addMessage", {
+ color = { 255, 0, 0},
+ multiline = true,
+ args = {"[Error]", "max time to jail is: " .. config.maxJailTime .. " seconds."}
+ })
+ elseif time <= config.maxJailTime then
+ TriggerServerEvent("jailPlayer", id, name, time, reason)
+ SetDisplay(false)
+ end
+ else
+ TriggerEvent("chat:addMessage", {
+ color = { 255, 0, 0},
+ multiline = true,
+ args = {"[Error]", "You don't have permission to use this command."}
+ })
+ end
+end, false)
+
+-- Return list of all players on the server and open ui.
+RegisterNetEvent("ND_Jailing:returnPlayers")
+AddEventHandler("ND_Jailing:returnPlayers", function(players)
+ for _, player in pairs(players) do
+ SendNUIMessage({
+ type = "players",
+ players = player,
+ })
+ end
+ SetDisplay(true)
+end)
+
+-- Check permission and distance of player.
+Citizen.CreateThread(function()
+ while true do
+ Citizen.Wait(0)
+ local pedCoords = GetEntityCoords(PlayerPedId())
+ for locations in pairs(config.accessLocation) do
+ if #(pedCoords - vector3(config.accessLocation[locations].x, config.accessLocation[locations].y, config.accessLocation[locations].z)) < config.accessDistance then
+ for _, dept in pairs(config.accessDepartments) do
+ if exports["ND_Core"]:getCharacterInfo(6) == dept then
+ if not display then
+ alert("Press ~INPUT_CONTEXT~ to open the jail ui")
+ end
+ if IsControlJustPressed(1, 51) then
+ TriggerServerEvent("ND_Jailing:getPlayers")
+ end
+ end
+ end
+ end
+ end
+ end
+end)
+
+-- When form is submitted.
+RegisterNUICallback("sumbit", function(data)
+ local id = tonumber(string.sub(data.id, 2, string.find(data.id, ")") - 1))
+ local time = tonumber(data.time)
+ local reason = data.reason
+ local name = GetPlayerName(GetPlayerFromServerId(id))
+ if time > config.maxJailTime then
+ SendNUIMessage({
+ error = "Error: max time to jail is: " .. config.maxJailTime .. " seconds."
+ })
+ Citizen.Wait(5000)
+ SendNUIMessage({
+ error = ""
+ })
+ else
+ TriggerServerEvent("ND_Jailing:jailPlayer", id, name, time, reason)
+ SendNUIMessage({
+ type = "clean"
+ })
+ SetDisplay(false)
+ end
+end)
+
+-- Close ui.
+RegisterNUICallback("closeUI", function(data)
+ SetDisplay(false)
+end)
\ No newline at end of file
diff --git a/ND_Jailing/source/server.lua b/ND_Jailing/source/server.lua
new file mode 100644
index 0000000..1bf0bd0
--- /dev/null
+++ b/ND_Jailing/source/server.lua
@@ -0,0 +1,36 @@
+function sendToDiscord(name, message, color)
+ local embed = {
+ {
+ title = name,
+ description = message,
+ footer = {
+ icon_url = "https://i.imgur.com/notBtrZ.png",
+ text = "Created by Andyyy#7666"
+ },
+ color = color
+ }
+ }
+ PerformHttpRequest(config.discordWebhook, function(err, text, headers) end, 'POST', json.encode({username = "ND Jailing", embeds = embed}), {["Content-Type"] = "application/json"})
+end
+
+-- Jail player discord log, trigger the even on the players client and send a message to everyone.
+RegisterNetEvent("ND_Jailing:jailPlayer")
+AddEventHandler("ND_Jailing:jailPlayer", function(id, name, time, reason)
+ TriggerClientEvent("ND_Jailing:jailPlayer", id, time)
+ sendToDiscord("Jail Logs", "**" .. GetPlayerName(source) .. "** Jailed **" .. name .. "** for **" .. time .. " seconds** with the reason: **" .. reason .. "**.", 1595381)
+ TriggerClientEvent('chat:addMessage', -1, {
+ color = { 255, 0, 0},
+ multiline = true,
+ args = {"[Judge]", name .. " was charaged with " .. reason .. " and will be spending " .. time .. " months in jail."}
+ })
+end)
+
+-- Gets all players on the server and adds them to a table.
+RegisterNetEvent("ND_Jailing:getPlayers")
+AddEventHandler("ND_Jailing:getPlayers", function()
+ local players = {}
+ for _, id in pairs(GetPlayers()) do
+ players[id] = "(" .. id .. ") " .. GetPlayerName(id)
+ end
+ TriggerClientEvent("ND_Jailing:returnPlayers", source, players)
+end)
\ No newline at end of file
diff --git a/ND_Jailing/source/ui/index.html b/ND_Jailing/source/ui/index.html
new file mode 100644
index 0000000..95557de
--- /dev/null
+++ b/ND_Jailing/source/ui/index.html
@@ -0,0 +1,31 @@
+
+
+