Optimize money sync
This commit is contained in:
@@ -18,4 +18,28 @@ function getCurrencyString(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();
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -48,7 +48,7 @@ function addAllNetworkHandlers() {
|
||||
addNetworkEventHandler("agrp.heading", setLocalPlayerHeading);
|
||||
addNetworkEventHandler("agrp.interior", setLocalPlayerInterior);
|
||||
addNetworkEventHandler("agrp.spawned", onServerSpawnedLocalPlayer);
|
||||
addNetworkEventHandler("agrp.money", setLocalPlayerCash);
|
||||
addNetworkEventHandler("agrp.money", setLocalPlayerMoney);
|
||||
addNetworkEventHandler("agrp.armour", setLocalPlayerArmour);
|
||||
addNetworkEventHandler("agrp.localPlayerSkin", setLocalPlayerSkin);
|
||||
addNetworkEventHandler("agrp.pedSpeak", makeLocalPlayerPedSpeak);
|
||||
|
||||
Reference in New Issue
Block a user