SA-MP Forums Archive
Register System not creating file. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Register System not creating file. (/showthread.php?tid=420611)



Register System not creating file. - rangerxxll - 05.03.2013

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;
}



Re: Register System not creating file. - Vince - 05.03.2013

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


Re: Register System not creating file. - rangerxxll - 05.03.2013

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.


Re: Register System not creating file. - Vince - 05.03.2013

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.


Re: Register System not creating file. - rangerxxll - 05.03.2013

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.