26.09.2012, 23:53
Quote:
Use the function SetPlayerName to change a user's name when they are currently in game.
As for detecting if the username is already taken, format the path of the new name and use fexist to determine if it's taken or not. (If your using MySQL, fexist will not work obviously). If the user's file currently exists and they are registered, you can use this custom stock function: pawn Code:
|
Like this?
pawn Code:
CMD:changename(playerid,params[])
{
SendClientMessage(playerid, white, "{FFFF00}Usage: /changename [NewName]");
if(length < 3 || length > MAX_PLAYER_NAME) return SendClientMessage(playerid,white,"{FF0000}>> Incorrect Name Length");
new string[64];
format(string,sizeof(string),"Your have been changed your current Name to %s, ", tmp);
SendClientMessage(playerid, LIGHTBLUE, string);
SetPlayerName(playerid, );
return OnPlayerConnect(playerid);
}