it work. but when i reconnect with that new nick name again i get a register dialog instead of login.
codes.
pawn Код:
CMD:changename(playerid, params[])
{
new name[MAX_PLAYER_NAME],
id,
pname[MAX_PLAYER_NAME],
string[128],
nick[20];
if(PlayerInfo[playerid][Admin] > 5)
{
if(sscanf(params, "us[20]", id, nick)) return SendClientMessage(playerid, COLOR_RED, "SYNTAX: /changename <playername/id> <nickname>");
if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "Invalid-Playerid!");
if(IsPlayerNPC(id)) return SendClientMessage(playerid, COLOR_RED, "You cannot change NPC Bot's name!");
GetPlayerName(id, name, sizeof(name));
GetPlayerName(playerid, pname, sizeof(pname));
SetPlayerName(id, nick);
format(string, sizeof(string), "Administrator %s(ID:%d) has set %s(ID:%d)'s name to %s", pname, playerid, name, id, nick);
SendClientMessageToAll(COLOR_RED, string);
format(string, sizeof(string), "You set %s(ID:%d)'s name to %s", name, id, nick);
SendClientMessage(playerid, COLOR_GREEN, string);
format(string, sizeof(string), "Administrator %s(ID:%d) has set your name to %s", pname, playerid, nick);
SendClientMessage(id, COLOR_RED, string);
format(string, sizeof(string), "ADMIN-SPEC: %s has used /changename", pname);
SentMessageToAdmins(COLOR_GREY, string);
}
else return SendClientMessage(playerid, COLOR_RED, "You must be Administrator Level 5 or higher to use this command!");
return 1;
}