From 6cbd6ef1cfbd7582751284b1a6090903dc17c5bb Mon Sep 17 00:00:00 2001 From: Taavi <97351942+Taavi-AU@users.noreply.github.com> Date: Sun, 9 Oct 2022 21:52:38 +0800 Subject: [PATCH] update --- [esx_addons]/esx_society/server/main.lua | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/[esx_addons]/esx_society/server/main.lua b/[esx_addons]/esx_society/server/main.lua index fd7ea865..a88d7f2c 100644 --- a/[esx_addons]/esx_society/server/main.lua +++ b/[esx_addons]/esx_society/server/main.lua @@ -58,6 +58,21 @@ AddEventHandler('esx_society:getSociety', function(name, cb) cb(GetSociety(name)) end) +RegisterServerEvent('esx_society:checkSocietyBalance') +AddEventHandler('esx_society:checkSocietyBalance', function(society) + local xPlayer = ESX.GetPlayerFromId(source) + local society = GetSociety(society) + + if xPlayer.job.name ~= society.name then + print(('esx_society: %s attempted to call checkSocietyBalance!'):format(xPlayer.identifier)) + return + end + + TriggerEvent('esx_addonaccount:getSharedAccount', society.account, function(account) + TriggerClientEvent("esx:showNotification", xPlayer.source, TranslateCap('check_balance', ESX.Math.GroupDigits(account.money))) + end) +end) + RegisterServerEvent('esx_society:withdrawMoney') AddEventHandler('esx_society:withdrawMoney', function(societyName, amount) local source = source @@ -336,7 +351,6 @@ ESX.RegisterServerCallback('esx_society:setJobSalary', function(source, cb, job, end end) - ESX.RegisterServerCallback('esx_society:setJobLabel', function(source, cb, job, grade, label) local xPlayer = ESX.GetPlayerFromId(source)