Let cops jail people!
server.cfg
esx_jail.sql
in your databaseconfig.lua
esx_policejob
esx_jail:sendToJail(source, jailTime)
server side trigger/jail playerID jailTime
command (only admins)/unjail playerID
to unjail a player (only admins)Example in esx_policejob: client/main.lua
:
{label = _U('fine'), value = 'fine'},
{label = _U('jail'), value = 'jail'}
if data2.current.value == 'jail' then
JailPlayer(GetPlayerServerId(closestPlayer))
end
---
function JailPlayer(player)
ESX.UI.Menu.Open('dialog', GetCurrentResourceName(), 'jail_menu', {
title = _U('jail_menu_info'),
}, function (data2, menu)
local jailTime = tonumber(data2.value)
if jailTime == nil then
ESX.ShowNotification('invalid number!')
else
TriggerServerEvent("esx_jail:sendToJail", player, jailTime * 60)
menu.close()
end
end, function (data2, menu)
menu.close()
end)
end