SA-MP Forums Archive
Help | A Gamemode - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Help | A Gamemode (/showthread.php?tid=264768)



Help | A Gamemode - Roiasher - 27.06.2011

Hello, I have a problem with a namechange
I have in my GM a Clan System, which is saved by Dini
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.
Thats the Command:

PHP код:
if(!strcmp(cmd"/CN"true) || !strcmp(cmd"/ChangeNick"true)) 

tmp strtok(cmdtextidx); 
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(playeridCOLOR_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(oldxfilenewxfile); 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(ymd); 
                new 
date[32]; 
                 
format(datesizeof(date), "%d/%d/%d",d,m,y); 
                 
GetPlayerIp(playeridplayeripsizeof(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(Stringsizeof(String), ".отлщйе дъзбш бщн жд , %s щок щерд м",tmp); 
                
SendClientMessage(playerid,lgreenString); 
                
printf("[changenick]%s Has Been Changed His Name To:[%s]"playername,tmp); 
                for(new 
0GetMaxPlayers(); i++)if(IsPlayerConnected(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
                } 
Thanks for helping me!