SA-MP Forums Archive
Y_ini creating the file, but not saving stats in it - 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: Y_ini creating the file, but not saving stats in it (/showthread.php?tid=472716)



Y_ini creating the file, but not saving stats in it - knackworst - 30.10.2013

Hello I'm switching from SII to Y_ini.

However I've got some trouble.
When a player joins the server and their name isn't known yet they see the register dialog.
When a player types in his password his password and IP should be saved in the .ini file. However the file is created for the specific player, but it's empty...

Here's my code:
pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
   
    //Stuf
    if(!fexist(file) && PInfo[playerid][Logged] == 0)
    {
        ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, "Register", "Enter your password:", "Register", "");
    }

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == DIALOG_REGISTER && response)
    {
        if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, "Register", "Password invalid, Enter your password:", "Register", "");

        SendClientMessage(playerid,COLOR_GREEN,"Registered");
       
        new INI:Player = INI_Open(GetPlayerPath(playerid));
        INI_SetTag(Player, "Data");
        INI_WriteInt(Player,"Password", udb_hash(inputtext));
        INI_WriteInt(Player, "Level", 0);
        INI_Close(Player);
       
        //other stuff, messages etc
    }
So I register to the server, then pause the game and go check the scriptfiles\Players folder and see my name as a .ini file, however when I open it, it's just empty... no tag, no pass, no ip...

Any help?


Re: Y_ini creating the file, but not saving stats in it - knackworst - 30.10.2013

Did some further testing, and it loads properly.
However still doesn't save...


Re: Y_ini creating the file, but not saving stats in it - ]Rafaellos[ - 30.10.2013

Password must be written as String not Int.


Re: Y_ini creating the file, but not saving stats in it - Konstantinos - 30.10.2013

udb_hash returns an integer so it's fine. Though, I don't know what the problem is.


Re: Y_ini creating the file, but not saving stats in it - Patrick - 30.10.2013

Quote:
Originally Posted by ]Rafaellos[
Посмотреть сообщение
Password must be written as String not Int.
No, udb_hash returns an integer, so his codes are right, I suggest you try using whirpool instead.


Re: Y_ini creating the file, but not saving stats in it - gtakillerIV - 30.10.2013

Run the server.exe as an Admin. I had the same problem. It's a permissions problem from what I see.


Re: Y_ini creating the file, but not saving stats in it - knackworst - 30.10.2013

Quote:
Originally Posted by gtakillerIV
Посмотреть сообщение
Run the server.exe as an Admin. I had the same problem. It's a permissions problem from what I see.
Yes it worked, but the problem is that to run it as an administrator I need a password (because I use the family pc instead of my own because my own is to old to run SAMP) which I don't know...


Re: Y_ini creating the file, but not saving stats in it - ikbenremco - 30.10.2013

Try to move your samp server's folder to like desktop and see if it still needs the permission.

Since some folders in your C drive can be protected


Re: Y_ini creating the file, but not saving stats in it - knackworst - 31.10.2013

nope :/
Anyways, thanks for the help