Save player money
#1

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)
Reply
#2

I have fix it
Reply
#3

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?
Reply
#4

Show the full code here please.
Reply
#5

Can anyone help me?The code is above.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)