adding new scripts and mlos
This commit is contained in:
@@ -0,0 +1,77 @@
|
||||
|
||||
framework = 'bigdaddy' --VALUES CAN BE 'nat', 'qb', 'esx', 'nd', 'bigdaddy' or 'custom'
|
||||
|
||||
reason = 'Game' --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-Hunting: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, 'Game' .. ' ' .. 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), 'Game')
|
||||
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-Hunting:AddItem', function(itemDesc, toPlayerId)
|
||||
local src = source
|
||||
end)
|
||||
|
||||
RegisterNetEvent('BigDaddy-Hunting:RemoveItem', function(itemDesc, toPlayerId)
|
||||
local src = source
|
||||
end)
|
||||
Reference in New Issue
Block a user