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=539922)
fremove -
streetpeace - 01.10.2014
It removes the file contain but it doesn't remove the .ini file.
Just like this :
X.ini
When I open it :
Empty.
Re: fremove -
Sawalha - 01.10.2014
You should fclose it first after fopen it then do fremove.
and remember it should be in
folder.
pawn Код:
fclose("X.ini");
fremove("X.ini");
Re : fremove -
streetpeace - 01.10.2014
Doesn't work.
Re : fremove -
streetpeace - 01.10.2014
up pls.
pawn Код:
format(filestring, sizeof(filestring), "Users/%s.ini", GetPlayerRName(target));
new File:Test = fopen(filestring);
fclose(Test);
fremove(filestring);
SetPlayerName(target, text);
fcreate(filestring);
This is my code.
AW: fremove -
NaS - 01.10.2014
Well, you create it again, so why is it wrong that it still exists?
If this is a rename script, you should do "fcreate" with the new name (text variable), so
pawn Код:
fcreate(text); // format it first
instead of
Re : fremove -
streetpeace - 01.10.2014
pawn Код:
if(sscanf(params, "us[128]", target, text)) return SendClientMessage(playerid, -1, "Usage: /setname [playerid] [name]");
Filestring locates the Users file script and it has the same result in the final because I set a new username before creating the new file, like this :
pawn Код:
SetPlayerName(target, text);
fcreate(filestring);
Re: AW: fremove -
Sascha - 01.10.2014
Quote:
Originally Posted by NaS
Well, you create it again, so why is it wrong that it still exists?
If this is a rename script, you should do "fcreate" with the new name (text variable), so
pawn Код:
fcreate(text); // format it first
instead of
|
Yea, just that you don't reformat the "filestring"
you want to create a new file, but you create exactly the same file again (same name)
you should use
pawn Код:
format(filestring, sizeof(filestring), "Users/%s.ini", GetPlayerRName(target));
new File:Test = fopen(filestring);
fclose(Test);
fremove(filestring);
SetPlayerName(target, text);
format(filestring, sizeof(filestring), "User/%s.ini", text); //NEW LINE - Reformat filestring to make it point to the new location
fcreate(filestring);
Re : fremove -
streetpeace - 01.10.2014
IT WORKS, thanks ! +rep.