SA-MP Forums Archive
Save player money - 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: Save player money (/showthread.php?tid=375294)



Save player money - Stm - 06.09.2012

Im learning how to use enum, and i have a problem again.So im trying to make something like save system in my gamemode and almost everything is done except for some lines of my code that i have error and don`t know why.

Here is what i have done
Код:
#include <YSI\y_ini>

forward LoadUser_data(playerid,name[],value[]);

#define PATH "/Users/%s.ini"

enum pInfo
{
	pMoney
}
new PlayerInfo[MAX_PLAYERS][pInfo];

stock UserPath(playerid)
{
    new string[128],playername[MAX_PLAYER_NAME];
    GetPlayerName(playerid,playername,sizeof(playername));
    format(string,sizeof(string),PATH,playername);
    return string;
}

public LoadUser_data(playerid,name[],value[])
{
    INI_Int("Cash",PlayerInfo[playerid][pMoney]);
	return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
	new INI:File = INI_Open(UserPath(playerid));
	INI_SetTag(File,"data");
	INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
 	INI_Close(File);
    IsPlayerOnWork[playerid] = 0;
	return 1;
}
I have fix the errors.

I'm using this tutorial for help (https://sampforum.blast.hk/showthread.php?tid=273088)


Re: Save player money - Stm - 06.09.2012

I have fix it


Re: Save player money - Stm - 06.09.2012

I have a problem again.When i spawn in game i have 0$, and im buying a car and my money gets -1500$.After i relog my money is 0 again.I have check the file that gets my money and save`s it and is ok.But when a relog the money gets 0 like a just say not just in game and in the write file.What to do?


Re: Save player money - sniperwars - 06.09.2012

Show the full code here please.


Re: Save player money - Stm - 06.09.2012

Can anyone help me?The code is above.