SA-MP Forums Archive
Y_INI Writing multiple lines. - 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: Y_INI Writing multiple lines. (/showthread.php?tid=509516)



Y_INI Writing multiple lines. - rangerxxll - 27.04.2014

I'm a bit confused as to why this integer is writing multiple times. Any help is appreciated.

This is in the players file when only one should be there.

Код:
Hit Amount = 0
Hit Amount = 0
These are a few stocks and public functions I've created for saving purposes.

pawn Код:
stock SaveAccount(playerid)
{
    new INI:file = INI_Open(UserPath(playerid));
    INI_SetTag(file, "Player Data");
    INI_WriteInt(file, "Score", GetPlayerScore(playerid));
    INI_WriteInt(file, "Money", GetPlayerMoney(playerid));
    INI_WriteInt(file, "Admin", pInfo[playerid][pAdmin]);
    INI_WriteInt(file, "Vip", pInfo[playerid][pVip]);
    INI_WriteInt(file, "Team", pInfo[playerid][pTeam]);
    INI_WriteInt(file, "Skin", GetPlayerSkin(playerid));
    INI_WriteInt(file, "Kills", pInfo[playerid][pKills]);
    INI_WriteInt(file, "Deaths", pInfo[playerid][pDeaths]);
    INI_WriteInt(file, "Wanted", GetPlayerWantedLevel(playerid));
    INI_WriteInt(file, "Hit Amount", pInfo[playerid][pHitAmount]);
    INI_Close(file);
    return 1;
}


public LoadAccount_data(playerid, name[], value[])
{
    INI_Int("Password", pInfo[playerid][pPass]);
    INI_Int("Score", pInfo[playerid][pScore]);
    INI_Int("Money", pInfo[playerid][pMoney]);
    INI_Int("Admin", pInfo[playerid][pAdmin]);
    INI_Int("Vip", pInfo[playerid][pVip]);
    INI_Int("Team", pInfo[playerid][pTeam]);
    INI_Int("Skin", pInfo[playerid][pSkin]);
    INI_Int("Kills", pInfo[playerid][pKills]);
    INI_Int("Deaths", pInfo[playerid][pDeaths]);
    INI_Int("Wanted", pInfo[playerid][pWanted]);
    INI_Int("Hit Amount", pInfo[playerid][pHitAmount]);
    return 1;
}

//And when they register on the proper dialog.

new INI:file = INI_Open(UserPath(playerid));
            INI_SetTag(file, "Player Data");
            INI_WriteInt(file, "Password", udb_hash(inputtext));
            INI_WriteInt(file, "Admin", 0);
            INI_WriteInt(file, "Score", 0);
            INI_WriteInt(file, "Money", 0);
            INI_WriteInt(file, "Vip", 0);
            INI_WriteInt(file, "Team", 0); //temp
            INI_WriteInt(file, "Skin", 0);
            INI_WriteInt(file, "Kills", 0);
            INI_WriteInt(file, "Deaths", 0);
            INI_WriteInt(file, "Wanted", 0); //not wanted upon register.
            INI_WriteInt(file, "Hit Amount", 0); //Doesn't have a bounty
            INI_Close(file);



Re: Y_INI Writing multiple lines. - biker122 - 27.04.2014

I'm quiet sure that you can't have spaces while writing them into an INI file.
Try using them as Hit_Amount


Re: Y_INI Writing multiple lines. - Zex Tan - 27.04.2014

http://forum.sa-mp.com/showpost.php?...83&postcount=9

Thread: https://sampforum.blast.hk/showthread.php?tid=399238

Try searching next time


Re: Y_INI Writing multiple lines. - itsCody - 27.04.2014

Spaces will cause them to double I think

so if you're going to have a space use _ "Player_Data" "Hit_Amount" ectect


Re: Y_INI Writing multiple lines. - rangerxxll - 27.04.2014

Thanks for the responses.

Just to clarify, I attempted to use "_" but it lead to no avail. So I just combined it into HitAmount which works. Strange, but it works.

Thanks guys.