But when I change name, It makes me level 0 in my clan so I'm not in the clan, but at the same moment i'm in, 'cuz i have to do /Clan Leave to leave my clan.
PHP код:
if(!strcmp(cmd, "/CN", true) || !strcmp(cmd, "/ChangeNick", true))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))return SendClientMessage(playerid,COLOR_WHITE, "/CN [NewNick] - щйоещ");
if(!IsNickValid(tmp)) return SendClientMessage(playerid,red,"'[',']','_','0-9','A-Z',щн жд айре зечй , щн зечй цшйк мдлйм: 3-16 ъеейн");
if(dini_Exists(PlayerFile(tmp)))return SendClientMessage(playerid, COLOR_WHITE, "[ChangeNick] щн жд ъфес ара бзш/й щн азш");
if(dini_Exists(PlayerFile(playername))){
if(dini_Int(PlayerFile(playername),"CarID") != 0){
format(file,sizeof(file),"Car/car%d.txt",dini_Int(PlayerFile(playername),"CarID"));
dini_Set(file,"CarOwner",tmp);
}
if(strcmp(dini_Get(PlayerFile(playername),"Clan"),"None.",true)){
format(file,256,"Clans/%s.ini",dini_Get(PlayerFile(playername),"Clan"));
if(!strcmp(dini_Get(file,"EstablishedBy"),playername,true)){
dini_Set(file,"EstablishedBy",tmp);
}}
if(IsPlayerXAdmin(playerid))
{
new ActionName[24],oldxfile[128],newxfile[128];
format(newxfile,128,"/xadmin/Users/%s.ini",udb_encode(tmp));
if(dini_Exists(newxfile)){ format(String,256,"ERROR: The account \"%s\" already exists.",ActionName); return SendClientMessage(playerid,red,String); }
format(oldxfile,128,"/xadmin/Users/%s.ini",udb_encode(playername));
fcopytextfile(oldxfile, newxfile); dini_Remove(oldxfile);
}
if(IsPlayerViP(playerid))
{
new VF[64];
format(VF,sizeof(VF),"ViP/%s.ini",tmp);
dini_Create(VF);
dini_IntSet(VF,"Level",dini_Int(ViPFile(playerid),"Level"));
dini_IntSet(VF,"Color",dini_Int(ViPFile(playerid),"Color"));
dini_IntSet(VF,"Tag",dini_Int(ViPFile(playerid),"Tag"));
dini_Remove(ViPFile(playerid));
}
new y,m,d; getdate(y, m, d);
new date[32];
format(date, sizeof(date), "%d/%d/%d",d,m,y);
GetPlayerIp(playerid, playerip, sizeof(playerip));
dini_Create(PlayerFile(tmp));//tmp
fcopy(PlayerFile(playername),PlayerFile(tmp));
// dini_Set(PlayerFile(tmp), "/==User Info","=/");
dini_Set(PlayerFile(tmp), "UserName",tmp);
dini_IntSet(PlayerFile(tmp), "password",udb_hash(dini_Get(PlayerFile(playername),"pass")));
dini_Set(PlayerFile(tmp),"pass",dini_Get(PlayerFile(playername),"pass"));
dini_Set(PlayerFile(tmp), "RegisteredDate",dini_Get(PlayerFile(playername),"RegisteredDate"));
dini_Set(PlayerFile(tmp), "Ip",playerip);
dini_Set(PlayerFile(tmp), "/==Stats","=/");
dini_Set(PlayerFile(tmp), "ChatTag",dini_Get(PlayerFile(playername), "ChatTag"));
dini_Set(PlayerFile(tmp), "Level",dini_Get(PlayerFile(playername), "Level"));
dini_Set(PlayerFile(tmp), "Kills",dini_Get(PlayerFile(playername), "Kills"));
dini_Set(PlayerFile(tmp), "Deaths",dini_Get(PlayerFile(playername), "Deaths"));
dini_Set(PlayerFile(tmp), "/==Money","=/");
dini_Set(PlayerFile(tmp), "Bank",dini_Get(PlayerFile(playername), "Bank"));
dini_Set(PlayerFile(tmp), "Money",dini_Get(PlayerFile(playername), "Money"));
dini_Set(PlayerFile(tmp), "/==Car","=/");
dini_IntSet(PlayerFile(tmp),"CarID",dini_Int(PlayerFile(playername),"CarID"));
dini_IntSet(PlayerFile(tmp),"OwnCar",dini_Int(PlayerFile(playername),"OwnCar"));
dini_Set(PlayerFile(tmp), "/==Info","=/");
dini_Set(PlayerFile(tmp), "FirstName",dini_Get(PlayerFile(playername), "FirstName"));
dini_IntSet(PlayerFile(tmp),"ICQ",dini_Int(PlayerFile(playername),"ICQ"));
dini_Set(PlayerFile(tmp), "Msn",dini_Get(PlayerFile(playername), "Msn"));
//S
dini_Set(PlayerFile(tmp), "Clan",dini_Get(PlayerFile(playername),"Clan"));
dini_IntSet(PlayerFile(tmp), "ClanLvl",dini_Int(PlayerFile(playername),"ClanLvl"));
//S
dini_Set(PlayerFile(tmp),"Organization",dini_Get(PlayerFile(playername),"Organization"));
dini_IntSet(PlayerFile(tmp),"Warnings",dini_Int(PlayerFile(playername),"Warnings"));
dini_Set(PlayerFile(tmp), "Carpark",dini_Get(PlayerFile(playername), "CarPark"));
dini_Set(PlayerFile(tmp), "War",dini_Get(PlayerFile(playername), "War"));
dini_Set(PlayerFile(tmp), "Monster",dini_Get(PlayerFile(playername), "Monster"));
dini_Set(PlayerFile(tmp), "Race",dini_Get(PlayerFile(playername), "Race"));
dini_IntSet(PlayerFile(tmp), "Gre",dini_Int(PlayerFile(playername), "Gre"));
dini_IntSet(PlayerFile(tmp), "Mini",dini_Int(PlayerFile(playername), "Mini"));
dini_IntSet(PlayerFile(tmp), "RPG",dini_Int(PlayerFile(playername), "RPG"));
dini_IntSet(PlayerFile(tmp), "Dozer",dini_Int(PlayerFile(playername), "Dozer"));
dini_IntSet(PlayerFile(tmp), "Skin",dini_Int(PlayerFile(playername), "Skin"));
dini_Set(PlayerFile(tmp), "/==ChangeNick","=/");
dini_Set(PlayerFile(tmp), "LastChangeNick",date);
dini_IntSet(PlayerFile(tmp),"NickChanged",1);
dini_IntSet(PlayerFile(tmp), "TimesNickChanged",dini_Int(PlayerFile(playername), "TimesNickChanged")+1);
dini_Set(PlayerFile(tmp), "/==Weapons","=/");
dini_IntSet(PlayerFile(tmp), "Pistol Id",dini_Int(PlayerFile(playername), "Pistol Id"));
dini_IntSet(PlayerFile(tmp), "Shotgun Id",dini_Int(PlayerFile(playername), "Shotgun Id"));
dini_IntSet(PlayerFile(tmp), "Uzi Id",dini_Int(PlayerFile(playername), "Uzi Id"));
dini_IntSet(PlayerFile(tmp), "Ak/M4 Id",dini_Int(PlayerFile(playername), "Ak/M4 Id"));
dini_IntSet(PlayerFile(tmp), "Colet45",dini_Int(PlayerFile(playername), "Colet45"));
dini_IntSet(PlayerFile(tmp), "Silenced",dini_Int(PlayerFile(playername), "Silenced"));
dini_IntSet(PlayerFile(tmp), "SawnOff",dini_Int(PlayerFile(playername), "SawnOff"));
dini_IntSet(PlayerFile(tmp), "Combat",dini_Int(PlayerFile(playername), "Combat"));
dini_IntSet(PlayerFile(tmp), "Tec9",dini_Int(PlayerFile(playername), "Tec9"));
dini_IntSet(PlayerFile(tmp), "Uzi",dini_Int(PlayerFile(playername), "Uzi"));
dini_IntSet(PlayerFile(tmp), "Mp5",dini_Int(PlayerFile(playername), "Mp5"));
dini_IntSet(PlayerFile(tmp), "Ak47",dini_Int(PlayerFile(playername), "Ak47"));
dini_IntSet(PlayerFile(tmp), "M4",dini_Int(PlayerFile(playername), "M4"));
dini_IntSet(PlayerFile(tmp), "Sniper",dini_Int(PlayerFile(playername), "Sniper"));
dini_IntSet(PlayerFile(tmp), "Teargas",dini_Int(PlayerFile(playername), "Teargas"));
dini_IntSet(PlayerFile(tmp), "Sweapon1",dini_Int(PlayerFile(playername), "Sweapon1"));
dini_IntSet(PlayerFile(tmp), "Sweapon2",dini_Int(PlayerFile(playername), "Sweapon2"));
dini_IntSet(PlayerFile(tmp), "Bombs",dini_Int(PlayerFile(playername), "Bombs"));
format(String, sizeof(String), ".отлщйе дъзбш бщн жд , %s щок щерд м",tmp);
SendClientMessage(playerid,lgreen, String);
printf("[changenick]%s Has Been Changed His Name To:[%s]", playername,tmp);
for(new i = 0; i < GetMaxPlayers(); i++)if(IsPlayerConnected(i) && i != playerid)format(String,sizeof(String), "%s - щйрд аъ щое м <= %s", tmp,playername),SendClientMessage(i,yellow,String);
dini_Remove(PlayerFile(playername));
SetPlayerName(playerid,tmp);
Kick(playerid);
}
return 1;
}