17 lines
778 B
Lua
17 lines
778 B
Lua
|
QBCore = exports['qb-core']:GetCoreObject()
|
||
|
|
||
|
QBCore.Functions.CreateCallback('hp_subway:getMoney', function(source, cb, pris)
|
||
|
local xPlayer = QBCore.Functions.GetPlayer(source)
|
||
|
local pris = math.abs(pris)
|
||
|
if xPlayer.Functions.GetMoney('cash') >= pris then
|
||
|
xPlayer.Functions.RemoveMoney('cash', pris, "Metrobillet")
|
||
|
TriggerClientEvent('HudNotification', source, 'success', 'HP Banen', 'Du købte en metrobillet for '..pris..',-')
|
||
|
cb(true)
|
||
|
elseif xPlayer.Functions.GetMoney('bank') >= pris then
|
||
|
xPlayer.Functions.RemoveMoney('bank', pris, "Metrobillet")
|
||
|
TriggerClientEvent('HudNotification', source, 'success', 'HP Banen', 'Du købte en metrobillet for '..pris..',-')
|
||
|
cb(true)
|
||
|
else
|
||
|
cb(false)
|
||
|
end
|
||
|
end)
|