08.11.2013, 15:26
(
Последний раз редактировалось iFiras; 11.09.2014 в 03:10.
)
Deleted.
dcmd_changename(playerid, params[])
{
new targetid, name[128], newname[16];
if(AdminLevel[playerid] < 5) return SCM(playerid,COLOR_WHITE,"{FF0000}[ERROR] {FFFFFF}You don't have an appropriate administration level to use this command.");
else if (sscanf(params,"us",targetid,name))SendClientMessage(playerid,COLOR_WHITE,""COL_ORANGE"[USAGE] {FFFFFF}/changename [PLAYER_ID] [NEW_NAME]");
else if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid,COLOR_WHITE,"{FF0000}[ERROR] {FFFFFF}Invalid player ID.");
elseif(dini_Exists(newname)) return SendClientMessage(playerid, COLOUR_RED, "That name has already been taken!");
else
{
new string[128],n[MAX_PLAYER_NAME];
GetPlayerName(targetid,n,sizeof(n));
SetPlayerName(targetid,name);
udb_RenameUser(PlayerName(targetid),name);
if(strlen(params) >= 3)
{
format(file, sizeof(file), "Users/%s.txt", name); //Change "Users/" to your Users Folder Directory, Change ".txt" to your File Format.
dini_Set(file, "%s.txt", newname); //Change ".txt" to your File Format.
format(string,sizeof(string),""COL_ADMIN"[ADMIN] {FFFFFF}You have changed %s's name to \"%s\"!",n,name);
SendClientMessage(playerid,COLOR_WHITE,string);
format(string,sizeof(string),""COL_ADMIN"[ADMIN] {FFFFFF}Your name has been changed to %s by %s(%d)!",n,PlayerName(playerid),playerid);
SendClientMessage(targetid,COLOR_WHITE,string);
}
}
return 1;
}
SetPlayerName(targetid,name);
udb_RenameUser(PlayerName(targetid),name);
udb_RenameUser(PlayerName(targetid),name);
SetPlayerName(targetid,name);