đŸ”Ŧ
RX Scripts
STOREDISCORD
  • 👋Overview
  • Find us
    • 🔗Store
    • 🔗Discord
    • 🔗Youtube
  • 🌐Scripts
    • Garages
      • đŸ› ī¸Installation
      • 📝Configurables
      • â†Ēī¸Exports
      • â†Šī¸Events
    • Reports PRO
      • đŸ› ī¸Installation
      • 📝Configurables
      • â†Ēī¸Exports
      • â†Šī¸Events
    • Mining
      • đŸ› ī¸Installation
      • 📝Configurables
      • â†Ēī¸Exports
      • â†Šī¸Events
    • Fishing
      • đŸ› ī¸Installation
      • 📝Configurables
      • â†Ēī¸Exports
      • â†Šī¸Events
    • Player Stores
      • đŸ› ī¸Installation
      • 🚚Jobs DLC
      • 📝Configurables
      • â†Ēī¸Exports
      • â†Šī¸Events
    • Drug Labs
      • đŸ› ī¸Installation
      • âœˆī¸Operation DLC
      • 📝Configurables
      • â†Ēī¸Exports
      • â†Šī¸Events
    • Hunting
      • đŸ› ī¸Installation
      • 📝Configurables
      • â†Ēī¸Exports
      • â†Šī¸Events
    • Plantation
      • đŸ› ī¸Installation
      • 📝Configurables
      • â†Ēī¸Exports
      • â†Šī¸Events
    • Gang Wars
      • đŸ› ī¸Installation
      • 📝Configurables
      • â†Šī¸Events
    • Housing
      • đŸ› ī¸Installation
      • 📝Configurables
      • â†Šī¸Events
    • Chopshop
      • đŸ› ī¸Installation
      • 📝Configurables
    • Death System
      • đŸ› ī¸Installation
      • 📝Configurables
      • â†Šī¸Events
    • Recyclers
      • đŸ› ī¸Installation
      • 📝Configurables
      • â†Ēī¸Exports
      • â†Šī¸Events
    • Smelters
      • đŸ› ī¸Installation
      • 📝Configurables
      • â†Ēī¸Exports
      • â†Šī¸Events
    • Crates & Storages
      • đŸ› ī¸Installation
      • 📝Configurables
      • â†Šī¸Exports
      • â†Šī¸Events
    • Black Markets
      • đŸ› ī¸Installation
      • 📝Configurables
    • Hazard Zones
      • đŸ› ī¸Installation
      • 📝Configurables
      • â†Ēī¸Exports
      • â†Šī¸Events
    • Report System
      • đŸ› ī¸Installation
      • 📝Configurables
      • â†Ēī¸Exports
      • â†Šī¸Events
    • Billing System
      • đŸ› ī¸Installation
      • â†Ēī¸Exports
      • â†Šī¸Events
Powered by GitBook
On this page
  1. Scripts
  2. Recyclers

Configurables

--[[
BY RX Scripts Š rxscripts.xyz
--]]

Config = {}

Config.DiscordWebhook = 'https://discordapp.com/api/webhooks/1163094573434814464/Q4u2iwVW__VdfgEzsW3UpC7DGGg7bgSxSUhJTIbayGVhMzJiIVcrv5KDmW_rHqB2kpUn'
Config.ImgDirectory = 'qb-inventory/html/images/' -- Directory to get images from
Config.Locale = 'en'

--[[ 
    If you want to use global props, set this to true (e.g. all props 'recicladora' in the world will have the recycler target)
    Otherwise, set this to false and it only binds a target to the recyclers in their locations table or placed by players (this way you can use the same prop for different recyclers)

    If you don't feel like using this, you can use our OpenRecycler export (see documentation), to open recyclers in a different way
--]]
Config.GlobalProps = true

