esx-community / esx_jail

Let cops jail people, an FiveM project
36 stars 36 forks source link

esx_jail

Let cops jail people!

Features

Installation

  1. Clone the project and add it to your resorces directory
  2. Add the project to your server.cfg
  3. Import esx_jail.sql in your database
  4. Select language in config.lua
  5. (Optional) See below on how to jail via esx_policejob

How to jail

Requirements

Based off

Add to menu

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