#Adding random blueprint loot chance
1 messages · Page 1 of 1 (latest)
You add the export to the loot portion of whichever script you want to give out blueprints
So if you want to add it to Taxi job, you add it to the payout part in the server file
It's just a function call, so you add the line
exports['cw-crafting']:giveRandomBlueprint(source, rarity, failChance)
wherever you think the player should get the chance to get one
oh ok i read it was the server file but didnt know exactly where thanks
I have read and re-read this and the documentation and I still cannot get this export to function in my robbery and heist scripts. I clearly am doing something wrong. Can someone help me?
I am receiving no errors client or serverside.
Below is an snippet showing how I have inserted it into the server script:
if Config['ShopRobbery']['black_money'] then
local info = {
worth = count
}
player.Functions.AddItem('markedbills', 1, false, info)
TriggerClientEvent('inventory:client:ItemBox', src, QBCore.Shared.Items['markedbills'], "add")
exports['cw-crafting']:giveRandomBlueprint(source, rarity, failChance)
TriggerClientEvent('inventory:client:ItemBox', src, QBCore.Shared.Items['blueprint'], "add")
discordLog(player.PlayerData.name .. ' - ' .. player.PlayerData.license, ' Gain ' .. count .. '$ on Shop Robbery!')
else
player.Functions.AddMoney('cash', count)
exports['cw-crafting']:giveRandomBlueprint(source, rarity, failChance)
TriggerClientEvent('inventory:client:ItemBox', src, QBCore.Shared.Items['blueprint'], "add")
discordLog(player.PlayerData.name .. ' - ' .. player.PlayerData.license, ' Gain ' .. count .. '$ on Shop Robbery!')
end
Any help would be greatly appreciated.
You need to also define "source" ,"rarity" and "failChance"
If you read the documentation (
) theres even an example with values
I know. I saw it. I guess I just took the above post too literally.
Haha all good
Just wanted to make sure that I have this in the correct spot.
Export works in all robberies and heists, but I cannot seem to get it to function in this particular instance within jim-recycle when searching trash cans.
Here is the snippet:
RegisterServerEvent("jim-recycle:TradeItems", function(data)
local src = source
local table = {}
for i = 1, #Config.RecycleAmounts["Trade"] do
if Config.RecycleAmounts["Trade"][i].amount == data.amount then
table = Config.RecycleAmounts["Trade"][i]
end
end
TriggerEvent("jim-recycle:server:toggleItem", false, "recyclablematerial", data.amount, src)
Wait(1000)
for i = 1, table.itemGive do
TriggerEvent("jim-recycle:server:toggleItem", true, Config.TradeTable[math.random(1, #Config.TradeTable)], math.random(table.Min, table.Max), src)
Wait(100)
end
exports['cw-crafting']:giveRandomBlueprint(source, {min = 1, max = 2}, 100)
end)
However, I am not receiving any errors. I just never seem to receive a blueprint.
Bump for support