SA-MP Forums Archive
Cash don't save until Kick. - 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: Cash don't save until Kick. (/showthread.php?tid=380572)



Cash don't save until Kick. - CrossOv3r - 26.09.2012

Well, i have work a new GM from 0, and i have serious problem i use Y_INI
This is my GM: http://pastebin.com/AjeyBt9f

Problem:

1.- The player register(you recieve 5000$ on the start)
2 .- If you try to loggin whit the user account, and you press the "quit" button, the server Kick the player
3 .- Then if you going to see the Scriptfiles, the player file (.ini) has the line of the money on 0$ cash


Any explication, help me please! D: Thanks


Re: Cash don't save until Kick. - zDevon - 26.09.2012

From your first thread,
Quote:
Originally Posted by zDevon
Посмотреть сообщение
First off, you have done you password success/failure dialogs yet - and you've never spawned the player anywhere. Just a note.
____________________________________________
Anyway, your problem persists in the method you're using to get the player's money. GetPlayerMoney (which is the function you're using under OnPlayerDisconnect, and writing to the player file) returns just that - the player's money. From the green hud in the top right. Problem is, you never properly used GivePlayerMoney, so that green cash counter remained at zero. Thus zero is what was written to your files.

Under OnDialogResponse, change
pawn Код:
INI_WriteInt(File,"Cash",GivePlayerMoney(playerid,5000));
to
pawn Код:
INI_WriteInt(File,"Cash",0);
and add
pawn Код:
GivePlayerMoney(playerid,5000);
underneath INI_Close(File);

Add this to OnPlayerSpawn,
pawn Код:
GivePlayerMoney(playerid,PlayerInfo[playerid][pCash]);
Almost sure that I didn't miss anything. Send me a PM if I did and we'll get it sorted out .



Re: Cash don't save until Kick. - trapstar2020 - 26.09.2012

ummm u need to loop a savestats everything under onplayerdisconnect u would need to loop a savestats there