I want to check if the choosed new name is the same as an existed name.
pawn Код:
COMMAND:changename(playerid,params[])
{
new id,currentname[MAX_PLAYER_NAME], adminname[MAX_PLAYER_NAME],name[128],tname[128],filestring[128];
if(PlayerInfo[playerid][pAdmin] < 7) return SendClientMessage(playerid, 0xFF0000AA, "You Are Not A Head Administrator Or Higher Rank!");
if(sscanf(params,"us[128]",id,name))SendClientMessage(playerid,0xFF0000AA,"USAGE: /changename (/cn) [Newname]");
if(!IsPlayerConnected(id) || id == INVALID_PLAYER_ID) return SendClientMessage(playerid,0xFF0000AA,"Player Is Not Connected.");
if(strlen(name) < 3 || strlen(name) > 24) return SendClientMessage(playerid, 0xFF0000AA, "You Can Only Enter More Than 3 Letters Or Less Than 24 Letters To Change Name");
format(filestring, sizeof(filestring), "/Users/%s.ini", tname);
if(strcmp(name,tname)) return SendClientMessage(playerid, 0xFF0000AA, "That Name Exists Already!");
new n[MAX_PLAYER_NAME];
SetPlayerName(id,name);
GetPlayerName(id,n,sizeof(n));
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteInt(File,"Password",PlayerInfo[playerid][pPass]);
INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]);
INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
INI_WriteInt(File,"Score",GetPlayerScore(playerid));
INI_WriteInt(File,"Drugs",LPinfo[playerid][Drugs]);
INI_WriteInt(File,"Adrenaline",LPinfo[playerid][Adre]);
INI_WriteInt(File,"Registered",1);
INI_WriteInt(File,"Logged",1);
INI_WriteInt(File,"VIPLevel",Info[playerid][VIPLevel]);
INI_WriteInt(File,"FavouriteSkin",Info[playerid][Favouriteskin]);
INI_WriteInt(File,"FavouriteSong",Favouritesong[playerid]);
INI_WriteInt(File,"BankMoney",BankMoney[playerid]);
INI_WriteInt(File,"Daysalive",Daysalive[playerid]);
INI_WriteInt(File,"Banned",Info[playerid][Banned]);
INI_WriteInt(File,"MissionsCompleted",Info[playerid][MissionsCompleted]);
INI_WriteInt(File,"MissionsFailed",Info[playerid][MissionsFailed]);
INI_WriteInt(File,"Robbed",Info[playerid][Robbed]);
INI_WriteInt(File,"MaximumRobbed",Info[playerid][MaximumRobbed]);
INI_WriteInt(File,"Muted",Info[playerid][Muted]);
INI_WriteInt(File,"Jailed",Info[playerid][Jailed]);
INI_WriteInt(File,"MuteWarnings",Info[playerid][MuteWarnings]);
INI_WriteInt(File,"MaxMuteWarnings",Info[playerid][MaxMuteWarnings]);
INI_WriteInt(File,"Warnings",Info[playerid][Warnings]);
INI_WriteInt(File,"TimesKicked",Info[playerid][TimesKicked]);
INI_WriteInt(File,"EventsWon",Info[playerid][EventsWon]);
INI_WriteInt(File,"EventsLost",Info[playerid][EventsLost]);
INI_WriteInt(File,"StartingMusic",Info[playerid][StartingMusic]);
INI_Close(File);
new Message7[200];
if(PlayerInfo[playerid][pAdmin] > 0)
{
switch(PlayerInfo[playerid][pAdmin])
{
case 1: AdmRank = "Trial Moderator";
case 2: AdmRank = "Moderator";
case 3: AdmRank = "Master Moderator";
case 4: AdmRank = "Trial Administrator";
case 5: AdmRank = "Administrator";
case 6: AdmRank = "Master Administrator";
case 7: AdmRank = "Head Administrator";
case 8: AdmRank = "Trusted Administrator";
case 9: AdmRank = "Co-Owner";
case 10: AdmRank = "Owner";
}
GetPlayerName(id, currentname, MAX_PLAYER_NAME);
GetPlayerName(playerid, adminname, MAX_PLAYER_NAME);
format(Message7, sizeof(Message7), "The %s %s (%d) Has Changed %s (%d)'s Name To: %s.",AdmRank, adminname, playerid, currentname, id, name), SendClientMessageToAll(0xFFD000FF, Message7);
format(Message7, sizeof(Message7), "You Have Successfully Changed %s (%d)'s Name To: %s", currentname, id, name), SendClientMessage(playerid, 0x00FFF2FF, Message7);
format(Message7, sizeof(Message7), "The %s %s (%d) Has Changed Your Name To: %s.",AdmRank, adminname, playerid, name), SendClientMessage(id,0xFF00EAFF, Message7);
}
foreach(Player, i)
{
if(PlayerInfo[i][pAdmin] > 0)
{
format(Message7, sizeof(Message7), "[ADM] The %s %s (%d) Has Changed %s (%d)'s Name To: %s.",AdmRank, adminname, playerid, currentname, id, name), SendClientMessage(i, 0xFF5900FF, Message7);
print(Message7);
}
}
return 1;
}
Ugh..