diff --git a/client/main.lua b/client/main.lua index ce606b3..2e24340 100644 --- a/client/main.lua +++ b/client/main.lua @@ -75,20 +75,6 @@ AddEventHandler("playerSpawned", function() DecorSetInt(PlayerPedId(), k, v) end - if enableNative[1] then - N_0xc2d15bef167e27bc() - SetPlayerCashChange(1, 0) - Citizen.InvokeNative(0x170F541E1CADD1DE, true) - SetPlayerCashChange(-1, 0) - end - - if enableNative[2] then - SetMultiplayerBankCash() - Citizen.InvokeNative(0x170F541E1CADD1DE, true) - SetPlayerCashChange(0, 1) - SetPlayerCashChange(0, -1) - end - TriggerServerEvent('playerSpawn') end) @@ -112,18 +98,14 @@ RegisterNetEvent('es:displayMoney') AddEventHandler('es:displayMoney', function(a) enableNative[1] = true - -- Found by FiveM forum user @Lobix300 - N_0xc2d15bef167e27bc() - SetPlayerCashChange(1, 0) - Citizen.InvokeNative(0x170F541E1CADD1DE, true) - SetPlayerCashChange(a, 0) + SetMultiplayerHudCash(a, 0) + StatSetInt(GetHashKey("MP0_WALLET_BALANCE"), a) end) RegisterNetEvent('es:displayBank') AddEventHandler('es:displayBank', function(a) enableNative[2] = true - -- Found by FiveM forum user @Lobix300 SetMultiplayerBankCash() SetPlayerCashChange(0, 1) Citizen.InvokeNative(0x170F541E1CADD1DE, true) @@ -131,7 +113,7 @@ AddEventHandler('es:displayBank', function(a) end) RegisterNetEvent("es:addedMoney") -AddEventHandler("es:addedMoney", function(m, native) +AddEventHandler("es:addedMoney", function(m, native, current) if not native then SendNUIMessage({ @@ -139,8 +121,8 @@ AddEventHandler("es:addedMoney", function(m, native) money = m }) else - Citizen.InvokeNative(0x170F541E1CADD1DE, true) - SetPlayerCashChange(math.floor(m), 0) + SetMultiplayerHudCash(current, 0) + StatSetInt(GetHashKey("MP0_WALLET_BALANCE"), current) end end) @@ -153,8 +135,8 @@ AddEventHandler("es:removedMoney", function(m, native, current) money = m }) else - Citizen.InvokeNative(0x170F541E1CADD1DE, true) - SetPlayerCashChange(-math.floor(m), 0) + SetMultiplayerHudCash(current, 0) + StatSetInt(GetHashKey("MP0_WALLET_BALANCE"), current) end end) diff --git a/server/classes/player.lua b/server/classes/player.lua index d9a185a..e51c19c 100644 --- a/server/classes/player.lua +++ b/server/classes/player.lua @@ -32,12 +32,13 @@ function CreatePlayer(source, permission_level, money, bank, identifier, license self.money = m if((prevMoney - newMoney) < 0)then - TriggerClientEvent("es:addedMoney", self.source, math.abs(prevMoney - newMoney), tonumber(settings.defaultSettings.nativeMoneySystem)) + TriggerClientEvent("es:addedMoney", self.source, math.abs(prevMoney - newMoney), (settings.defaultSettings.nativeMoneySystem == "1")) else - TriggerClientEvent("es:removedMoney", self.source, math.abs(prevMoney - newMoney), tonumber(settings.defaultSettings.nativeMoneySystem)) + TriggerClientEvent("es:removedMoney", self.source, math.abs(prevMoney - newMoney), (settings.defaultSettings.nativeMoneySystem == "1")) end if settings.defaultSettings.nativeMoneySystem == "0" then + print("setmoney!!!!!!!!!!") TriggerClientEvent('es:activateMoney', self.source , self.money) end else @@ -83,8 +84,9 @@ function CreatePlayer(source, permission_level, money, bank, identifier, license self.money = newMoney - TriggerClientEvent("es:addedMoney", self.source, m, tonumber(settings.defaultSettings.nativeMoneySystem)) + TriggerClientEvent("es:addedMoney", self.source, m, (settings.defaultSettings.nativeMoneySystem == "1"), self.money) if settings.defaultSettings.nativeMoneySystem == "0" then + print("addmoney!!!!!!!!!!") TriggerClientEvent('es:activateMoney', self.source , self.money) end else @@ -99,8 +101,9 @@ function CreatePlayer(source, permission_level, money, bank, identifier, license self.money = newMoney - TriggerClientEvent("es:removedMoney", self.source, m, tonumber(settings.defaultSettings.nativeMoneySystem)) - if settings.defaultSettings.nativeMoneySystem ~= "0" then + TriggerClientEvent("es:removedMoney", self.source, m, (settings.defaultSettings.nativeMoneySystem == "1"), self.money) + if settings.defaultSettings.nativeMoneySystem == "0" then + print("removemoney!!!!!!!!!!") TriggerClientEvent('es:activateMoney', self.source , self.money) end else @@ -134,11 +137,12 @@ function CreatePlayer(source, permission_level, money, bank, identifier, license end rTable.displayMoney = function(m) - if type(m) == "number" then + if type(m) == "number" then if not self.moneyDisplayed then if settings.defaultSettings.nativeMoneySystem ~= "0" then TriggerClientEvent("es:displayMoney", self.source, math.floor(m)) else + print("displaymoney!!!!!!!!!!") TriggerClientEvent('es:activateMoney', self.source , self.money) end diff --git a/server/util.lua b/server/util.lua index cd4a5ce..d1ad476 100644 --- a/server/util.lua +++ b/server/util.lua @@ -14,7 +14,7 @@ settings.defaultSettings = { ['startingBank'] = GetConvar('es_startingBank', '0'), ['enableRankDecorators'] = GetConvar('es_enableRankDecorators', 'false'), ['moneyIcon'] = GetConvar('es_moneyIcon', '$'), - ['nativeMoneySystem'] = GetConvar('es_nativeMoneySystem', '0'), + ['nativeMoneySystem'] = GetConvar('es_nativeMoneySystem', '1'), ['commandDelimeter'] = GetConvar('es_commandDelimeter', '/'), ['enableLogging'] = GetConvar('es_enableLogging', 'false'), ['enableCustomData'] = GetConvar('es_enableCustomData', 'false')