Y_ini help!
#1

Hello,

How can i copy the name of the userfile and create a new file with the same name??

This is what i was using in /setname with dini
pawn Код:
format(string, sizeof(string), "%s.ini", PlayerName(giveplayerid));
                    dini_Remove(string);// How can i  do this with y_ini
                    format(string2, sizeof(string2), "%s.ini", tmp);
                    dini_Create(string2); // How can i  do this with y_ini
Please help me to understand this. Thanks !

- Ballu Miaa
Reply
#2

are you using y_ini or d_ini?

i would load all the info for the ini then use the code that creates the ini with the new name then
use this to delete the old file

https://sampwiki.blast.hk/wiki/Fremove
Reply
#3

Get player's name and store it in a variable. Then SetPlayerName( The ID of the player to set the name of, The name to set ); and GetPlayerName (to get the new name) and create the new file with the name.
Last use fremove to delete the account from the first player's name.
pawn Код:
// Setname Command
new
    id, Name[ MAX_PLAYER_NAME ], NewName[ MAX_PLAYER_NAME ], string[ 32 ], str[ 32 ], varname[ 24 ];

GetPlayerName( id, Name, MAX_PLAYER_NAME );
format( string, sizeof( string ), "Users\%s.ini", Name );

SetPlayerName( id, varname );
GetPlayerName( id, NewName, MAX_PLAYER_NAME );
format( str, sizeof( str ), "Users\%s.ini", NewName ); // The File Location
new INI:File = INI_Open( str );
// Rest
INI_Close(file);

fremove( string ); // Remove the first Account Name
Reply
#4

Edit: removed already solved.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)