Server error when deleting a user.ini file -
AndySedeyn - 30.04.2014
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.
Re: Server error when deleting a user.ini file -
Vince - 30.04.2014
I don't use YSI, but shouldn't a file be closed
before you attempt to delete it?
Re: Server error when deleting a user.ini file -
AndySedeyn - 30.04.2014
Quote:
Originally Posted by Vince
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.
Re: Server error when deleting a user.ini file -
Galletziz - 30.04.2014
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));
}
Re: Server error when deleting a user.ini file -
AndySedeyn - 30.04.2014
Thanks for the help, guys!
Re: Server error when deleting a user.ini file -
AndySedeyn - 30.04.2014
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));
}
Re: Server error when deleting a user.ini file -
Galletziz - 30.04.2014
Post all your code that regards removing file.
Re: Server error when deleting a user.ini file -
AndySedeyn - 30.04.2014
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);
}
Re: Server error when deleting a user.ini file -
Galletziz - 30.04.2014
don't declare new INI:File, Just put fremove function.
Re: Server error when deleting a user.ini file -
AndySedeyn - 30.04.2014
Quote:
Originally Posted by Galletziz
don't declare new INI:File, Just put fremove function.
|
That was the first thing I did, but it doesn't work that way.