File name change - 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: File name change (
/showthread.php?tid=294634)
File name change -
bartje01 - 02.11.2011
Hey all. How can I make it that when someone changes his name ingame his dini file will be editted to that name as well?
I create a player file like this:
pawn Код:
new INI:File = INI_Open(UserPath(playerid));
Now how can I make it that the file name changes if the player name changes?
Re: File name change -
park4bmx - 02.11.2011
i dont know if you can rename the file when the player's name is chagne but what i know is that
you can delete his
old file and make a new one with all his saved data
Re: File name change -
bartje01 - 02.11.2011
Quote:
Originally Posted by park4bmx
i dont know if you can rename the file when the player's name is chagne but what i know is that
you can delete his old file and make a new one with all his saved data 
|
Could you explain me how to delete the old file and make the new file with the stats?
Re: File name change -
Wesley221 - 02.11.2011
You can delete a file by using the function '
fremove'.
When you change his/her name with the command, store everythign that is inside the file in variables. After that delete his/her file, change his/her name, create a new file and save the variables inside the file.
If you need more info, or a small snippet, just post here or pm me
Re: File name change -
bartje01 - 02.11.2011
I attempted to make a remove file command to see if it works.
pawn Код:
COMMAND:remove(playerid,params[])
{
GetPlayerName(playerid, Name, sizeof(Name));
fremove(Name);
return 1;
}
This didn't work.
Re: File name change -
Wesley221 - 02.11.2011
Thats because you have to define the WHOLE path.
pawn Код:
COMMAND:remove(playerid,params[])
{
new Name[24], file[50];
GetPlayerName( playerid, Name, sizeof Name );
format( file, sizeof file, "RegisterSystem/Users/%s.ini", Name );
fremove( file );
return 1;
}
Re: File name change -
bartje01 - 02.11.2011
Quote:
Originally Posted by Wesley221
Thats because you have to define the WHOLE path.
pawn Код:
COMMAND:remove(playerid,params[]) { new Name[24], file[50]; GetPlayerName( playerid, Name, sizeof Name ); format( file, sizeof file, "RegisterSystem/Users/%s.ini", Name ); fremove( file ); return 1; }
|
It worked

Thanks. NO I'll try to make the other parts.
Re: File name change -
bartje01 - 02.11.2011
Quote:
Originally Posted by Wesley221
Thats because you have to define the WHOLE path.
pawn Код:
COMMAND:remove(playerid,params[]) { new Name[24], file[50]; GetPlayerName( playerid, Name, sizeof Name ); format( file, sizeof file, "RegisterSystem/Users/%s.ini", Name ); fremove( file ); return 1; }
|
Hmm, I'm screwing it up xD PLease let me PM youy my script