2023-12-07 15:45:48 -08:00
|
|
|
local QBCore = exports['qb-core']:GetCoreObject()
|
2024-09-24 15:07:41 -07:00
|
|
|
local loc = math.random(1, #Config.Travellingmerchant)
|
2024-05-02 18:34:49 -07:00
|
|
|
RegisterServerEvent("md-drugs:server:travellingmerchantox", function(amount, money, item, price,table,num)
|
2023-12-07 15:45:48 -08:00
|
|
|
local src = source local Player = QBCore.Functions.GetPlayer(src)
|
2024-05-02 18:34:49 -07:00
|
|
|
if not table[num]['name'] == item then return end
|
2023-12-07 15:45:48 -08:00
|
|
|
if Player.Functions.RemoveMoney(tostring(money), tonumber(price) * tonumber(amount)) then
|
2024-09-24 15:07:41 -07:00
|
|
|
AddItem(source, item, amount)
|
|
|
|
|
Log(GetName(source) .. ' Bought ' .. amount .. ' Of ' .. item .. ' For ' .. tonumber(price) * tonumber(amount) .. '!', 'merchant')
|
2023-12-07 15:45:48 -08:00
|
|
|
end
|
|
|
|
|
|
2024-09-24 15:07:41 -07:00
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
lib.callback.register('md-drugs:server:GetMerchant', function(source)
|
|
|
|
|
return loc
|
2023-12-07 15:45:48 -08:00
|
|
|
end)
|