Config.Recyclers = {
    ["Recycler"] = {
        label = "Recycler",
        prop = "recicladora", -- Prop to access the recycler (if GlobalProps is set to true, this prop should be unique)
        recycleTimer = 3, -- Seconds to wait before smelting everything once
        recyclables = {
            {
                from = { item = "weapon_pistol", amount = 1  }, -- Limit is optional: set an limitation amount of the item in the input
                to = {
                    { item = "metalfragment", amount = 10 },
                    { item = "iron", amount = 10 },
                    { item = "metalscrap", amount = 10 },
                }
            },
            {
                from = { item = "weapon_assaultrifle", amount = 1, limit = 1  }, -- Limit is optional: set an limitation amount of the item in the input
                to = {
                    { item = "metalfragment", amount = 20 },
                    { item = "steel", amount = 20 },
                    { item = "ironoxide", amount = 20 },
                }
            },
            {
                from = { item = "phone", amount = 1 }, -- Limit is optional: set an limitation amount of the item in the input
                to = {
                    { item = "rubber", amount = 5 },
                    { item = "aluminum", amount = 5 },
                }
            },
        },
        placeable = {
            enabled = true, -- If you want to allow players to place recyclers
            item = "recycler", -- Item to place a recycler
            pickup = {
                enabled = true, -- If you want to allow players to pick up recyclers
                placerOnly = true, -- If you want only the placer to be able to pick up the recycler
                returnItem = true, -- If you want to return the item to the player after picking up the recycler
            }
        },
        locations = { -- Locations to spawn a recycler on server start
            vector4(1884.4779, 291.0953, 162.2741, 200.1794),
        },
        blips = {
            placeables = true, -- Show blips for placeable recyclers
            locations = true, -- Show blips for recyclers in locations
            settings = {
                sprite = 365,
                color = 4,
                display = 4,
                scale = 1.0,
                shortRange = true,
                label = 'Recycler'
            },
        }
    },
}

--[[
    ONLY UNCOMMENT/CHANGE THIS IF YOU HAVE RENAMED SCRIPTS SUCH AS FRAMEWORK, TARGET, INVENTORY ETC
    RENAME THE SCRIPT NAME TO THE NEW NAME
--]]
-- FM = 'fmLib'
IgnoreResourceNotFoundErrors = false
IgnoreResourceInitializedLogs = true
--[[
BY RX Scripts Š rxscripts.xyz
--]]

function GetPlacingRecyclerCoords()
    local coords = GetEntityCoords(PlayerPedId())
    local forward = GetEntityForwardVector(PlayerPedId())
    coords = (coords + forward) - vector3(0, 0, 2)
  
    local heading = GetEntityHeading(PlayerPedId())

    return coords, heading
end

local function getTargetOpts(recyclerKey, recycler)
    local opts = {}

    if OXTarget then
        opts = {
            {
                name = "Open "..recycler.label,
                label = "Open "..recycler.label,
                icon =  "fas fa-recycle",
                iconColor = "orange",
                distance = 2.5,
                onSelect = function(data)
                    local coords = GetEntityCoords(data.entity)
                    local recyclerId = CoordsToKey(coords.x, coords.y, coords.z)
                    OpenRecycler(recyclerKey, recyclerId, coords)
                end,
            },
        }
    elseif QBTarget then
        opts = {
            options = {
                {
                    icon = "fas fa-recycle",
                    label = "Open "..recycler.label,
                    action = function(entity)
                        local coords = GetEntityCoords(entity)
                        local recyclerId = CoordsToKey(coords.x, coords.y, coords.z)
                        OpenRecycler(recyclerKey, recyclerId, coords)
                    end
                },
            },
            distance = 2.5
        }
    end

    return opts
end

function InitGlobalRecyclerTarget(recyclerKey, recycler)
    if OXTarget then
        OXTarget:addModel(recycler.prop, getTargetOpts(recyclerKey, recycler))
    elseif QBTarget then
        QBTarget:AddTargetModel(recycler.prop, getTargetOpts(recyclerKey, recycler))
    end
end

function InitLocalRecyclerTarget(name, recycler, entity)
    if OXTarget then
        OXTarget:addLocalEntity(entity, getTargetOpts(name, recycler))
    elseif QBTarget then
        QBTarget:AddTargetEntity(entity, getTargetOpts(name, recycler))
    end
end

function InitPickupRecyclerTarget(key, recycler, entity)
    if OXTarget then
        OXTarget:addLocalEntity(entity, {
            {
                name = "Pick up "..recycler.label,
                label = "Pick up "..recycler.label,
                icon =  "fas fa-recycle",
                iconColor = "green",
                distance = 2.5,
                onSelect = function()
                    PickupRecycler(key, recycler.label)
                end,
            },
        })
    elseif QBTarget then
        QBTarget:AddTargetEntity(entity, {
            options = {
                {
                    icon = "fas fa-recycle",
                    label = "Pick up "..recycler.label,
                    action = function()
                        PickupRecycler(key, recycler.label)
                    end
                },
            },
            distance = 2.5
        })
    end
end
PreviousInstallationNextExports

Last updated 1 year ago

🌐
📝