SA-MP Forums Archive
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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Money bug ? (/showthread.php?tid=105366)



Money bug ? - 2fast4you - 28.10.2009

Well, everytime people crash / die or respawn, they lose all their money, anyone know how to fix this? Since my playerbase is quiet high and its a major bug.


Re: Money bug ? - Devine - 28.10.2009

Post your code.


Re: Money bug ? - 2fast4you - 28.10.2009

OnPlayerDeath or which one?


Re: Money bug ? - Devine - 28.10.2009

Quote:
Originally Posted by 2fast4you
OnPlayerDeath or which one?
OnPlayerDeath and your spawn code, OnPlayerSpawn or whatever you have it defined as.


Re: Money bug ? - 2fast4you - 28.10.2009

OnPlayerDeath code : http://pastebin.com/m30ecf9ab

OnPlayerSpawn code : http://pastebin.com/m500cf958


Re: Money bug ? - SFather - 28.10.2009

hm. I'v got the same bug. And there's no money reset after player death or spawn in script...


Re: Money bug ? - dice7 - 28.10.2009

Save the money to a variable then and give it to the player on spawn. Reset the money before giving it just in case


Re: Money bug ? - 2fast4you - 28.10.2009

Uhm, could u guide me a bit more pl0x? Like how to do it etc..


Re: Money bug ? - SFather - 29.10.2009

ok, I've made it and test it. Works fine.

at the top of script:

new money[MAX_PLAYERS];
------------------

OnPlayerConnect:

money[playerid] = 0;

-------------------------
OnPlayerDeath:

money[playerid] = GetPlayerMoney(playerid);

----------------------------
OnPlayerSpawn:

GivePlayerMoney(playerid,money[playerid]);

that will save your money summ after death and give it after spawn


Re: Money bug ? - 2fast4you - 29.10.2009

Hmm, when i /kill, my money goes up double , but then goes back to 0?