Y_Ini problem
#1

Sup guys? I can't seem to figure out why this is not working. Here is my code:
pawn Code:
#define USER_FILE "/Accounts/%s.ini"

stock UserFile(playerid)
{
    new file[128];
    format(file, sizeof(file), USER_FILE, GetPName(playerid));
    return file;
}

    switch(dialogid)
    {
        case 1:
        {
            if(!response) return Kick(playerid);
            print("1");
           
            if(!strlen(inputtext)) return ShowRegister(playerid);
            print("2");
            new INI:File = INI_Open(UserFile(playerid));
            print("3");
            INI_SetTag(File,"data");
            INI_WriteInt(File,"Password",udb_hash(inputtext));
            INI_WriteInt(File,"Cash",0);
            INI_WriteInt(File,"Admin",0);
            INI_WriteInt(File,"Kills",0);
            INI_WriteInt(File,"Deaths",0);
            INI_Close(File);
            print("4");
        }
    }
It stops at "print("2");" and I can't figure out why. Any insight?
Reply
#2

What is the stock/function for UserFile?
Reply
#3

It's the path to the user file.
Reply
#4

Try this
pawn Code:
stock UserFile(playerid)
{
    new string[128],playername[MAX_PLAYER_NAME];
    GetPlayerName(playerid,playername,sizeof(playername));
    format(string,sizeof(string),PATH,playername);
    return string;
}
Reply
#5

Quote:
Originally Posted by Kingunit
View Post
Try this
pawn Code:
stock UserFile(playerid)
{
    new string[128],playername[MAX_PLAYER_NAME];
    GetPlayerName(playerid,playername,sizeof(playername));
    format(string,sizeof(string),PATH,playername);
    return string;
}
Hmm this worked. Thanks. I don't understand why mine didn't work because I have
pawn Code:
playername[MAX_PLAYER_NAME];
    GetPlayerName(playerid,playername,sizeof(playername));
in my own function (GetPName(playerid)).
Reply
#6

And this is the reason you don't strip and replace.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)