04.03.2017, 02:08
Hello everyone, i'm having a problem with my Changenick command
Here's the OnPlayerDisconnect stuff
For some reason everytime i use this command the .ini files changes its name but the Password gets deleted like this:
Before doing the command:
After the command:
I tried everything but the bug it's still around, it fixes only if i don't use the command and i only save stats when a player disconnects
Код:
CMD:cambianick(playerid, params[]) { new name[25]; new string[256]; if(sscanf(params, "s", name))return SendClientMessage(playerid, COLOR_RED, "Usa: /cambianick [nome]"); if(strlen(name) < 3)return SendClientMessage(playerid, COLOR_RED, "Errore: La lunghezza del nome non puo' essere minore di 3!"); if(strlen(name) > MAX_PLAYER_NAME)return SendClientMessage(playerid, COLOR_RED, "Errore: La lunghezza del nome non puo' superare il limite!"); new file[64]; format(file, sizeof(file), "/Users/%s.ini", name);// change it to your User Path if (fexist(file)) return SendClientMessage(playerid, COLOR_RED, "Errore: Quel nome e' gia in uso!"); fremove(UserPath(playerid)); SetPlayerName(playerid,name); format(string,sizeof(string),"%s ha effettuato un cambio nome! E' stato kickato per poter salvare i suoi dati"); SendClientMessageToAll(Lightblue,string); Kick(playerid); return 1; }
Код:
new INI:File = INI_Open(UserPath(playerid)); INI_SetTag(File,"data"); 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,"Exp",PlayerInfo[playerid][pExp]); INI_WriteInt(File,"Level",PlayerInfo[playerid][pLevel]); INI_WriteInt(File,"Clan",PlayerInfo[playerid][pClan]); INI_WriteInt(File,"ClanKills",PlayerInfo[playerid][pCKills]); INI_WriteInt(File,"Skin",PlayerInfo[playerid][pSkin]); INI_WriteInt(File,"Bank",PlayerInfo[playerid][pBank]); INI_WriteInt(File,"VIP",PlayerInfo[playerid][pVIP]); INI_WriteInt(File,"Eventi",PlayerInfo[playerid][pGare]); INI_Close(File);
Before doing the command:
Код:
[data] ClanKills = 0 Level = 2 Exp = 2 Deaths = 0 Kills = 0 Admin = 10 Cash = 150000 Password = *** Hidden for obvious reasons Eventi = 0 VIP = 0 Bank = 36000 Skin = 129 Clan = 1
Код:
[data] ClanKills = 0 Level = 2 Exp = 2 Deaths = 0 Kills = 0 Admin = 10 Cash = 150000 Eventi = 0 VIP = 0 Bank = 36000 Skin = 129 Clan = 1