Yini Duplicating stats in the same file +REP
#1

The title means that the lines of data in the files being copy pasted automatically (that happens sometimes) and creates another data, that resets the players' data ingame, the original data should be like this:
[data]
Password = 122225057
Cash = 0
Admin = 0
Kills = 0
Deaths = 0
Score = 0
Drugs = 0
Adrenaline = 0
Registered = 1
VIPLevel = 0
FavouriteSkin = -1
FavouriteSong = 10
BankMoney = 0
Daysalive = 0
Banned = 0
Muted = 0
MuteWarnings = 0
MaxMuteWarnings = 0
Warnings = 0
TimesKicked = 0
StartingMusic = 0
AutoUseSkin = 0
FightingSkill = 4
Respect = 0

But instead, I entered in my server and my account was reseted saying that i am logged in as a registered player, while i see this data in my file:

[data]
Password = 122225057
Cash = 0
Admin = 10
Kills = 0
Deaths = 0
Score = 0
Drugs = 0
Adrenaline = 0
Registered = 1
VIPLevel = 3
FavouriteSkin = -1
FavouriteSong = 0
BankMoney = 0
Daysalive = 0
Banned = 0
MissionsCompleted = 0
MissionsFailed = 0
Robbed = 0
MaximumRobbed = 0
Muted = 0
Jailed = 0
MuteWarnings = 0
MaxMuteWarnings = 0
Warnings = 1
TimesKicked = 0
EventsWon = 0
EventsLost = 0
StartingMusic = 1
Respect = 0
AutoUseSkin = 0
FightingSkill = 4[data]
Password = 122225057
Cash = 3900
Admin = 10
Kills = 1
Deaths = 1
Score = 1
Drugs = 0
Adrenaline = 0
Registered = 1
VIPLevel = 3
FavouriteSkin = -1
FavouriteSong = 0
BankMoney = 0
Daysalive = 0
Banned = 0
Muted = 0
MuteWarnings = 0
MaxMuteWarnings = 0
Warnings = 1
TimesKicked = 0
StartingMusic = 0
AutoUseSkin = 0
FightingSkill = 4
[data]
Password = 122225057
Cash = 0
Admin = 0
Kills = 0
Deaths = 0
Score = 0
Drugs = 0
Adrenaline = 0
Registered = 1
VIPLevel = 0
FavouriteSkin = -1
FavouriteSong = 10
BankMoney = 0
Daysalive = 0
Banned = 0
Muted = 0
MuteWarnings = 0
MaxMuteWarnings = 0
Warnings = 0
TimesKicked = 0
StartingMusic = 0
AutoUseSkin = 0
FightingSkill = 4
Respect = 0


IDK exactly where's the problem, I have been facing this problem for months, can anyone help me?

onplayerconnect codes:

http://pastebin.com/8pKXwrMw

Onplayerdisconnect codes:

pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
    new pName2[24];
    new str[128];
    GetPlayerName(playerid, pName2, 24);
    KillTimer(UserTimer[playerid]);

    switch(reason)
        {
            case 0: format(str, 128, "%s (%d) Has Left The Server. (Timeout/Crashed)", pName2,playerid);
            case 1: format(str, 128, "%s (%d) Has Left The Server. (Leaving)", pName2,playerid);
            case 2: format(str, 128, "%s (%d) Has Left The Server. (Kicked/Banned)", pName2,playerid);
        }
    SendClientMessageToAll(0xAFAFAFAA, str);
    if(fexist(UserPath(playerid)))
    {
    if(Info[playerid][Logged] == 1)
    {
    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,"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,"Muted",Info[playerid][Muted]);
    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,"StartingMusic",Info[playerid][StartingMusic]);
    INI_WriteInt(File,"Respect",Info[playerid][Respect]);
    INI_WriteInt(File,"AutoUseSkin",Autouseskin[playerid]);
    INI_WriteInt(File,"FightingSkill",fskillid[playerid]);
    INI_Close(File);
    }
    }
    new vehicleid = GetPlayerVehicleID(playerid);
    if(IsPlayerInAnyVehicle(playerid))
    {
    if(GetPlayerVehicleSeat(playerid) == 0)
    {
    foreach(Player, i)
    {
    if(i != playerid)
    {
        if(IsPlayerInVehicle(i, GetPlayerVehicleID(playerid)) && GetPlayerVehicleSeat(i) > 0)
        {
        RemovePlayerFromVehicle(i);
        SendClientMessage(i, 0xFF0000AA, "Anti-Cheat (AC): You Have Been Removed From This Vehicle | Reason: Driver Disconnected.");
        GameTextForPlayer(i, "~r~Removed From Vehicle", 3000, 3);
        cardriver[vehicleid]=0;
        playervehicle[playerid] = -1;
        }
    }
    }
    }
    }
    pmInfo[playerid][Last] = -1;
    pmInfo[playerid][NoPM] = 0;
    KillerScore[playerid] = 0;
    PlayerDualWatching[playerid] = 0;
    InventationSent[playerid] = -1;
    Inventation[playerid] = -1;
    InDual[playerid] = 0;
    Inventationprice[playerid] = 0;
    Killstreak[playerid] = 0;
    new HouseSlot;

    // Loop through all Houses the player owns
    for___loop (HouseSlot = 0; HouseSlot < MAX_HOUSESPERPLAYER; HouseSlot++)
    {
        // Check if the player has a house in this houseslot
        if (APlayerData[playerid][Houses][HouseSlot] != 0)
        {
            // Save the housefile
            HouseFile_Save(APlayerData[playerid][Houses][HouseSlot]);

            // Unload housecars if they were loaded when the owner logged in
            if (LoadCarsDuringFSInit == false)
            {
                // Unload all vehicles assigned to this house
                House_RemoveVehicles(APlayerData[playerid][Houses][HouseSlot]);
            }

            // Clear the HouseID stored in this houseslot
            APlayerData[playerid][Houses][HouseSlot] = 0;
        }
    }
    // Clear all data for this player
    APlayerData[playerid][CurrentHouse] = 0;
    APlayerData[playerid][DialogBuyVClass] = 0;
    APlayerData[playerid][DialogGetCarHouseID] = 0;
    if(IsBeingSpeced[playerid] == 1)//If the player being spectated, disconnects, then turn off the spec mode for the spectator.
    {
        foreach(Player,i)
        {
            if(spectatorid[i] == playerid)
            {
                TogglePlayerSpectating(i,false);// This justifies what's above, if it's not off then you'll be either spectating your connect screen, or somewhere in blueberry (I don't know why)
            }
        }
    }
    KillTimer(DRUG_TIMER_RESPONSE(playerid));
    KillTimer(DRUG_TIMER(playerid));
    KillTimer(ranktimers[playerid]);
    KillTimer(texttimers[playerid]);
    KillTimer(antiarmourhack[playerid]);
    KillTimer(antihealthhack[playerid]);
    KillTimer(ShooterTimer[playerid]);
    KillTimer(TargeterTimer[playerid]);
    KillTimer(PlayerDays[playerid]);
    KillTimer(UserTimer[playerid]);
    KillTimer(Spawnprotection[playerid]);
    KillTimer(VIPReward[playerid]);
    KillTimer(anticbugtimer[playerid]);
    KillTimer(antiaahelp[playerid]);
    KillTimer(antiaalotto[playerid]);
    fskillid[playerid] = 4;
    cover[playerid] = 0;
    anticbug[playerid] = 0;
    aalotto[playerid] = 0;
    Delete3DTextLabel(alabel[playerid]);
    Isattacked[playerid] = 0;
    Hitplacer[playerid] = 0;
    playervehicle[playerid] = -1;
    dialogwelcome[playerid] = 0;
    return 1;
}
Dialog login codes:

