#Adding random blueprint loot chance

1 messages · Page 1 of 1 (latest)

sage mirage
#

ive read the read me, the script works perfectly just a little confused as to where to insert the export that would a give a player the chance to get a random blue print threw activities or jobs. Which folder of each script do i insert the export thanks.

crystal orchid
#

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

sage mirage
#

oh ok i read it was the server file but didnt know exactly where thanks

fossil niche
#

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.

crystal orchid
fossil niche
crystal orchid
#

If you read the documentation ( Kek ) theres even an example with values

fossil niche
crystal orchid
#

Haha all good

fossil niche
# crystal orchid 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.

fossil niche
#

Bump for support