01.10.2014, 11:47
It removes the file contain but it doesn't remove the .ini file.
Just like this :
X.ini
When I open it :
Empty.
Just like this :
X.ini
When I open it :
Empty.
scriptfiles
fclose("X.ini");
fremove("X.ini");
format(filestring, sizeof(filestring), "Users/%s.ini", GetPlayerRName(target));
new File:Test = fopen(filestring);
fclose(Test);
fremove(filestring);
SetPlayerName(target, text);
fcreate(filestring);
fcreate(text); // format it first
fcreate(filestring);
if(sscanf(params, "us[128]", target, text)) return SendClientMessage(playerid, -1, "Usage: /setname [playerid] [name]");
SetPlayerName(target, text);
fcreate(filestring);
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 Код:
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);