How to add money to my player?
-
Hello guys,
I am new to this forum and to GTA5 modding and I hope you guys can help me. I am trying to code a mod which is adding some money to my player's money. However, I tried different things and in the end, nothing of this worked. I hope you can help me.
-
trainers can do this
-
@Harry_11111010010
int set_player_money(int amount)
{STATS::STAT_SET_INT(0x44BD6982, amount, true); return(0);
}
maybe this code.
-
If someone is still wondering how this is working, this is my solution:
void changePlayerMoney(Ped _Player, int changeMoney) { string playerModelName = _Player.Model.Name; switch (playerModelName) { case "PLAYER_ZERO": //Michael slot = 0; break; case "PLAYER_ONE": //Franklin slot = 1; break; case "PLAYER_TWO": //Trevor slot = 2; break; } int val; bool success = NativeFunction.Natives.StatGetInt<bool>(Game.GetHashKey($"SP{slot}_TOTAL_CASH"), out val, -1); int money = val + changeMoney; NativeFunction.Natives.xB3271D7AB655B441(Game.GetHashKey($"SP{slot}_TOTAL_CASH"), money, true); }