Saving an offline player. (Y_INI)
#1

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

[Account Data]
Here's the tag in the top of a ini file.
Reply
#3

Well he just stated that tags cant have spaces so it'd probably have to be, [AccountData]. That should work.
Reply
#4

It doesn't work and create an other data.
pawn Код:
[AccountData]
Banned = 0
Reply
#5

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

don't work
Reply
#7

Are you sure it's spelled right? Because if you have "Banned" and "banned" it wont overwrite the "Banned" one.


pawn Код:
"Banned" != "banned"
Reply
#8

It's spelled right.
Reply
#9

pawn Код:
new INI:File = INI_Open(filestring);
INI_SetTag(File, "AccountData");
INI_WriteInt(File, "banned", 0);
INI_Close(File);
Try this
Reply
#10

Quote:
Originally Posted by streetpeace
Посмотреть сообщение
It doesn't work and create an other data.
pawn Код:
[AccountData]
Banned = 0
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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)