y_ini Not saving ...
#1

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

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

Delete
Reply
#4

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

ok trying
Reply
#6

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]); 
Reply
#7

Not working anything else ?
Reply
#8

Let me try
Reply
#9

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


Forum Jump:


Users browsing this thread: 1 Guest(s)