diff --git a/PlayerCompanion.RuntimePatching/Patches.cs b/PlayerCompanion.RuntimePatching/Patches.cs
index 8529478..16ed9c7 100644
--- a/PlayerCompanion.RuntimePatching/Patches.cs
+++ b/PlayerCompanion.RuntimePatching/Patches.cs
@@ -15,16 +15,8 @@ internal static class MoneyGetterPatch2
{
public static bool Prefix(ref int __result)
{
- switch ((SHVDN2::GTA.Native.PedHash)SHVDN2::GTA.Game.Player.Character.Model)
- {
- case SHVDN2::GTA.Native.PedHash.Michael:
- case SHVDN2::GTA.Native.PedHash.Franklin:
- case SHVDN2::GTA.Native.PedHash.Trevor:
- return true;
- default:
- __result = Companion.Wallet.Money;
- return false;
- }
+ __result = Companion.Wallet.Money;
+ return false;
}
}
@@ -37,16 +29,8 @@ internal static class MoneySetterPatch2
{
public static bool Prefix(ref int value)
{
- switch ((SHVDN2::GTA.Native.PedHash)SHVDN2::GTA.Game.Player.Character.Model)
- {
- case SHVDN2::GTA.Native.PedHash.Michael:
- case SHVDN2::GTA.Native.PedHash.Franklin:
- case SHVDN2::GTA.Native.PedHash.Trevor:
- return true;
- default:
- Companion.Wallet.Money = value;
- return false;
- }
+ Companion.Wallet.Money = value;
+ return false;
}
}
@@ -63,16 +47,8 @@ internal static class MoneyGetterPatch3
{
public static bool Prefix(ref int __result)
{
- switch ((SHVDN3::GTA.PedHash)SHVDN3::GTA.Game.Player.Character.Model)
- {
- case SHVDN3::GTA.PedHash.Michael:
- case SHVDN3::GTA.PedHash.Franklin:
- case SHVDN3::GTA.PedHash.Trevor:
- return true;
- default:
- __result = Companion.Wallet.Money;
- return false;
- }
+ __result = Companion.Wallet.Money;
+ return false;
}
}
@@ -85,16 +61,8 @@ internal static class MoneySetterPatch3
{
public static bool Prefix(ref int value)
{
- switch ((SHVDN3::GTA.PedHash)SHVDN3::GTA.Game.Player.Character.Model)
- {
- case SHVDN3::GTA.PedHash.Michael:
- case SHVDN3::GTA.PedHash.Franklin:
- case SHVDN3::GTA.PedHash.Trevor:
- return true;
- default:
- Companion.Wallet.Money = value;
- return false;
- }
+ Companion.Wallet.Money = value;
+ return false;
}
}
diff --git a/PlayerCompanion/PlayerCompanion.csproj b/PlayerCompanion/PlayerCompanion.csproj
index 63169a7..d9a8af1 100644
--- a/PlayerCompanion/PlayerCompanion.csproj
+++ b/PlayerCompanion/PlayerCompanion.csproj
@@ -24,6 +24,7 @@
git
en-US
..\bin\$(Configuration)
+ true
diff --git a/PlayerCompanion/Wallet.cs b/PlayerCompanion/Wallet.cs
index 96d79e3..5023ce0 100644
--- a/PlayerCompanion/Wallet.cs
+++ b/PlayerCompanion/Wallet.cs
@@ -1,4 +1,5 @@
using GTA;
+using GTA.Native;
using GTA.UI;
using Newtonsoft.Json;
using System;
@@ -40,7 +41,26 @@ public int this[Model model]
{
if (model == PedHash.Michael || model == PedHash.Franklin || model == PedHash.Trevor)
{
- return Game.Player.Money;
+ int stat = 0;
+ switch ((PedHash)model)
+ {
+ case PedHash.Michael:
+ stat = Game.GenerateHash("SP0_TOTAL_CASH");
+ break;
+ case PedHash.Franklin:
+ stat = Game.GenerateHash("SP1_TOTAL_CASH");
+ break;
+ case PedHash.Trevor:
+ stat = Game.GenerateHash("SP2_TOTAL_CASH");
+ break;
+ }
+
+ int result = 0;
+ unsafe
+ {
+ Function.Call(Hash.STAT_GET_INT, stat, &result, -1);
+ }
+ return result;
}
else
{
@@ -64,7 +84,20 @@ public int this[Model model]
if (model == PedHash.Michael || model == PedHash.Franklin || model == PedHash.Franklin)
{
- Game.Player.Money = value;
+ int stat = 0;
+ switch ((PedHash)model)
+ {
+ case PedHash.Michael:
+ stat = Game.GenerateHash("SP0_TOTAL_CASH");
+ break;
+ case PedHash.Franklin:
+ stat = Game.GenerateHash("SP1_TOTAL_CASH");
+ break;
+ case PedHash.Trevor:
+ stat = Game.GenerateHash("SP2_TOTAL_CASH");
+ break;
+ }
+ Function.Call(Hash.STAT_SET_INT, stat, value, 1);
}
else
{