2023-12-07 15:45:48 -08:00
local QBCore = exports [ 'qb-core' ]: GetCoreObject ()
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
TriggerClientEvent ( 'inventory:client:ItemBox' , src , QBCore.Shared . Items [ item ], "add" , amount )
Player.Functions . AddItem ( item , amount )
2024-07-16 14:14:48 -07:00
Log ( Player.PlayerData . charinfo.firstname .. ' ' .. Player.PlayerData . charinfo.lastname .. ' Bought ' .. amount .. ' Of ' .. item .. ' For ' .. tonumber ( price ) * tonumber ( amount ) .. '!' , 'merchant' )
2023-12-07 15:45:48 -08:00
end
end )