Files
2026-02-21 14:30:25 -08:00

77 lines
3.4 KiB
Lua

framework = 'bigdaddy' --VALUES CAN BE 'nat', 'qb', 'esx', 'nd', 'bigdaddy' or 'custom'
reason = 'Fish' --reason for the transaction will notify using framework methods
useSociety = false
toSocietyaccount = ''
local currencySymbol = '$'
if framework == 'nat' then
print('Framework set to nat')
elseif framework == 'qb' then
QBCore = exports['qb-core']:GetCoreObject()
elseif framework == 'esx' then
ESX = exports["es_extended"]:getSharedObject()
elseif framework == 'nd' then
NDCore = exports.ND_Core:GetCoreObject()
elseif framework == 'bigdaddy' then
print('Framework set to Big Daddy')
elseif framework == 'custom' then
print('LOAD CORE OBJECT HERE IF REQUIRED, if not then you may disregard this statement.')
else
print('FRAMEWORK IS NOT SET PROPERLY FOR RESOURCE! Check server.lua in ' .. GetCurrentResourceName() .. ' for money events. The current value is set to ' .. framework .. ', and this is not a valid selection.' )
end
RegisterNetEvent('BigDaddy-Fishing:GetPaid', function(amount, toPlayerId)
local src = source
if framework == 'nat' then
local account = exports.money:getaccount(src)
if (tonumber(account.bank) >= tonumber(amount)) then
local newbalance = tonumber(account.cash) - tonumber(amount)
exports.money:updateaccount(src, {cash = newbalance, bank = account.bank})
exports.money:bankNotify(src, 'Fish' .. ' ' .. currencySymbol .. amount )
end
elseif framework == 'qb' then
local Player = QBCore.Functions.GetPlayer(src)
if (Player.Functions.GetMoney(cash) >= tonumber(amount)) then
Player.Functions.RemoveMoney('cash', tonumber(amount), 'Fish')
if (useSociety) then
exports['qb-management']:AddMoney(toSocietyaccount, tonumber(amount))
end
TriggerClientEvent('QBCore:Notify', src, reason, 'primary', 5000)
end
elseif framework == 'esx' then
local xPlayer = ESX.GetPlayerFromId(src)
if (xPlayer.getAccount("cash") >= tonumber(amount)) then
xPlayer.removeAccountMoney('cash', tonumber(amount))
xPlayer.showNotification(reason)
end
elseif framework == 'nd' then
local Player = NDCore.Functions.GetPlayer(src)
if (Player.bank >= amount) then
NDCore.Functions.DeductMoney(amount, src, 'cash', reason)
end
elseif framework == 'bigdaddy' then
if toPlayerId > -1 then
local toaccount = exports['BigDaddy-Money']:GetAccounts(toPlayerId, toPlayerId, -1)
local todata = json.decode(toaccount)
local newtobalance = tonumber(todata.cash) + tonumber(amount)
exports['BigDaddy-Money']:UpdateTotals(toPlayerId, todata.bank, newtobalance, todata.dirty, -1)
TriggerClientEvent("BigDaddy-Money:Notify", toPlayerId, 'Received ' .. currencySymbol .. string.format("%.2f", amount) .. ' ' .. reason)
end
elseif framework == 'custom' then
--INSERT CUSTOM CODE HERE FOR CASH MANAGEMENT
else
print('FRAMEWORK IS NOT SET PROPERLY FOR RESOURCE! Check server.lua in ' .. GetCurrentResourceName() .. ' for money events. The current value is set to ' .. framework .. ', and this is not a valid selection.' )
end
end)
RegisterNetEvent('BigDaddy-Fishing:AddItem', function(itemDesc, toPlayerId)
local src = source
end)
RegisterNetEvent('BigDaddy-Fishing:RemoveItem', function(itemDesc, toPlayerId)
local src = source
end)