/shop & /bombshop - money bug. - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: /shop & /bombshop - money bug. (
/showthread.php?tid=286146)
/shop & /bombshop - money bug. -
Yamoo - 27.09.2011
Alright, lads this all complies into one.
The amount of cash you log in with stays there until you log out, say for an example - you log out with -5,000 and you'll log back in with -5,000 and get up to the positives; $6,000.
You'll still not be able to buy from /shop and /bombshop due to the simple fact you logged in with -5,000.
If you log in with positive $5,000 and waste it all in /shop or /bombshop then you can keep buying stuff even whilst in the negative - when you log out you'll log back in with negative.
Is there anyway you can update the money stats whilst in-game automatically?
This is one of my cases from /shop (exact same to every other case)
pawn Код:
case 1:{
if(PlayerInfo[playerid][pCash] <= 1499)
{
SendClientMessage(playerid, GREY, "Shop: You need $1500!");
return 1;
}
else if(PlayerInfo[playerid][pCash] >= 1500)
GivePlayerWeapon(playerid, 31, 600);
GivePlayerMoney(playerid, -1500);
This is what I have to write in my scriptfile - OnPlayerDisconnect.
pawn Код:
INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
I have this in my /stats
pawn Код:
new cash = PlayerInfo[playerid][pCash];
This is when loading up the data.
pawn Код:
INI_Int("Cash",PlayerInfo[playerid][pCash]);
Re: /shop & /bombshop - money bug. -
Wesley221 - 27.09.2011
Where you do GivePlayerMoney(playerid, -1500);, you should do PlayerInfo[playerid][pCash]=- 1500;. Otherwise it just removes it from the money from the player, but not from the variable
Edit: If you want to add things to the variable, you should use the '+='. (if you didnt know this already)