fremove
#1

It removes the file contain but it doesn't remove the .ini file.
Just like this :
X.ini
When I open it :
Empty.
Reply
#2

You should fclose it first after fopen it then do fremove.
and remember it should be in
Код:
 scriptfiles
folder.
pawn Код:
fclose("X.ini");
fremove("X.ini");
Reply
#3

Doesn't work.
Reply
#4

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.
Reply
#5

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

pawn Код:
fcreate(filestring);
Reply
#6

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);
Reply
#7

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

pawn Код:
fcreate(filestring);
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);
Reply
#8

IT WORKS, thanks ! +rep.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)