12.02.2012, 20:44
How do I do it? I hear fremove is VERY faulty. Is there an include that someone recommends to allow me to do so?
If you have done tests, post your logs of the tests. Post everything that you are using to "test" this theory. Because i also use fremove, and have no trouble with it.
|
CMD:changename(playerid, params[])
{
new
accNewName[MAX_PLAYER_NAME],
accOldName[MAX_PLAYER_NAME],
accChanged,
accStr[128]
;
if(sscanf(params, "us[MAX_PLAYER_NAME]", accChanged, accNewName))
return SendClientMessage(playerid, -1, ""#LIME"<CMD USAGE> "#WHITE"/changename <player id> <new name>");
if( accLogged[accChanged] == false )
return SendClientMessage(playerid, c_RED, "» #"WHITE"That user is not logged in!");
GetPlayerName(accChanged, accOldName, sizeof(accOldName));
fremove(find_accPath(accChanged));
SetPlayerName(accChanged, accNewName);
new
INI:accFile = INI_Open(find_accPath(accChanged) ),
accIP[16],
Float:Position[4],
adminName[MAX_PLAYER_NAME]
;
GetPlayerIp(accChanged, accIP, sizeof(accIP));
GetPlayerPos(accChanged, Position[0], Position[1], Position[2]);
GetPlayerFacingAngle(accChanged, Position[3]);
GetPlayerName(playerid, adminName, sizeof(adminName));
INI_SetTag(accFile, "data");
INI_WriteInt(accFile, "Passcode", accInfo[accChanged][Passcode] );
INI_WriteString(accFile, "RegisteredIP", accIP);
INI_WriteInt(accFile, "Authorization", accInfo[accChanged][Authorization]);
INI_WriteString(accFile, "PreviousName", accOldName);
INI_WriteInt(accFile, "Funds", accInfo[accChanged][Funds]);
INI_WriteInt(accFile, "BankFunds", accInfo[accChanged][BankFunds]);
INI_WriteInt(accFile, "SkinModel", accInfo[accChanged][SkinModel]);
INI_WriteInt(accFile, "Kills", accInfo[accChanged][Kills]);
INI_WriteInt(accFile, "Deaths", accInfo[accChanged][Deaths]);
INI_WriteInt(accFile, "EventsWon", accInfo[accChanged][EventsWon]);
INI_WriteFloat(accFile, "X_Pos", Position[0]);
INI_WriteFloat(accFile, "Y_Pos", Position[1]);
INI_WriteFloat(accFile, "Z_Pos", Position[2]);
INI_WriteFloat(accFile, "Ang_Pos", Position[3]);
INI_Close(accFile);
format(accStr, sizeof(accStr), ""#CYAN"» "#WHITE"You have edited %s's name. Old Name: %s, New Name: %s", accOldName, accOldName, accNewName);
SendClientMessage(playerid, -1, accStr);
format(accStr, sizeof(accStr), ""#CYAN"» "#WHITE"Your name has been edited. Old Name: %s, New Name: %s", accOldName, accNewName);
SendClientMessage(accChanged, -1, accStr);
format(accStr, sizeof(accStr), ""#CYAN"» Administrator %s has edited %s's name to %s.", adminName, accOldName, accNewName);
SendAdminMessage(1, accStr);
return true;
}