mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-08-31 18:28:52 +00:00
Merge pull request #12 from Sylundef/master
Use mecano account when isMecanoJobOnly = true
This commit is contained in:
+28
-11
@@ -4,17 +4,34 @@ local Vehicles = nil
|
||||
|
||||
RegisterServerEvent('esx_lscustom:buyMod')
|
||||
AddEventHandler('esx_lscustom:buyMod', function(price)
|
||||
local _source = source
|
||||
local xPlayer = ESX.GetPlayerFromId(_source)
|
||||
price = tonumber(price)
|
||||
if price > xPlayer.getMoney() then
|
||||
TriggerClientEvent('esx_lscustom:cancelInstallMod', _source)
|
||||
TriggerClientEvent('esx:showNotification', _source, _U('not_enough_money'))
|
||||
else
|
||||
xPlayer.removeMoney(price)
|
||||
TriggerClientEvent('esx_lscustom:installMod', _source)
|
||||
TriggerClientEvent('esx:showNotification', _source, _U('purchased'))
|
||||
end
|
||||
local _source = source
|
||||
local xPlayer = ESX.GetPlayerFromId(_source)
|
||||
price = tonumber(price)
|
||||
|
||||
if Config.IsMecanoJobOnly == true then
|
||||
local societyAccount = nil
|
||||
TriggerEvent('esx_addonaccount:getSharedAccount', 'society_mecano', function(account)
|
||||
societyAccount = account
|
||||
end)
|
||||
if price < societyAccount.money then
|
||||
TriggerClientEvent('esx_lscustom:installMod', _source)
|
||||
TriggerClientEvent('esx:showNotification', _source, _U('purchased'))
|
||||
societyAccount.removeMoney(price)
|
||||
else
|
||||
TriggerClientEvent('esx_lscustom:cancelInstallMod', _source)
|
||||
TriggerClientEvent('esx:showNotification', _source, _U('not_enough_money'))
|
||||
end
|
||||
|
||||
else
|
||||
if price < xPlayer.getMoney() then
|
||||
TriggerClientEvent('esx_lscustom:installMod', _source)
|
||||
TriggerClientEvent('esx:showNotification', _source, _U('purchased'))
|
||||
xPlayer.removeMoney(price)
|
||||
else
|
||||
TriggerClientEvent('esx_lscustom:cancelInstallMod', _source)
|
||||
TriggerClientEvent('esx:showNotification', _source, _U('not_enough_money'))
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
RegisterServerEvent('esx_lscustom:refreshOwnedVehicle')
|
||||
|
||||
Reference in New Issue
Block a user