Register System not creating file.
#1

I'm trying to have this register system create a file when the player registers, so it will save their stats.

pawn Код:
if(!strlen(inputtext))
                {
                    ShowPlayerDialog(playerid,dregister,DIALOG_STYLE_INPUT,"Register","Welcome! This account is not registered.\nEnter your own password to create a new account.\nPlease enter the password!","Register","Quit");
                    return 1;
                }
                new hashpass[129];
                WP_Hash(hashpass,sizeof(hashpass),inputtext);
                new INI:file = INI_Open(UserPath(playerid));
                INI_SetTag(file,"Player's Data");
                INI_WriteString(file,"Password",hashpass);
                INI_WriteInt(file,"AdminLevel",0);
                INI_WriteInt(file,"VIP",0);
                INI_WriteInt(file,"Money",0);
                INI_WriteInt(file,"Score",0);
                INI_WriteInt(file,"Kills",0);
                INI_WriteInt(file,"Deaths",0);
                INI_Close(file);
                SendClientMessage(playerid,-1,"You have been successfully registered");
I'm not too sure what I'm doing wrong.

Other info you might need:
pawn Код:
#define PATH "/Users/%s.ini"
pawn Код:
stock UserPath(playerid) // Stock function, for the register system
{
    new string[128],playername[MAX_PLAYER_NAME];
    GetPlayerName(playerid,playername,sizeof(playername));
    format(string,sizeof(string),PATH,playername);
    return string;
}
Reply
#2

Does that folder exist? Also, if the server directory resides in Program Files, are you running the server with admin rights?
Reply
#3

Scriptfiles/Users does exist. And the server directory is located on my desktop within a folder. And no, I'm not executing it as a administrator. I'll try it, though.
Reply
#4

If it is on the desktop then it should work without elevated privileges. The thing is, normal users don't have the permission to create files and folders within the Program Files directory.
Reply
#5

Tried running it as a administrator, and it still doesn't create the .ini file. Do you spot an error in the code? Or any other suggestions you have to offer?

Appreciated.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)