SA-MP Forums Archive
y_ini Not saving ... - 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 Not saving ... (/showthread.php?tid=515889)



y_ini Not saving ... - rockhopper - 28.05.2014

I am making a rep system for my server using y_ini The data saves nicely But when i Restart the server or change something is Scriptfiles Then it goes back to zero
Here it is :-
Код:
Reputation
#define UserPath "reputation/%s.ini"
enum PlayerInfo
{
    Reputation,
}
new pInfo[MAX_PLAYERS][PlayerInfo];

stock Path(playerid)
{
    new str[128],name[MAX_PLAYER_NAME];
    GetPlayerName(playerid,name,sizeof(name));
    format(str,sizeof(str),UserPath,name);
    return str;
}

forward loadaccount_user(playerid, name[], value[]);
public loadaccount_user(playerid, name[], value[])
{
    INI_Int("Reputation",pInfo[playerid][Reputation]);
    return 1;
}
In on player connect :-
new name[128];
    GetPlayerName(playerid,name,sizeof(name));
    if(fexist(Path(name)))
    {
        INI_ParseFile(Path(name),"loadaccount_%s", .bExtra = true, .extra = playerid);
    }
    else
    {
        return 1;
    }

On player disconnect Reputation
new INI:file = INI_Open(Path(playerid));
    INI_SetTag(file,"Player's Data");
    INI_WriteInt(file,"Reputation",pInfo[playerid][Reputation]);
    INI_Close(file);
Please help me I am New with y_ini


Re: y_ini Not saving ... - rockhopper - 28.05.2014

Please guyz im trying to figure it out from 3 days help me


Re: y_ini Not saving ... - NaClchemistryK - 28.05.2014

Delete


Re: y_ini Not saving ... - rumen98 - 28.05.2014

hmm try to make:
#define UserPath "reputation/%s.ini"
to
#define UserPath "/reputation/%s.ini"


Re: y_ini Not saving ... - rockhopper - 28.05.2014

ok trying


Re: y_ini Not saving ... - rumen98 - 28.05.2014

If dont work, That should work
http://pastebin.com/jAqx5AyQ


Edit:
Under OnPlayerDisconnect:
Make
PHP код:
    INI_WriteInt(File"Reputation"wInfo[playerid][Reputation]); 
to
PHP код:
   INI_WriteInt(File"Reputation"pInfo[playerid][Reputation]); 



Re: y_ini Not saving ... - rockhopper - 28.05.2014

Not working anything else ?


Re: y_ini Not saving ... - rockhopper - 28.05.2014

Let me try


Re: y_ini Not saving ... - rockhopper - 28.05.2014

OMG!! Working thanks a lot +REP !!!