From c6b6a4ad6872ae5cf25cdd6d8aee663bc4277926 Mon Sep 17 00:00:00 2001 From: Vortrex <3858226+VortrexFTW@users.noreply.github.com> Date: Fri, 9 Sep 2022 02:11:55 -0500 Subject: [PATCH] Add local money --- scripts/client/economy.js | 32 ------------------------------- scripts/client/main.js | 5 ++++- scripts/client/utilities.js | 38 ++++++++++++++++++++++++++++++++++--- 3 files changed, 39 insertions(+), 36 deletions(-) diff --git a/scripts/client/economy.js b/scripts/client/economy.js index ae69e034..9f5b54d2 100644 --- a/scripts/client/economy.js +++ b/scripts/client/economy.js @@ -8,38 +8,6 @@ // TYPE: Client (JavaScript) // =========================================================================== -let currencyString = "${AMOUNT}"; -// =========================================================================== - -function getCurrencyString(amount) { - let tempString = currencyString; - tempString = tempString.replace("{AMOUNT}", toString(makeLargeNumberReadable(amount))); - return tempString; -} - -// =========================================================================== - -function updateLocalPlayerMoney() { - if (localPlayer == null) { - return false; - } - - if (typeof localPlayer.money != "undefined") { - localPlayer.money = toInteger(amount); - } - - if (getGame() == AGRP_GAME_GTA_IV) { - natives.setMultiplayerHudCash(amount); - } -} - -// =========================================================================== - -function setLocalPlayerMoney(amount) { - logToConsole(LOG_DEBUG, `[VRR.Utilities] Setting local player money`); - localPlayerCash = amount; - updateLocalPlayerMoney(); -} // =========================================================================== \ No newline at end of file diff --git a/scripts/client/main.js b/scripts/client/main.js index cca84983..382d5208 100644 --- a/scripts/client/main.js +++ b/scripts/client/main.js @@ -92,6 +92,9 @@ let serverData = { jobs: [], }; -let localPlayerCash = 0; +let localPlayerMoney = 0; +let localPlayerMoneyInterval = null; + +let currencyString = "${AMOUNT}"; // =========================================================================== diff --git a/scripts/client/utilities.js b/scripts/client/utilities.js index 89d2e1ea..3c97f782 100644 --- a/scripts/client/utilities.js +++ b/scripts/client/utilities.js @@ -558,8 +558,6 @@ function setProfanityFilterState(state) { updateChatBox(); } - - // =========================================================================== function processVehicleCruiseControl() { @@ -578,4 +576,38 @@ function processVehicleCruiseControl() { if (cruiseControl) { setVehicleSpeed(cruiseControlSpeed); } -} \ No newline at end of file +} + +// =========================================================================== + +function getCurrencyString(amount) { + let tempString = currencyString; + tempString = tempString.replace("{AMOUNT}", toString(makeLargeNumberReadable(amount))); + return tempString; +} + +// =========================================================================== + +function updateLocalPlayerMoney() { + if (localPlayer == null) { + return false; + } + + if (typeof localPlayer.money != "undefined") { + localPlayer.money = toInteger(amount); + } + + if (getGame() == AGRP_GAME_GTA_IV) { + natives.setMultiplayerHudCash(amount); + } +} + +// =========================================================================== + +function setLocalPlayerMoney(amount) { + logToConsole(LOG_DEBUG, `[VRR.Utilities] Setting local player money`); + localPlayerMoney = amount; + updateLocalPlayerMoney(); +} + +// =========================================================================== \ No newline at end of file