I’m trying to modify esx_shops to include shops that use dirty money while the regular shops continue to use clean via the config. I added the option to set Currency as either ‘clean’ or ‘dirty’.
Seth = { -- Seth the Meth Kit Dealer
Items = {},
Currency = 'dirty',
DisplayBlip = false,
DisplayMarker = false,
Pos = {
{x = 1390.341, y = 3600.885, z = 38.941}
}
},
then in my server lua i have this within the buyItem event.
if zone.Currency == 'clean' then
if xPlayer.getMoney() >= price then
-- can the player carry the said amount of x item?
if sourceItem.limit ~= -1 and (sourceItem.count + amount) > sourceItem.limit then
TriggerClientEvent('esx:showNotification', _source, _U('player_cannot_hold'))
else
xPlayer.removeMoney(price)
xPlayer.addInventoryItem(itemName, amount)
TriggerClientEvent('esx:showNotification', _source, _U('bought', amount, itemLabel, ESX.Math.GroupDigits(price)))
end
else
local missingMoney = price - xPlayer.getMoney()
TriggerClientEvent('esx:showNotification', _source, _U('not_enough', ESX.Math.GroupDigits(missingMoney)))
end
end
if zone.Currency == 'dirty' then
if xPlayer.getAccount('black_money').money >= price then
-- can the player carry the said amount of x item?
if sourceItem.limit ~= -1 and (sourceItem.count + amount) > sourceItem.limit then
TriggerClientEvent('esx:showNotification', _source, _U('player_cannot_hold'))
else
xPlayer.removeAccountMoney('black_money', price)
xPlayer.addInventoryItem(itemName, amount)
TriggerClientEvent('esx:showNotification', _source, _U('bought', amount, itemLabel, ESX.Math.GroupDigits(price)))
end
else
local missingMoney = price - xPlayer.getAccount('black_money').money
TriggerClientEvent('esx:showNotification', _source, _U('not_enough', ESX.Math.GroupDigits(missingMoney)))
end
end
In all my attempts to date, its charged one currency regardless of whats been set, or both, or none. This particular version breaks it so nothing is bought. No errors in either client or server console. Any insight would be greatly appreciated.