Server error when deleting a user.ini file
#1

So, basically what I want to do is delete a user's file when he quits the server during or before the registration process.

I get this funny error in my server.log and the .ini is not deleted afterwards:
Code:
[14:55:33] *** YSI Info: Invalid line in INI file "/Users/Bible.ini": /Users/Bible.ini =
It even shows a smiley face at the end of the error code (in my server prompt window).

How can I solve this?
This is the code where it deletes the file if the player quits (during the registration process):
pawn Code:
new INI:File = INI_Open(UserPath(playerid));
INI_RemoveEntry(File, UserPath(playerid));
INI_Close(File);
Help is much appreciated.

If you require more information about my script, let me know.
Reply
#2

I don't use YSI, but shouldn't a file be closed before you attempt to delete it?
Reply
#3

Quote:
Originally Posted by Vince
View Post
I don't use YSI, but shouldn't a file be closed before you attempt to delete it?
That makes sense, so what I did is kick the player before deleting the file.
Same error.
Reply
#4

Quote:

Also, that is used to delete a line FROM a file, not delete the file itself.

pawn Code:
if(fexist(UserPath(playerid))
{
     fremove(UserPath(playerid));
}
Reply
#5

Thanks for the help, guys!
Reply
#6

I'm still doing something wrong.. The file is not getting remove even after I replaced the Entry edit to:
pawn Code:
if(fexist(UserPath(playerid)))
                {
                    fremove(UserPath(playerid));
                }
Reply
#7

Post all your code that regards removing file.
Reply
#8

Define of PATH:
pawn Code:
#define     PATH                "/Users/%s.ini"
Stock of UserPath
pawn Code:
stock UserPath(playerid)
{
    new string[128],playername[MAX_PLAYER_NAME];
    GetPlayerName(playerid,playername,sizeof(playername));
    format(string,sizeof(string),PATH,playername);
    return string;
}
OnPlayerConnect (IsValidName)
pawn Code:
public OnPlayerConnect(playerid)
{
    if(!IsValidName(playerid))
    {
        format(kstring, sizeof(kstring), "[AdmCMD] %s has been kicked from the server by THE SERVER, reason: [Inappropiate name]", name1);
        SCMTA(COLOR_LIGHTRED, kstring);
        format(kstring, sizeof(kstring), "[AdmCMD] You have been kicked from the server by THE SERVER, reason: [Inappropiate name]");
        SCM(playerid, COLOR_LIGHTRED, kstring);
        SetTimerEx("kickbugfixer", 1000, false, "i", playerid);
        if(fexist(UserPath(playerid)))
        {
            new INI:File = INI_Open(UserPath(playerid));
            INI_Close(File);
            fremove(UserPath(playerid));
        }
    }
    return 1;
}
if(!response) - This comes back in every register dialog
pawn Code:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
/* This if(!response) comes back in every register dialog */
            if(!response)
            {
                format(qstring, sizeof(qstring), "[AdmCMD] You have chosen to 'Quit', you're always welcome to come back!");
                SCM(playerid, COLOR_LIGHTRED, qstring);
                if(fexist(UserPath(playerid)))
                {
                    new INI:File = INI_Open(UserPath(playerid));
                    INI_Close(File);
                    fremove(UserPath(playerid));
                }
                SetTimerEx("kickbugfix", 1000, false, "i", playerid);
            }
Reply
#9

don't declare new INI:File, Just put fremove function.
Reply
#10

Quote:
Originally Posted by Galletziz
View Post
don't declare new INI:File, Just put fremove function.
That was the first thing I did, but it doesn't work that way.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)