SA-MP Forums Archive
Fremove. - 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: Fremove. (/showthread.php?tid=433518)



Fremove. - dorperez - 27.04.2013

I have this code but the fremove function is not working ..
pawn Код:
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.
    }
Can someone help me ?


Re: Fremove. - dorperez - 27.04.2013

UP.....


Re: Fremove. - Chenko - 27.04.2013

Try changeing:

PHP код:
 format(file,sizeof(file),"/Users/%s.ini",GetName(playerid)); 
to

PHP код:
 format(file,sizeof(file),"Users/%s.ini",GetName(playerid)); 



Re: Fremove. - dorperez - 27.04.2013

Quote:
Originally Posted by Chenko
Посмотреть сообщение
Try changeing:

PHP код:
 format(file,sizeof(file),"/Users/%s.ini",GetName(playerid)); 
to

PHP код:
 format(file,sizeof(file),"Users/%s.ini",GetName(playerid)); 
Didn't worked bro ..


Re: Fremove. - Chenko - 27.04.2013

Are you opening the file above that code somewhere? If you are trying using fclose before using fremove.


Re: Fremove. - RVRP - 27.04.2013

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.


Re: Fremove. - dorperez - 27.04.2013

Quote:
Originally Posted by Chenko
Посмотреть сообщение
Are you opening the file above that code somewhere? If you are trying using fclose before using fremove.
Quote:
Originally Posted by RVRP
Посмотреть сообщение
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.
How can I use this function in my script ?


Re: Fremove. - Chenko - 27.04.2013

Which function, fclose? It's simeply fclose(file[]) so in your case it would be fclose(file); right above fremove(file);

So this:

PHP код:
fclose(file);
fremote(file); 



Re: Fremove. - Glad2BeHere - 27.04.2013

pawn Код:
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);
replace the


Re: Fremove. - dorperez - 28.04.2013

Quote:
Originally Posted by Glad2BeHere
Посмотреть сообщение
pawn Код:
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);
replace the
Quote:
Originally Posted by Chenko
Посмотреть сообщение
Which function, fclose? It's simeply fclose(file[]) so in your case it would be fclose(file); right above fremove(file);

So this:

PHP код:
fclose(file);
fremote(file); 
I did it and its not deleting the file :\\