Advertisement
Lindholmbrahe

OKOKBank

May 28th, 2024
821
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.14 KB | None | 0 0
  1. --
  2. -- Society
  3. --
  4. local usingNewQBBanking = GetResourceState("qb-banking") == "started" and tonumber(string.sub(GetResourceMetadata("qb-banking", "version"), 1, 3)) >= 2
  5. local usingokokBanking = GetResourceState("okokBanking") == "started" -- added support for okokBanking
  6.  
  7. function Framework.Server.RemoveFromSocietyFund(societyName, type, amount)
  8.   if Config.Framework == "QBCore" then
  9.     if usingokokBanking then  -- added support for okokBanking
  10.       exports['okokBanking']:RemoveMoney(societyName, amount)  -- added support for okokBanking
  11.     elseif usingNewQBBanking then -- changed
  12.       exports['qb-banking']:RemoveMoney(societyName, amount)
  13.     else
  14.       if type == "job" then
  15.         exports['qb-management']:RemoveMoney(societyName, amount)
  16.       elseif type == "gang" then
  17.         exports['qb-management']:RemoveGangMoney(societyName, amount)
  18.       end
  19.     end
  20.   elseif Config.Framework == "ESX" then
  21.     if type == "cash" then type = "money" end
  22.  
  23.     TriggerEvent('esx_society:getSociety', societyName, function(society)
  24.       TriggerEvent('esx_addonaccount:getSharedAccount', society.account, function(account)
  25.         account.removeMoney(amount)
  26.       end)
  27.     end)
  28.   end
  29. end
  30.  
  31. Framework.Server.CreateCallback("jg-dealerships:server:get-society-balance", function(src, cb, society, type)
  32.   if Config.Framework == "QBCore" then
  33.     if usingokokBanking then -- added support for okokBanking
  34.       cb(exports['okokBanking']:GetAccount(society)) -- added support for okokBanking
  35.     elseif usingNewQBBanking then -- changed
  36.       cb(exports['qb-banking']:GetAccountBalance(society))
  37.     else
  38.       if type == "job" then
  39.         cb(exports['qb-management']:GetAccount(society))
  40.       elseif type == "gang" then
  41.         cb(exports['qb-management']:GetGangAccount(society))
  42.       end
  43.     end
  44.   elseif Config.Framework == "ESX" then
  45.     if type == "cash" then type = "money" end
  46.  
  47.     TriggerEvent('esx_society:getSociety', society, function(data)
  48.       if not data then return cb(0) end
  49.       TriggerEvent('esx_addonaccount:getSharedAccount', data.account, function(account)
  50.         cb(account.money)
  51.       end)
  52.     end)
  53.   end
  54. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement