đConfigurables
--[[
BY RX Scripts Š rxscripts.xyz
--]]
Config = {}
Config.Money = 'black_money' -- The type of money that will be used to pay for the items.
Config.ImgDirectory = 'ox_inventory/web/images/' -- The directory where the images are stored.
Config.PickUp = { -- Picking up the item after its bought
enabled = true, -- If this is set to false, the pickup will be ignored and the item will be added to the players inventory.
location = vector3(372.2360, 3409.7803, 35.4053),
heading = 66.8821,
model = 'g_m_m_chicold_01', -- The model of the ped that will be spawned.
}
Config.RandomLocations = { -- Random locations for the black market laptop.
vector4(92.8279, 3751.4629, 40.7711, 326.4801),
}
Config.TrackClosestMarket = { -- Tracks the most nearby black market the player has access to.
enabled = true,
item = 'tracker', -- Do not use the same item as other markets have as tracker.
remove = true,
time = 60,
}
Config.BlackMarkets = {
['Criminal Market'] = { -- The name of the black market must be unique.
coords = vector4(92.7370, 3754.4297, 40.5986, 70.0),
type = 'ped', -- 'laptop' or 'ped'
pedModel = 'a_m_y_hasjew_01', -- The model of the ped that will be spawned, only used if type is 'ped'.
randomizeLocation = false, -- Overrides the coords above and randomizes the location from the Config.RandomLocations table.
trackLocation = {
enabled = true,
item = 'phone', -- Unique item that will be used to track the location of the black market.
remove = true, -- If this is set to true, the item will be removed from the players inventory.
time = 60, -- The amount of time in seconds that the blip/route will be shown on the map.
},
requiredItem = {
enabled = false,
item = 'phone',
},
jobsRequired = {
enabled = false,
jobs = {
"dealer",
}
},
randomizeItems = {
enabled = false,
amount = 3,
},
payWithItem = {
enabled = false, -- If this is set to false, the item will be paid with an money account, otherwise the price will be the amount of the item required.
item = 'coin',
itemLabel = 'Coin',
},
items = {
{
item = "WEAPON_ASSAULTRIFLE",
label = 'Assault Rifle',
price = 3,
},
{
item = "ammo-rifle2",
label = 'Rifle Ammo 2',
price = 100,
},
{
item = "bodybag",
label = 'Body Bag',
price = 2500,
},
{
item = "armour",
label = 'Armour',
price = 3500,
},
{
item = "at_flashlight",
label = 'Flashlight',
price = 100,
},
}
},
}
--[[
INITIALIZATION SECTION
ONLY UNCOMMENT/CHANGE THIS IF YOU HAVE RENAMED SCRIPTS SUCH AS FRAMEWORK, TARGET, INVENTORY ETC
RENAME THE SCRIPT NAME TO THE NEW NAME
--]]
-- ESX = 'es_extended'
-- QB = 'qb-core'
-- OXTarget = 'ox_target'
-- QBTarget = 'qb-target'
IgnoreResourceNotFoundErrors = false
--[[
BY RX Scripts Š rxscripts.xyz
--]]
function Notify(msg, type)
if Core == 'ESX' then
CoreObj.ShowNotification(msg, type)
elseif Core == 'QB' then
CoreObj.Functions.Notify(msg, type)
end
end
function AddTarget(name, bOptions)
if Target == 'OX' then
exports.ox_target:addLocalEntity(bOptions.obj, {
{
label = "Open " .. name,
name = name,
icon = "fas fa-laptop",
iconColor = "black",
distance = 2.5,
onSelect = function()
OpenBlackMarket(name, bOptions)
end,
},
})
elseif Target == 'QB' then
exports['qb-target']:AddTargetEntity(bOptions.obj, {
options = {
{
num = 1,
icon = "fas fa-laptop",
label = "Open " .. name,
action = function()
OpenBlackMarket(name, bOptions)
end
},
},
distance = 2.5
})
end
end
function AddPickupTarget(entity, name)
if Target == 'OX' then
exports.ox_target:addLocalEntity(entity, {
{
label = "Pickup Items",
name = name,
icon = "fas fa-boxes",
iconColor = "red",
distance = 2.5,
onSelect = function()
PickupItems()
end,
},
})
elseif Target == 'QB' then
exports['qb-target']:AddTargetEntity(entity, {
options = {
{
num = 1,
icon = "fas fa-boxes",
label = "Pickup Items",
action = function()
PickupItems()
end
},
},
distance = 2.5
})
end
end
function HasItem(item)
if Core == 'ESX' then
return CoreObj.SearchInventory(item, 1) > 0
elseif Core == 'QB' then
return CoreObj.Functions.HasItem(item)
end
end
function IsJobAllowed(jobs)
if Core == 'ESX' then
local playerData = CoreObj.GetPlayerData()
for k, v in pairs(jobs) do
if playerData.job.name == v then
return true
end
end
elseif Core == 'QB' then
local playerData = CoreObj.Functions.GetPlayerData()
for k, v in pairs(jobs) do
if playerData.job.name == v then
return true
end
end
end
return false
end
--[[
BY RX Scripts Š rxscripts.xyz
--]]
function GetBlackMoney(player)
if Core == 'ESX' then
return player.getAccount(Config.Money).money
elseif Core == 'QB' then
return player.PlayerData.money[Config.Money]
end
end
function RemoveBlackMoney(player, amount)
if Core == 'ESX' then
player.removeAccountMoney(Config.Money, amount)
elseif Core == 'QB' then
player.Functions.RemoveMoney(Config.Money, amount)
end
end
function GetPlayerById(src)
if Core == 'ESX' then
return CoreObj.GetPlayerFromId(src)
elseif Core == 'QB' then
return CoreObj.Functions.GetPlayer(src)
end
end
function GetIdentifier(player)
if Core == 'ESX' then
return player.identifier
elseif Core == 'QB' then
return player.PlayerData.license
end
end
function AddPlayerItem(player, item, amount)
if Core == 'ESX' then
player.addInventoryItem(item, amount)
elseif Core == 'QB' then
player.Functions.AddItem(item, amount)
end
end
function GetItemAmount(player, item)
if Core == 'ESX' then
return player.getInventoryItem(item).count
elseif Core == 'QB' then
return player.Functions.GetItemByName(item).amount
end
end
function RemoveItem(player, item, amount)
if Core == 'ESX' then
player.removeInventoryItem(item, amount)
elseif Core == 'QB' then
player.Functions.RemoveItem(item, amount)
end
end
function IsJobAllowed(src, jobs)
if Core == 'ESX' then
local player = CoreObj.GetPlayerFromId(src)
for k, job in pairs(jobs) do
if job == player.job.name then
return true
end
end
elseif Core == 'QB' then
local player = CoreObj.Functions.GetPlayer(src)
for k, job in pairs(jobs) do
if job == player.PlayerData.job.name then
return true
end
end
end
return false
end
function RegisterUsableItem(itemName, cb)
if Core == 'ESX' then
CoreObj.RegisterUsableItem(itemName, function(src, item)
cb(src, item)
end)
elseif Core == 'QB' then
CoreObj.Functions.CreateUseableItem(itemName, function(src, item)
cb(src, item)
end)
end
end
Last updated