SA-MP Forums Archive
Score saving with Y_ini - 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: Score saving with Y_ini (/showthread.php?tid=341650)



Score saving with Y_ini - Karl[NDZ] - 11.05.2012

Hey guys, I I'm using Y_Ini for saving system and it won't save my money or score but the other things saves.
Here is the codes:
pawn Code:
enum pInfo
{
    pPass,
    pCash,
    pAdmin,
    pKills,
    pDeaths,
    pScore
}
pawn Code:
forward LoadUser_data(playerid,name[],value[]);
public LoadUser_data(playerid,name[],value[])
{
    INI_Int("Password",PlayerInfo[playerid][pPass]);
    INI_Int("Cash",PlayerInfo[playerid][pCash]);
    INI_Int("Admin",PlayerInfo[playerid][pAdmin]);
    INI_Int("Kills",PlayerInfo[playerid][pKills]);
    INI_Int("Deaths",PlayerInfo[playerid][pDeaths]);
    INI_Int("Score",PlayerInfo[playerid][pScore]);
    return 1;
}
pawn Code:
public OnPlayerDisconnect(playerid, reason)
{
    new INI:File = INI_Open(UserPath(playerid));
    INI_SetTag(File,"data");
    INI_WriteInt(File,"Cash", GetPlayerMoney(playerid));
    INI_WriteInt(File,"Admin", PlayerInfo[playerid][pAdmin]);
    INI_WriteInt(File,"Kills", PlayerInfo[playerid][pKills]);
    INI_WriteInt(File,"Deaths", PlayerInfo[playerid][pDeaths]);
    INI_WriteInt(File,"Score", GetPlayerScore(playerid));
    INI_Close(File);
    new pName[MAX_PLAYER_NAME], string[128];
    GetPlayerName(playerid, pName, sizeof(pName));
    switch(reason)
 {
pawn Code:
OnDialogResponse - Register:
                new INI:File = INI_Open(UserPath(playerid));
                INI_SetTag(File,"data");
                INI_WriteInt(File,"Password",udb_hash(inputtext));
                INI_WriteInt(File,"Cash",0);
                INI_WriteInt(File,"Admin",0);
                INI_WriteInt(File,"Kills",0);
                INI_WriteInt(File,"Deaths",0);
                INI_WriteInt(File,"Score",0);
                INI_Close(File);

OnDialogResponse - Login:
         GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
         SetPlayerScore(playerid, PlayerInfo[playerid][pScore]);



Re: Score saving with Y_ini - Ballu Miaa - 11.05.2012

Is this is the same enum you're using?
pawn Code:
enum pInfo
{
    pPass,
    pCash,
    pAdmin,
    pKills,
    pDeaths,
    pScore
}
new PlayerInfo[MAX_PLAYERS][pInfo];



Re: Score saving with Y_ini - Karl[NDZ] - 11.05.2012

Quote:
Originally Posted by Ballu Miaa
View Post
Is this is the same enum you're using?
pawn Code:
enum pInfo
{
    pPass,
    pCash,
    pAdmin,
    pKills,
    pDeaths,
    pScore
}
new PlayerInfo[MAX_PLAYERS][pInfo];
Yes, sorry I forgot to put it here but I have it


Re: Score saving with Y_ini - Karl[NDZ] - 11.05.2012

Quote:
Originally Posted by ******
View Post
Have you considered using y_uvar? This provides a simplified wrapper over y_ini so that you don't need to worry about loading or saving code at all. Your example would simply become:

pawn Code:
enum pInfo
{
    pPass,
    pCash,
    pAdmin,
    pKills,
    pDeaths,
    pScore
}

uvar gPlayerData[MAX_PLAYERS][pInfo];
I will use what I have, sorry.


Re: Score saving with Y_ini - Ballu Miaa - 11.05.2012

Quote:
Originally Posted by Karl[NDZ]
View Post
I will use what I have, sorry.
Lol listen to ****** if you want a better script. We are noobs , Hes the king here lol.


Re: Score saving with Y_ini - Karl[NDZ] - 11.05.2012

Hehe. Sorry I thought I could do it without it. But anyways, if I add that to my gm will it save the score and money?