http://pastebin.com/c41jhm1K

The saving codes:

pawn Код:
forward UserLoad_data(playerid,name[],value[]);

forward LoadUser_data(playerid,name[],value[]);

public LoadUser_data(playerid,name[],value[])
{
    INI_Int("Password",PlayerInfo[playerid][pPass]);
    INI_Int("Cash",PlayerInfo[playerid][pCash]);
    INI_Int("Admin",PlayerInfo[playerid][pAdmin]);
    INI_Int("Kills",PlayerInfo[playerid][pKills]);
    INI_Int("Deaths",PlayerInfo[playerid][pDeaths]);
    INI_Int("Score",LPinfo[playerid][Score]);
    INI_Int("Drugs",LPinfo[playerid][Drugs]);
    INI_Int("Adrenaline",LPinfo[playerid][Adre]);
    INI_Int("Registered",Info[playerid][Registered]);
    INI_Int("Registered",Info[playerid][Registered]);
    INI_Int("VIPLevel",Info[playerid][VIPLevel]);
    INI_Int("FavouriteSkin",Info[playerid][Favouriteskin]);
    INI_Int("FavouriteSong",Favouritesong[playerid]);
    INI_Int("BankMoney",BankMoney[playerid]);
    INI_Int("Daysalive",Daysalive[playerid]);
    INI_Int("Banned",Info[playerid][Banned]);
    INI_Int("Muted",Info[playerid][Muted]);
    INI_Int("MuteWarnings",Info[playerid][MuteWarnings]);
    INI_Int("MaxMuteWarnings",Info[playerid][MaxMuteWarnings]);
    INI_Int("Warnings",Info[playerid][Warnings]);
    INI_Int("TimesKicked",Info[playerid][TimesKicked]);
    INI_Int("StartingMusic",Info[playerid][StartingMusic]);
    INI_Int("Respect",Info[playerid][Respect]);
    INI_Int("AutoUseSkin",Autouseskin[playerid]);
    INI_Int("FightingSkill",fskillid[playerid]);
    return 1;
}

public UserLoad_data(playerid,name[],value[])
{
    INI_Int("Password",PlayerInfo[playerid][pPass]);
    INI_Int("Banned",Info[playerid][Banned]);
    INI_Int("StartingMusic",Info[playerid][StartingMusic]);
    return 1;
}
timer that saves the player's stats codes:
pawn Код:
public UserSaver(playerid)
{
    if(Info[playerid][Logged] == 1)
    {
    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,"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,"Muted",Info[playerid][Muted]);
    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,"StartingMusic",Info[playerid][StartingMusic]);
    INI_WriteInt(File,"AutoUseSkin",Autouseskin[playerid]);
    INI_WriteInt(File,"FightingSkill",fskillid[playerid]);
    INI_Close(File);
    SendClientMessage(playerid, 0x00FFFFFF, "Your Stats Has Been {FFF700}Automatically{00FFFF} Saved.");
    }
    return 1;
}
Please help me it has been 4 months since this problem existed.. i will +REP.
Reply
#2

How many times is it duplicated ? only 1 -2 ?
Reply
#3

Can duplicate once or sometimes more.
Reply
#4

Look it duplicates the data and re writes the data to 0 and loads that duplicated reseted data as I said above.

sorry for double post.
Reply
#5

I think you need to re-script it, moreover i will do it but i cant do it not as due to my exams.
Reply
#6

I don't have pretty much time to re-script it, anyone can do it for me please?
Reply
#7

BUMP, its nearly 4 days...
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)