Saving an offline player. (Y_INI) -
streetpeace - 20.09.2014
Hello everybody,
I want to put something into the file of an offline player, I already tried to do something but it isn't work, here's the code :
pawn Код:
new INI:File = INI_Open(filestring);
INI_SetTag(File, "Account Data");
INI_WriteInt(File, "Banned", 0);
INI_Close(File);
Taked from an offline unban command (doesn't work)
Re : Saving an offline player. (Y_INI) -
streetpeace - 20.09.2014
[Account Data]
Here's the tag in the top of a ini file.
Re: Saving an offline player. (Y_INI) -
Abagail - 20.09.2014
Well he just stated that tags cant have spaces so it'd probably have to be, [AccountData]. That
should work.
Re : Saving an offline player. (Y_INI) -
streetpeace - 20.09.2014
It doesn't work and create an other data.
Re: Saving an offline player. (Y_INI) -
PMH - 20.09.2014
pawn Код:
CMD:banplayer(playerid, params[])
{
new PlayerName[24];
if(sscanf(params, "s[24]", PlayerName)) return SendClientMessage(playerid, -1, "Usage: /banplayer (playername)");
new playerpath[40];
format(playerpath, 40, "Users/%s.ini", PlayerName); //Change this to ur account's directory.
if(fexist(playerpath))
{
new INI:File = INI_Open(playerpath);
INI_WriteInt(File, "Banned", 1);
INI_Close(File);
}
else return SendClientMessage(playerid, -1, "That Player Is Not Registered");
}
example code ^6
Re : Saving an offline player. (Y_INI) -
streetpeace - 20.09.2014
don't work
Re: Saving an offline player. (Y_INI) -
Beckett - 20.09.2014
Are you sure it's spelled right? Because if you have "Banned" and "banned" it wont overwrite the "Banned" one.
Re : Saving an offline player. (Y_INI) -
streetpeace - 20.09.2014
It's spelled right.
Re: Saving an offline player. (Y_INI) -
Dangjai - 20.09.2014
pawn Код:
new INI:File = INI_Open(filestring);
INI_SetTag(File, "AccountData");
INI_WriteInt(File, "banned", 0);
INI_Close(File);
Try this
Re: Re : Saving an offline player. (Y_INI) -
IceCube! - 21.09.2014
Quote:
Originally Posted by streetpeace
It doesn't work and create an other data.
|
You also need to change the AccountData in the other account saving location, this is simply because if you don't you are creating a new set of data in the same file, not overwriting the old data.
Look at all your Y_INI Code, then correct this. (There are some locations listed below whilst answering another person).
At the guy above.. How have you done that? As a Tag is loaded in order to locate the script function example:
pawn Код:
LoadAccount_Account(playerid, name[], value[])
Account here being the tag loaded by:
pawn Код:
INI_ParseFile(....,"LoadAccount_%s",
Atleast as I understand it, and PAWN doesn't take spaces.