#Trying to add hotdog item after success sale of hotdog job hotdog

1 messages · Page 1 of 1 (latest)

lunar stratus
#

Resource: qb-hotdog

Here is what i have done, it is not giving the hotdog though.. what am i missing lol

RegisterNetEvent('qb-hotdogjob:server:Sell', function(coords, amount, price)
    local src = source
    local pCoords = GetEntityCoords(GetPlayerPed(src))
    local Player = QBCore.Functions.GetPlayer(src)
    if not Player then return end
    if #(pCoords - coords) > 4 then exports['qb-core']:ExploitBan(src, 'hotdog job') end
    Player.Functions.AddMoney('cash', tonumber(amount * price), 'sold hotdog')
    TriggerClientEvent('qb-inventory:client:ItemBox', src, QBCore.Shared.Items['hotdog'], 'add')
end)
gaunt nexus
#

All you're doing is adding an item box, you're not giving an item.

#

exports['qb-inventory']:AddItem(identifier, item, amount, slot, info, reason)

lunar stratus
#

I have gotten this far, still not giving item when exotic hotdog is cooked 😦

RegisterNetEvent('qb-hotdogjob:server:UpdateReputation', function(quality)
    local src = source
    local Player = QBCore.Functions.GetPlayer(src)
    if quality == 'exotic' then
        if Player.Functions.GetRep('hotdog') + 3 > Config.MaxReputation then
            Player.Functions.AddRep('hotdog', Config.MaxReputation - Player.Functions.GetRep('hotdog'))
            local amount = math.random(1, 2)
            exports['qb-inventory']:AddItem(src, 'hotdog', amount, false, false, 'qb-hotdogjob:server:UpdateReputation')
            TriggerClientEvent('qb-inventory:client:ItemBox', src, QBCore.Shared.Items['hotdog'], 'add')
        else
            Player.Functions.AddRep('hotdog', 3)
        end
    elseif quality == 'rare' then
        if Player.Functions.GetRep('hotdog') + 2 > Config.MaxReputation then
            Player.Functions.AddRep('hotdog', Config.MaxReputation - Player.Functions.GetRep('hotdog'))
        else
            Player.Functions.AddRep('hotdog', 2)
        end
    elseif quality == 'common' then
        if Player.Functions.GetRep('hotdog') + 1 > Config.MaxReputation then
            Player.Functions.AddRep('hotdog', Config.MaxReputation - Player.Functions.GetRep('hotdog'))
        else
            Player.Functions.AddRep('hotdog', 1)
        end
    end

    TriggerClientEvent('qb-hotdogjob:client:UpdateReputation', src, Player.PlayerData.metadata['rep'])
end)
gaunt nexus
#

When do you trigger that event.

#

Add prints so you can see what is going on.