đ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
Last updated