new file[64];
if(dialogid == DIALOG_REG2)
{
if(RegistrationStep[playerid] == 2)
{
if(!response) // If they clicked 'Cancel' or pressed esc
{
SendClientMessage(playerid, COLOR_RED, "Enter your age correctly next time.");
format(file,sizeof(file),"/Users/%s.ini",GetName(playerid));
if(fexist(file))
{
fremove(file);
}
Kick(playerid);
}
else // Pressed ENTER or clicked 'Login' button
{
new age = strval(inputtext);
if(age < 16 || age > 80)
{
ShowPlayerDialog(playerid, DIALOG_REG2, DIALOG_STYLE_INPUT, "BLABLALBA", "BLABLALBA(BLABLALBA) ?", "Enter", "Exit");
SendClientMessage(playerid, COLOR_RED, "Please enter your age(16-80).");
return 0;
}
PlayerInfo[playerid][pAge] = age;
format(string, sizeof(string), "BLABLALBA",PlayerInfo[playerid][pAge]);
SendClientMessage(playerid, COLOR_LIGHTRED, string);
RegistrationStep[playerid] = 3;
ShowPlayerDialog(playerid, DIALOG_REG3, DIALOG_STYLE_LIST, " BLABLALBA", "Los Santos\nLas Venturas\nSan Fierro", "Select", "Exit");
}
}
return 1; // We handled a dialog, so return 1. Just like OnPlayerCommandText.
}
format(file,sizeof(file),"/Users/%s.ini",GetName(playerid));
format(file,sizeof(file),"Users/%s.ini",GetName(playerid));
Try changeing:
PHP код:
PHP код:
|
Are you opening the file above that code somewhere? If you are trying using fclose before using fremove.
|
You are using fremove correctly. Please verify that your directory is in fact "Users" and not "users" or "User". It must be exact.
Chances are, in the spot where the file was created you may be saving it to a different directory (probably something similar) as mentioned above. That's why when it goes to delete the file, it doesn't do anything because "Users" doesn't exist. Otherwise, if you have the file opened and you have not closed it, you will not be able to delete the file. You need to use fclose in order to close the file. |
fclose(file);
fremote(file);
format(file,sizeof(file),"/Users/%s.ini",GetName(playerid));
//replace with
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(file, sizeof(file), "/Users/%s.ini", name);
pawn Код:
|
Which function, fclose? It's simeply fclose(file[]) so in your case it would be fclose(file); right above fremove(file);
So this: PHP код:
|