TARGET

-- using target will decrease the cpu usage, using native gta draw text use a lot of cpu so the ms will increase if the function is on false
Integer.UseTarget = true  -- you can use your target system (Only ox_target and qb-target are added now, but you can use what you want in public/target.lua)
Integer.TargetExport = "ox_target"





if Integer.UseTarget then
if GetResourceState('ox_target') ~= 'missing' then
    Integer.TargetExport = "qtarget"
elseif GetResourceState('qb-target') ~= 'missing' then
    Integer.TargetExport = "qtarget"
end


local StoneOptions = {{
    name = 'HiStone',
    icon = 'fa-solid fa-car-side',
    label = Integer.Translations[Integer.Locale]["collect_stone_target"],
    canInteract = function(entity, distance, coords, name)
        return true
    end,
    action = function(entity)
        Collect(entity,"stone")
    end
    }}
local WoodOptions = {{
    name = 'HiStone',
    icon = 'fa-solid fa-car-side',
    label = Integer.Translations[Integer.Locale]["collect_wood_target"],
    canInteract = function(entity, distance, coords, name)
        return true
    end,
    action = function(entity)
        Collect(entity,"wood")
    end
}}

for i,k in pairs(Integer.ObjectHashAndType) do
    if k == "wood" then
        exports[Integer.TargetExport]:AddTargetModel(i, {
            options = WoodOptions,
            distance = 4.0
        })
    elseif k == "stone" then
        exports[Integer.TargetExport]:AddTargetModel(i, {
            options = StoneOptions,
            distance = 4.0
        })
    end
end

end

Last updated