HEX
HexscriptsVersion 4.0XZMenu

Configurations

Here you will get all configurations & open source files that are included within this script.

Config Files

Config = {}

Config.Debug = false -- Set to true to enable debug messages in the console
Config.Locale = 'automatic' -- automatic, en, de, es, fr, it, nl, pl, pt, tr, ar
Config.Framework = 'automatic' -- automatic, esx, qbcore, standalone

Config.Cuffs = {
    timer = 1000 * 10, -- after 30 minutes the cuffs will break
    item = {
        enabled = true,
        name = 'handcuffs'
    }
}

Config.ZMenu = {
    {
        name = 'cop2',
        label = 'Cop 2',
        img = 'img/zmenu/cop2.png',
        action = function()
            xzMenu.startAnim("anim@amb@nightclub@peds@", "rcmme_amanda1_stand_loop_cop")
        end
    },

    {
        name = 'surrender',
        label = 'Surrender',
        img = 'img/zmenu/surrender.png',
        action = function()
            xzMenu.startAnim("random@arrests@busted", "idle_a")
        end
    },

    {
        name = 'sitchair2',
        label = 'Sit Chair 2',
        img = 'img/zmenu/sitchair2.png',
        action = function()
            xzMenu.startAnim("timetable@ron@ig_5_p3", "ig_5_p3_base")
        end
    },

    {
        name = 'sunbathe',
        label = 'Sunbathe',
        img = 'img/zmenu/sunbathe.png',
        action = function()
            xzMenu.startAnim("amb@world_human_sunbathe@male@back@base", "base")
        end
    },

    {
        name = 'bro',
        label = 'Bro',
        img = 'img/zmenu/bro.png',
        action = function()
            xzMenu.startAnim("mp_ped_interaction", "hugs_guy_a")
        end
    },

    {
        name = 'finger',
        label = 'Finger',
        img = 'img/zmenu/finger.png',
        action = function()
            xzMenu.startAnim("anim@mp_player_intselfiethe_bird", "idle_a")
        end
    },

    {
        name = 'sit',
        label = 'Sit',
        img = 'img/zmenu/sit.png',
        action = function()
            xzMenu.startAnim("anim@amb@business@bgen@bgen_no_work@", "sit_phone_phoneputdown_idle_nowork")
        end
    },

    {
        name = 'lean4',
        label = 'Lean 4',
        img = 'img/zmenu/lean4.png',
        action = function()
            xzMenu.startAnim("amb@world_human_leaning@male@wall@back@foot_up@idle_a", "idle_a")
        end
    },
}

Config.XMenu = {
    ['normal'] = {
        {
            name = 'key',
            label = 'Carlock',
            img = 'img/xmenu/key.png',
            action = function()
                xzMenu.toggleVehicleLocks()
            end
        },

        {
            name = 'trunk',
            label = 'Trunk',
            img = 'img/xmenu/trunk.png',
            action = function()
                if GetResourceState('hex_4_inventory') == 'started' then
                    exports['hex_4_inventory']:OpenTrunk()
                elseif GetResourceState('inventory') == 'started' then
                    ExecuteCommand('openTrunk')
                elseif GetResourceState('ox_inventory') == 'started' then
                    local entity, distance = GetClosestVehicle()
                    if not entity or distance > 5.0 then return end

                    exports['ox_inventory']:openInventory('trunk', { netid = NetworkGetNetworkIdFromEntity(entity), entityid = entity })
                end
            end
        },

        {
            name = 'search',
            label = 'Search',
            img = 'img/xmenu/search.png',
            action = function()
                SearchPlayer()
            end
        },

        {
            name = 'cuff',
            label = 'Handcuff',
            img = 'img/xmenu/cuff.png',
            action = function()
                CuffPlayer()
            end
        },
    },

    ['vehicle'] = {
        {
            name = 'key',
            label = 'Carlock',
            img = 'img/xmenu/key.png',
            action = function()
                xzMenu.toggleVehicleLocks()
            end
        },

        {
            name = 'engine',
            label = 'Engine',
            img = 'img/xmenu/engine.png',
            action = function()
                xzMenu.toggleVehicleEngine()
            end
        },

        {
            name = 'radio',
            label = 'Radio',
            img = 'img/xmenu/radio.png',
            action = function()
                xzMenu.toggleVehicleRadio()
            end
        },

        {
            name = 'doors',
            label = 'Doors',
            img = 'img/xmenu/doors.png',
            action = function()
                xzMenu.openCloseDoors()
            end
        },
    }
}

RegisterCommand('xzAPI', function()
    Config.XMenu['normal'][#Config.XMenu['normal'] + 1] = {
        name = 'api',
        label = 'API Test',
        img = 'img/xmenu/api.png',
        action = function()
            Notify('Information', 'XZ Menu API is working!', 'success')
        end
    }
end)

Open Source Files

if Config.Framework ~= 'esx' then return end

local ESX = nil

function loadFramework()
    local status, ESXLOAD = pcall(function()
        return exports['es_extended']:getSharedObject()
    end)

    ESX = ESXLOAD

    if not status then
        while not ESX do
            TriggerEvent("esx:getSharedObject", function(object) ESX = object end)
            Citizen.Wait(50)
        end
    end

    while ESX.GetPlayerData().job == nil do
        Citizen.Wait(50)
    end

    while not ESX.IsPlayerLoaded() do
        Citizen.Wait(50)
    end

    ESX.PlayerData = ESX.GetPlayerData()
end

RegisterNetEvent('esx:addInventoryItem', function(item, count)
	for k, v in ipairs(ESX.PlayerData.inventory) do
		if v.name == item then
			ESX.PlayerData.inventory[k].count = count
			break
		end
	end
end)

RegisterNetEvent('esx:removeInventoryItem', function(item, count)
	for k, v in ipairs(ESX.PlayerData.inventory) do
		if v.name == item then
			ESX.PlayerData.inventory[k].count = count
			break
		end
	end
end)

function HaveItem(item, count)
    for k, v in ipairs(ESX.PlayerData.inventory) do
        if v.name == item and v.count >= count then
            return true
        end
    end

    return false
end

function GetItemLabel(item)
    for k, v in ipairs(ESX.PlayerData.inventory) do
        if v.name == item then
            return v.label
        end
    end

    return 'Unknown'
end