pawn Code:
#define COLOR_GREY 0xAFAFAFAA
#define COLOR_WHITE 0xFFFFFFAA
CMD:changename(playerid, params[])
{
new newname[MAX_PLAYER_NAME], file1[128], file2[128];
if(sscanf(params, "s[24]", newname)) return SendClientMessage(playerid, COLOR_GREY, "Usage: /changename [New Username]");
if(strlen(newname) < 3 || strlen(newname) > MAX_PLAYER_NAME) return SendClientMessage(playerid, COLOR_GREY, "Invalid username length.");
format(file2, sizeof(file2), "/Users/%s.ini", newname);
if(fexist(file2)) return SendClientMessage(playerid, COLOR_GREY, "The specified username is already taken.");
format(file1, sizeof(file1), "/Users/%s.ini", pName(playerid));
format(file2, sizeof(file2), "/Users/%s.ini", newname);
frename(file1, file2);
SetPlayerName(playerid, newname);
format(file1, sizeof(file1), "You have changed your name to %s.", newname);
SendClientMessage(playerid, COLOR_WHITE, file1);
return 1;
}
You will also need this stock function: