mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-09-02 11:18:53 +00:00
Implemented processing license
This commit is contained in:
@@ -32,6 +32,26 @@ AddEventHandler('esx_drugs:sellDrug', function(itemName, amount)
|
||||
TriggerClientEvent('esx:showNotification', source, _U('dealer_sold', amount, xItem.label, ESX.Math.GroupDigits(price)))
|
||||
end)
|
||||
|
||||
ESX.RegisterServerCallback('esx_drugs:buyLicense', function(source, cb, licenseName)
|
||||
local xPlayer = ESX.GetPlayerFromId(source)
|
||||
local license = Config.LicensePrices[licenseName]
|
||||
|
||||
if license == nil then
|
||||
print(('esx_drugs: %s attempted to buy an invalid license!'):format(xPlayer.identifier))
|
||||
cb(false)
|
||||
end
|
||||
|
||||
if xPlayer.getMoney() >= license.price then
|
||||
xPlayer.removeMoney(license.price)
|
||||
|
||||
TriggerEvent('esx_license:addLicense', source, licenseName, function()
|
||||
cb(true)
|
||||
end)
|
||||
else
|
||||
cb(false)
|
||||
end
|
||||
end)
|
||||
|
||||
RegisterServerEvent('esx_drugs:pickedUpCannabis')
|
||||
AddEventHandler('esx_drugs:pickedUpCannabis', function()
|
||||
local xPlayer = ESX.GetPlayerFromId(source)
|
||||
|
||||
Reference in New Issue
Block a user