Files
md-drugs/server/travellingmerchant.lua
T

15 lines
697 B
Lua
Raw Normal View History

2023-12-07 15:45:48 -08:00
local QBCore = exports['qb-core']:GetCoreObject()
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
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
end)
lib.callback.register('md-drugs:server:GetMerchant', function(source)
return loc
2023-12-07 15:45:48 -08:00
end)