Stats won's save on disconnect
#1

Well, I ran into a huge problem. My stats won't save when player is disconnected. No changes take effect and what ever user accomplishes in-game, it's not saved. It saved on my Windows PC when I run it, but when I upload it on the server (Linux) it doesn't save. This is my code for saving stats:

pawn Код:
public OnPlayerDataSave(playerid)
{
    if(IsPlayerConnected(playerid))
    {
        if(gPlayerLogged[playerid])
        {
            if(GetPlayerCash(playerid) >= GetPlayerMoney(playerid))
            {
                PlayerInfo[playerid][pCash] = GetPlayerMoney(playerid);
            }
            else
            {
                new string[128];
                format(string, sizeof(string), "[WARNING:] [%s (Leaving)] Money Out: $%d; Should Have (Server-Side): $%d.",GetPlayerNameEx(playerid),playerid,GetPlayerMoney(playerid),GetPlayerCash(playerid));
                AdministratorMessage(COLOR_LIGHTRED, string,1);
                HackLog(string);
            }
            if(CopOnDuty[playerid] == 0)
            {
                if(PlayerInfo[playerid][pRace] == 1)//Humans Saving Slots
                {
                    for(new slot = 0; slot != 12; slot++)
                    {
                        new wep, ammo;
                        GetPlayerWeaponData(playerid, slot, wep, ammo);
                        if(wep != 0 && ammo != 0)
                        {
                            if(PlayerInfo[playerid][pGun1] == 0 && (slot == 0 || slot == 1)) { PlayerInfo[playerid][pGun1] = wep; PlayerInfo[playerid][pAmmo1] = ammo; }
                            else if(PlayerInfo[playerid][pGun2] == 0 && slot == 2) { PlayerInfo[playerid][pGun2] = wep; PlayerInfo[playerid][pAmmo2] = ammo; }
                            else if(PlayerInfo[playerid][pGun3] == 0 && (slot == 3 || slot == 4 || slot == 5 || slot == 6)) { PlayerInfo[playerid][pGun3] = wep; PlayerInfo[playerid][pAmmo3] = ammo; }
                            else if(PlayerInfo[playerid][pGun4] == 0 && (slot == 1 || slot == 4 || slot == 5 || slot == 6)) { PlayerInfo[playerid][pGun4] = wep; PlayerInfo[playerid][pAmmo4] = ammo; }
                        }
                    }
                }
                else//Vampires Saving Slots
                {
                    for(new slot = 0; slot != 12; slot++)
                    {
                        new wep, ammo;
                        GetPlayerWeaponData(playerid, slot, wep, ammo);
                        if(wep != 0 && ammo != 0)
                        {
                            if(PlayerInfo[playerid][pGun1] == 0 && slot == 0) { PlayerInfo[playerid][pGun1] = wep; PlayerInfo[playerid][pAmmo1] = ammo; }
                            else if(PlayerInfo[playerid][pGun2] == 0 && slot == 1) { PlayerInfo[playerid][pGun2] = wep; PlayerInfo[playerid][pAmmo2] = ammo; }
                            else if(PlayerInfo[playerid][pGun3] == 0 && slot == 10) { PlayerInfo[playerid][pGun3] = wep; PlayerInfo[playerid][pAmmo3] = ammo; }
                        }
                    }
                }
            }
            new string3[128];
            format(string3, sizeof(string3), "Accounts/%s.ini", PlayerName(playerid));
            new File: hFile = fopen(string3, io_write);
            if (hFile)
            {
                new var[32];
                PlayerInfo[playerid][pCash] = GetPlayerCash(playerid);
                format(var, 32, "Key=%s\n", PlayerInfo[playerid][pKey]);fwrite(hFile, var);
                format(var, 32, "Level=%d\n",PlayerInfo[playerid][pLevel]);fwrite(hFile, var);
                format(var, 32, "AdminLevel=%d\n",PlayerInfo[playerid][pAdmin]);fwrite(hFile, var);
                format(var, 32, "GMLevel=%d\n",PlayerInfo[playerid][pGM]);fwrite(hFile, var);
                format(var, 32, "DonateRank=%d\n",PlayerInfo[playerid][pDonateRank]);fwrite(hFile, var);
                format(var, 32, "Registered=%d\n",PlayerInfo[playerid][pRegistered]);fwrite(hFile, var);
                format(var, 32, "Sex=%d\n",PlayerInfo[playerid][pSex]);fwrite(hFile, var);
                format(var, 32, "Race=%d\n",PlayerInfo[playerid][pRace]);fwrite(hFile, var);
                format(var, 32, "Experience=%d\n",PlayerInfo[playerid][pExp]);fwrite(hFile, var);
                format(var, 32, "Money=%d\n",PlayerInfo[playerid][pCash]);fwrite(hFile, var);
                format(var, 32, "Bank=%d\n",PlayerInfo[playerid][pBank]);fwrite(hFile, var);
                format(var, 32, "Skin=%i\n",PlayerInfo[playerid][pSkin]);fwrite(hFile, var);
                format(var, 32, "PlayingHours=%d\n",PlayerInfo[playerid][pPlayingHours]);fwrite(hFile, var);
                format(var, 32, "AllowedPayday=%d\n",PlayerInfo[playerid][pAllowedPayday]);fwrite(hFile, var);
                format(var, 32, "Insurance=%d\n",PlayerInfo[playerid][pInsurance]);fwrite(hFile, var);
                format(var, 32, "Faction=%d\n",PlayerInfo[playerid][pFaction]);fwrite(hFile, var);
                format(var, 32, "Rank=%d\n",PlayerInfo[playerid][pRank]);fwrite(hFile, var);
                format(var, 32, "HouseKey=%d\n",PlayerInfo[playerid][pHouseKey]);fwrite(hFile, var);
                format(var, 32, "BizKey=%d\n",PlayerInfo[playerid][pBizKey]);fwrite(hFile, var);
                format(var, 32, "SpawnPoint=%d\n",PlayerInfo[playerid][pSpawnPoint]);fwrite(hFile, var);
                format(var, 32, "PhoneNumber=%d\n",PlayerInfo[playerid][pPhoneNumber]);fwrite(hFile, var);
                format(var, 32, "PhoneC=%d\n",PlayerInfo[playerid][pPhoneC]);fwrite(hFile, var);
                format(var, 32, "PhoneBook=%d\n",PlayerInfo[playerid][pPhoneBook]);fwrite(hFile, var);
                format(var, 32, "ListNumber=%d\n",PlayerInfo[playerid][pListNumber]);fwrite(hFile, var);
                format(var, 32, "Donator=%d\n",PlayerInfo[playerid][pDonator]);fwrite(hFile, var);
                format(var, 32, "Job=%d\n",PlayerInfo[playerid][pJob]);fwrite(hFile, var);
                format(var, 32, "Ajailed=%d\n",PlayerInfo[playerid][pAjailed]);fwrite(hFile, var);
                format(var, 32, "JailTime=%d\n",PlayerInfo[playerid][pJailTime]);fwrite(hFile, var);
                format(var, 32, "Jailed=%d\n",PlayerInfo[playerid][pJailed]);fwrite(hFile, var);
                format(var, 32, "Wanted=%d\n",PlayerInfo[playerid][pWanted]);fwrite(hFile, var);
                format(var, 32, "WantedFor=%s\n",PlayerInfo[playerid][pWantedFor]);fwrite(hFile, var);
                format(var, 32, "DriverLicense=%d\n",PlayerInfo[playerid][pDriverLicense]);fwrite(hFile, var);
                format(var, 32, "WeaponLicense=%d\n",PlayerInfo[playerid][pWeaponLicense]);fwrite(hFile, var);
                format(var, 32, "CrashX=%.1f\n",PlayerInfo[playerid][pCrashX]);fwrite(hFile, var);
                format(var, 32, "CrashY=%.1f\n",PlayerInfo[playerid][pCrashY]);fwrite(hFile, var);
                format(var, 32, "CrashZ=%.1f\n",PlayerInfo[playerid][pCrashZ]);fwrite(hFile, var);
                GetPlayerHealth(playerid, PlayerInfo[playerid][pHealth]);
                if(PlayerInfo[playerid][pHealth] > 100) PlayerInfo[playerid][pHealth] = oldhp[playerid];
                format(var, 32, "Health=%f\n", PlayerInfo[playerid][pHealth]);fwrite(hFile, var);
                GetPlayerArmour(playerid, PlayerInfo[playerid][pArmour]);
                if(CopOnDuty[playerid] != 0) PlayerInfo[playerid][pArmour] = 0;
                format(var, 32, "Armour=%f\n", PlayerInfo[playerid][pArmour]);fwrite(hFile, var);
                format(var, 32, "Paycheck=%d\n",PlayerInfo[playerid][pPaycheck]);fwrite(hFile, var);
                format(var, 32, "CrashInt=%d\n",PlayerInfo[playerid][pCrashInt]);fwrite(hFile, var);
                format(var, 32, "CrashW=%d\n",PlayerInfo[playerid][pCrashW]);fwrite(hFile, var);
                format(var, 32, "Crashed=%d\n",PlayerInfo[playerid][pCrashed]);fwrite(hFile, var);
                format(var, 64, "Gun1=%d\n",PlayerInfo[playerid][pGun1]);fwrite(hFile, var);
                format(var, 64, "Gun2=%d\n",PlayerInfo[playerid][pGun2]);fwrite(hFile, var);
                format(var, 64, "Gun3=%d\n",PlayerInfo[playerid][pGun3]);fwrite(hFile, var);
                format(var, 64, "Gun4=%d\n",PlayerInfo[playerid][pGun4]);fwrite(hFile, var);
                format(var, 64, "Ammo1=%d\n",PlayerInfo[playerid][pAmmo1]);fwrite(hFile, var);
                format(var, 64, "Ammo2=%d\n",PlayerInfo[playerid][pAmmo2]);fwrite(hFile, var);
                format(var, 64, "Ammo3=%d\n",PlayerInfo[playerid][pAmmo3]);fwrite(hFile, var);
                format(var, 64, "Ammo4=%d\n",PlayerInfo[playerid][pAmmo4]);fwrite(hFile, var);
                format(var, 32, "LearningPoints=%d\n",PlayerInfo[playerid][pLearn]);fwrite(hFile, var);
                format(var, 32, "UniqueID=%d\n",PlayerInfo[playerid][pUniqueID]);fwrite(hFile, var);
                format(var, 64, "Seeds=%d\n",PlayerInfo[playerid][pSeeds]);fwrite(hFile, var);
                format(var, 64, "Weed=%d\n",PlayerInfo[playerid][pWeed]);fwrite(hFile, var);
                format(var, 32, "WeedX=%f\n",PlayerInfo[playerid][pWeedX]);fwrite(hFile, var);
                format(var, 32, "WeedY=%f\n",PlayerInfo[playerid][pWeedY]);fwrite(hFile, var);
                format(var, 32, "WeedZ=%f\n",PlayerInfo[playerid][pWeedZ]);fwrite(hFile, var);
                format(var, 32, "WeedR=%f\n",PlayerInfo[playerid][pWeedR]);fwrite(hFile, var);
                format(var, 64, "WeedTimeLeft=%d\n",PlayerInfo[playerid][pWeedTimeLeft]);fwrite(hFile, var);
                format(var, 32, "MaskID=%s\n",PlayerInfo[playerid][pMaskID]);fwrite(hFile, var);
                format(var, 32, "Veh1_Model=%d\n", PlayerInfo[playerid][pVeh1Model]); fwrite(hFile, var);
                format(var, 32, "Veh1_X=%f\n", PlayerInfo[playerid][pVeh1X]); fwrite(hFile, var);
                format(var, 32, "Veh1_Y=%f\n", PlayerInfo[playerid][pVeh1Y]); fwrite(hFile, var);
                format(var, 32, "Veh1_Z=%f\n", PlayerInfo[playerid][pVeh1Z]); fwrite(hFile, var);
                format(var, 32, "Veh1_Rot=%f\n", PlayerInfo[playerid][pVeh1Rotation]); fwrite(hFile, var);
                format(var, 32, "Veh1_Paintjob=%d\n", PlayerInfo[playerid][pVeh1PaintJob]); fwrite(hFile, var);
                format(var, 32, "Veh1_Color1=%d\n", PlayerInfo[playerid][pVeh1Color1]); fwrite(hFile, var);
                format(var, 32, "Veh1_Color2=%d\n", PlayerInfo[playerid][pVeh1Color2]); fwrite(hFile, var);
                format(var, 32, "Veh1_Fuel=%d\n", PlayerInfo[playerid][pVeh1Fuel]); fwrite(hFile, var);
                format(var, 32, "Veh1_Destroyed=%d\n", PlayerInfo[playerid][pVeh1Destroyed]); fwrite(hFile, var);
                format(var, 32, "Veh1_Mod1=%d\n", PlayerInfo[playerid][pVeh1Mod1]); fwrite(hFile, var);
                format(var, 32, "Veh1_Mod2=%d\n", PlayerInfo[playerid][pVeh1Mod2]); fwrite(hFile, var);
                format(var, 32, "Veh1_Mod3=%d\n", PlayerInfo[playerid][pVeh1Mod3]); fwrite(hFile, var);
                format(var, 32, "Veh1_Mod4=%d\n", PlayerInfo[playerid][pVeh1Mod4]); fwrite(hFile, var);
                format(var, 32, "Veh1_Mod5=%d\n", PlayerInfo[playerid][pVeh1Mod5]); fwrite(hFile, var);
                format(var, 32, "Veh1_Mod6=%d\n", PlayerInfo[playerid][pVeh1Mod6]); fwrite(hFile, var);
                format(var, 32, "Veh1_Mod7=%d\n", PlayerInfo[playerid][pVeh1Mod7]); fwrite(hFile, var);
                format(var, 32, "Veh1_Mod8=%d\n", PlayerInfo[playerid][pVeh1Mod8]); fwrite(hFile, var);
                format(var, 32, "Veh1_Mod9=%d\n", PlayerInfo[playerid][pVeh1Mod9]); fwrite(hFile, var);
                format(var, 32, "Veh1_Mod10=%d\n", PlayerInfo[playerid][pVeh1Mod10]); fwrite(hFile, var);
                format(var, 32, "Veh1_Mod11=%d\n", PlayerInfo[playerid][pVeh1Mod11]); fwrite(hFile, var);
                format(var, 32, "Veh1_Mod12=%d\n", PlayerInfo[playerid][pVeh1Mod12]); fwrite(hFile, var);
                format(var, 32, "Veh1_Mod13=%d\n", PlayerInfo[playerid][pVeh1Mod13]); fwrite(hFile, var);
                format(var, 32, "Veh1_Mod14=%d\n", PlayerInfo[playerid][pVeh1Mod14]); fwrite(hFile, var);
                format(var, 32, "Veh1_Mod15=%d\n", PlayerInfo[playerid][pVeh1Mod15]); fwrite(hFile, var);
                format(var, 32, "Veh1_Mod16=%d\n", PlayerInfo[playerid][pVeh1Mod16]); fwrite(hFile, var);
                format(var, 32, "Veh1_Mod17=%d\n", PlayerInfo[playerid][pVeh1Mod17]); fwrite(hFile, var);
                format(var, 32, "Veh1_Mod18=%d\n", PlayerInfo[playerid][pVeh1Mod18]); fwrite(hFile, var);
                format(var, 32, "Veh2_Model=%d\n", PlayerInfo[playerid][pVeh2Model]); fwrite(hFile, var);
                format(var, 32, "Veh2_X=%f\n", PlayerInfo[playerid][pVeh2X]); fwrite(hFile, var);
                format(var, 32, "Veh2_Y=%f\n", PlayerInfo[playerid][pVeh2Y]); fwrite(hFile, var);
                format(var, 32, "Veh2_Z=%f\n", PlayerInfo[playerid][pVeh2Z]); fwrite(hFile, var);
                format(var, 32, "Veh2_Rot=%d\n", PlayerInfo[playerid][pVeh2Rotation]); fwrite(hFile, var);
                format(var, 32, "Veh2_Paintjob=%d\n", PlayerInfo[playerid][pVeh2PaintJob]); fwrite(hFile, var);
                format(var, 32, "Veh2_Color1=%d\n", PlayerInfo[playerid][pVeh2Color1]); fwrite(hFile, var);
                format(var, 32, "Veh2_Color2=%d\n", PlayerInfo[playerid][pVeh2Color2]); fwrite(hFile, var);
                format(var, 32, "Veh2_Fuel=%d\n", PlayerInfo[playerid][pVeh2Fuel]); fwrite(hFile, var);
                format(var, 32, "Veh2_Destroyed=%d\n", PlayerInfo[playerid][pVeh2Destroyed]); fwrite(hFile, var);
                format(var, 32, "Veh2_Mod1=%d\n", PlayerInfo[playerid][pVeh2Mod1]); fwrite(hFile, var);
                format(var, 32, "Veh2_Mod2=%d\n", PlayerInfo[playerid][pVeh2Mod2]); fwrite(hFile, var);
                format(var, 32, "Veh2_Mod3=%d\n", PlayerInfo[playerid][pVeh2Mod3]); fwrite(hFile, var);
                format(var, 32, "Veh2_Mod4=%d\n", PlayerInfo[playerid][pVeh2Mod4]); fwrite(hFile, var);
                format(var, 32, "Veh2_Mod5=%d\n", PlayerInfo[playerid][pVeh2Mod5]); fwrite(hFile, var);
                format(var, 32, "Veh2_Mod6=%d\n", PlayerInfo[playerid][pVeh2Mod6]); fwrite(hFile, var);
                format(var, 32, "Veh2_Mod7=%d\n", PlayerInfo[playerid][pVeh2Mod7]); fwrite(hFile, var);
                format(var, 32, "Veh2_Mod8=%d\n", PlayerInfo[playerid][pVeh2Mod8]); fwrite(hFile, var);
                format(var, 32, "Veh2_Mod9=%d\n", PlayerInfo[playerid][pVeh2Mod9]); fwrite(hFile, var);
                format(var, 32, "Veh2_Mod10=%d\n", PlayerInfo[playerid][pVeh2Mod10]); fwrite(hFile, var);
                format(var, 32, "Veh2_Mod11=%d\n", PlayerInfo[playerid][pVeh2Mod11]); fwrite(hFile, var);
                format(var, 32, "Veh2_Mod12=%d\n", PlayerInfo[playerid][pVeh2Mod12]); fwrite(hFile, var);
                format(var, 32, "Veh2_Mod13=%d\n", PlayerInfo[playerid][pVeh2Mod13]); fwrite(hFile, var);
                format(var, 32, "Veh2_Mod14=%d\n", PlayerInfo[playerid][pVeh2Mod14]); fwrite(hFile, var);
                format(var, 32, "Veh2_Mod15=%d\n", PlayerInfo[playerid][pVeh2Mod15]); fwrite(hFile, var);
                format(var, 32, "Veh2_Mod16=%d\n", PlayerInfo[playerid][pVeh2Mod16]); fwrite(hFile, var);
                format(var, 32, "Veh2_Mod17=%d\n", PlayerInfo[playerid][pVeh2Mod17]); fwrite(hFile, var);
                format(var, 32, "Veh2_Mod18=%d\n", PlayerInfo[playerid][pVeh2Mod18]); fwrite(hFile, var);
                format(var, 32, "Veh3_Model=%d\n", PlayerInfo[playerid][pVeh3Model]); fwrite(hFile, var);
                format(var, 32, "Veh3_X=%f\n", PlayerInfo[playerid][pVeh3X]); fwrite(hFile, var);
                format(var, 32, "Veh3_Y=%f\n", PlayerInfo[playerid][pVeh3Y]); fwrite(hFile, var);
                format(var, 32, "Veh3_Z=%f\n", PlayerInfo[playerid][pVeh3Z]); fwrite(hFile, var);
                format(var, 32, "Veh3_Rot=%f\n", PlayerInfo[playerid][pVeh3Rotation]); fwrite(hFile, var);
                format(var, 32, "Veh3_Paintjob=%d\n", PlayerInfo[playerid][pVeh3PaintJob]); fwrite(hFile, var);
                format(var, 32, "Veh3_Color1=%d\n", PlayerInfo[playerid][pVeh3Color1]); fwrite(hFile, var);
                format(var, 32, "Veh3_Color2=%d\n", PlayerInfo[playerid][pVeh3Color2]); fwrite(hFile, var);
                format(var, 32, "Veh3_Fuel=%d\n", PlayerInfo[playerid][pVeh3Fuel]); fwrite(hFile, var);
                format(var, 32, "Veh3_Destroyed=%d\n", PlayerInfo[playerid][pVeh3Destroyed]); fwrite(hFile, var);
                format(var, 32, "Veh3_Mod1=%d\n", PlayerInfo[playerid][pVeh3Mod1]); fwrite(hFile, var);
                format(var, 32, "Veh3_Mod2=%d\n", PlayerInfo[playerid][pVeh3Mod2]); fwrite(hFile, var);
                format(var, 32, "Veh3_Mod3=%d\n", PlayerInfo[playerid][pVeh3Mod3]); fwrite(hFile, var);
                format(var, 32, "Veh3_Mod4=%d\n", PlayerInfo[playerid][pVeh3Mod4]); fwrite(hFile, var);
                format(var, 32, "Veh3_Mod5=%d\n", PlayerInfo[playerid][pVeh3Mod5]); fwrite(hFile, var);
                format(var, 32, "Veh3_Mod6=%d\n", PlayerInfo[playerid][pVeh3Mod6]); fwrite(hFile, var);
                format(var, 32, "Veh3_Mod7=%d\n", PlayerInfo[playerid][pVeh3Mod7]); fwrite(hFile, var);
                format(var, 32, "Veh3_Mod8=%d\n", PlayerInfo[playerid][pVeh3Mod8]); fwrite(hFile, var);
                format(var, 32, "Veh3_Mod9=%d\n", PlayerInfo[playerid][pVeh3Mod9]); fwrite(hFile, var);
                format(var, 32, "Veh3_Mod10=%d\n", PlayerInfo[playerid][pVeh3Mod10]); fwrite(hFile, var);
                format(var, 32, "Veh3_Mod11=%d\n", PlayerInfo[playerid][pVeh3Mod11]); fwrite(hFile, var);
                format(var, 32, "Veh3_Mod12=%d\n", PlayerInfo[playerid][pVeh3Mod12]); fwrite(hFile, var);
                format(var, 32, "Veh3_Mod13=%d\n", PlayerInfo[playerid][pVeh3Mod13]); fwrite(hFile, var);
                format(var, 32, "Veh3_Mod14=%d\n", PlayerInfo[playerid][pVeh3Mod14]); fwrite(hFile, var);
                format(var, 32, "Veh3_Mod15=%d\n", PlayerInfo[playerid][pVeh3Mod15]); fwrite(hFile, var);
                format(var, 32, "Veh3_Mod16=%d\n", PlayerInfo[playerid][pVeh3Mod16]); fwrite(hFile, var);
                format(var, 32, "Veh3_Mod17=%d\n", PlayerInfo[playerid][pVeh3Mod17]); fwrite(hFile, var);
                format(var, 32, "Veh3_Mod18=%d\n", PlayerInfo[playerid][pVeh3Mod18]); fwrite(hFile, var);
                format(var, 32, "Veh1License=%s\n",PlayerInfo[playerid][pVeh1License]);fwrite(hFile, var);
                format(var, 32, "Veh2License=%s\n",PlayerInfo[playerid][pVeh2License]);fwrite(hFile, var);
                format(var, 32, "Veh3License=%s\n",PlayerInfo[playerid][pVeh3License]);fwrite(hFile, var);
                format(var, 32, "Veh1Slot1=%d\n", PlayerInfo[playerid][pVeh1Slot1]); fwrite(hFile, var);
                format(var, 32, "Veh1Slot1a=%d\n", PlayerInfo[playerid][pVeh1Slot1a]); fwrite(hFile, var);
                format(var, 32, "Veh1Slot2=%f\n", PlayerInfo[playerid][pVeh1Slot2]); fwrite(hFile, var);
                format(var, 32, "Veh1Slot3=%d\n", PlayerInfo[playerid][pVeh1Slot3]); fwrite(hFile, var);
                format(var, 32, "Veh2Slot1=%d\n", PlayerInfo[playerid][pVeh2Slot1]); fwrite(hFile, var);
                format(var, 32, "Veh2Slot1a=%d\n", PlayerInfo[playerid][pVeh2Slot1a]); fwrite(hFile, var);
                format(var, 32, "Veh2Slot2=%f\n", PlayerInfo[playerid][pVeh2Slot2]); fwrite(hFile, var);
                format(var, 32, "Veh2Slot3=%d\n", PlayerInfo[playerid][pVeh2Slot3]); fwrite(hFile, var);
                format(var, 32, "Veh3Slot1=%d\n", PlayerInfo[playerid][pVeh3Slot1]); fwrite(hFile, var);
                format(var, 32, "Veh3Slot1a=%d\n", PlayerInfo[playerid][pVeh3Slot1a]); fwrite(hFile, var);
                format(var, 32, "Veh3Slot2=%f\n", PlayerInfo[playerid][pVeh3Slot2]); fwrite(hFile, var);
                format(var, 32, "Veh3Slot3=%d\n", PlayerInfo[playerid][pVeh3Slot3]); fwrite(hFile, var);
                format(var, 32, "Object1=%d\n", PlayerInfo[playerid][pObject1]); fwrite(hFile, var);
                format(var, 32, "Object2=%d\n", PlayerInfo[playerid][pObject2]); fwrite(hFile, var);
                format(var, 32, "Object3=%d\n", PlayerInfo[playerid][pObject3]); fwrite(hFile, var);
                format(var, 32, "Object4=%d\n", PlayerInfo[playerid][pObject4]); fwrite(hFile, var);
                format(var, 32, "Object5=%d\n", PlayerInfo[playerid][pObject5]); fwrite(hFile, var);
               
                if(PlayerInfo[playerid][pDonator] > 1)
                {
                    format(var, 32, "Mask=%d\n", PlayerInfo[playerid][pMask]); fwrite(hFile, var);
                }
                if(PlayerInfo[playerid][pDonator] < 1)
                {
                    format(var, 32, "Mask=%d\n", 0); fwrite(hFile, var);
                }
                if(PlayerInfo[playerid][pRace] == 1)
                {
                    format(var, 32, "hColt45=%d\n",HumanSkill[playerid][hColt45]);fwrite(hFile, var);
                    format(var, 32, "hDesertEagle=%d\n",HumanSkill[playerid][hDesertEagle]);fwrite(hFile, var);
                    format(var, 32, "hSilencedPistol=%d\n",HumanSkill[playerid][hSilencedPistol]);fwrite(hFile, var);
                    format(var, 32, "hMicroUzi=%d\n",HumanSkill[playerid][hMicroUzi]);fwrite(hFile, var);
                    format(var, 32, "hMP5=%d\n",HumanSkill[playerid][hMP5]);fwrite(hFile, var);
                    format(var, 32, "hAK47=%d\n",HumanSkill[playerid][hAK47]);fwrite(hFile, var);
                    format(var, 32, "hM4=%d\n",HumanSkill[playerid][hM4]);fwrite(hFile, var);
                    format(var, 32, "hShotgun=%d\n",HumanSkill[playerid][hShotgun]);fwrite(hFile, var);
                    format(var, 32, "hSPAS12=%d\n",HumanSkill[playerid][hSPAS12]);fwrite(hFile, var);
                    format(var, 32, "hSniperRifle=%d\n",HumanSkill[playerid][hSniperRifle]);fwrite(hFile, var);
                }
                if(PlayerInfo[playerid][pRace] == 2)
                {
                    format(var, 32, "vJump=%d\n",VampireAbility[playerid][vJump]);fwrite(hFile, var);
                    format(var, 32, "vSpeed=%d\n",VampireAbility[playerid][vSpeed]);fwrite(hFile, var);
                    format(var, 32, "vSniff=%d\n",VampireAbility[playerid][vSniff]);fwrite(hFile, var);
                    format(var, 32, "vComb=%d\n",VampireAbility[playerid][vComb]);fwrite(hFile, var);
                    format(var, 32, "vBite=%d\n",VampireAbility[playerid][vBite]);fwrite(hFile, var);
                    format(var, 32, "vBloodPoints=%d\n",VampireAbility[playerid][vBloodPoints]);fwrite(hFile, var);
                    format(var, 32, "vBPMax=%d\n",VampireAbility[playerid][vBPMax]);fwrite(hFile, var);
                }
                fclose(hFile);
            }
            PlayerInfo[playerid][pGun1] = 0; PlayerInfo[playerid][pAmmo1] = 0;
            PlayerInfo[playerid][pGun2] = 0; PlayerInfo[playerid][pAmmo2] = 0;
            PlayerInfo[playerid][pGun3] = 0; PlayerInfo[playerid][pAmmo3] = 0;
            PlayerInfo[playerid][pGun4] = 0; PlayerInfo[playerid][pAmmo4] = 0;
        }
    }
    return 1;
}

And this is OnPlayerDisconnect callback
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
    ResetStats(playerid);
    ResetVampireAbilities(playerid);
    ResetHumanSkills(playerid);
    if(gPlayerLogged[playerid])
    {
        if(reason == 0)
        {
            new Float:x,Float:y,Float:z;
            GetPlayerPos(playerid,x,y,z);
            PlayerInfo[playerid][pCrashX] = x;
            PlayerInfo[playerid][pCrashY] = y;
            PlayerInfo[playerid][pCrashZ] = z;
            PlayerInfo[playerid][pCrashInt] = GetPlayerInterior(playerid);
            PlayerInfo[playerid][pCrashW] = GetPlayerVirtualWorld(playerid);
            PlayerInfo[playerid][pCrashed] = 1;
            PlayerLocalMessage(playerid,20.0,"left the server. (Timed out)");
            for(new i = 0; i < MAX_ONLINE_PLAYERS; i++)
            {
                if(JoinStatus[i] == 0 && PlayerInfo[i][pAdmin] > 0)
                {
                    new joinstring[128];
                    format(joinstring,sizeof joinstring,"*** %s left the server. (Timed out)",GetPlayerNameEx(playerid));
                    SendClientMessage(i,COLOR_GREY,joinstring);
                }
            }
        }
        else if(reason == 1)
        {
            PlayerLocalMessage(playerid,20.0,"left the server. (Leaving)");
            for(new i = 0; i < MAX_ONLINE_PLAYERS; i++)
            {
                if(JoinStatus[i] == 0 && PlayerInfo[i][pAdmin] > 0)
                {
                    new joinstring[128];
                    format(joinstring,sizeof joinstring,"*** %s left the server. (Leaving)",GetPlayerNameEx(playerid));
                    SendClientMessage(i,COLOR_GREY,joinstring);
                }
            }
        }
        else if(reason == 2)
        {
            PlayerLocalMessage(playerid,20.0,"left the server. (Kicked)");
            for(new i = 0; i < MAX_ONLINE_PLAYERS; i++)
            {
                if(JoinStatus[i] == 0 && PlayerInfo[i][pAdmin] > 0)
                {
                    new joinstring[128];
                    format(joinstring,sizeof joinstring,"*** %s left the server. (Kicked)",GetPlayerNameEx(playerid));
                    SendClientMessage(i,COLOR_GREY,joinstring);
                }
            }
        }
        if(PlayerInfo[playerid][pVeh1CarID]!=-1)
        {
            PlayerInfo[playerid][pVeh1Fuel] = Fuel[PlayerInfo[playerid][pVeh1CarID]];
            DestroyVehicle(PlayerInfo[playerid][pVeh1CarID]);
        }
        else if(PlayerInfo[playerid][pVeh2CarID]!=-1)
        {
            PlayerInfo[playerid][pVeh2Fuel] = Fuel[PlayerInfo[playerid][pVeh2CarID]];
            DestroyVehicle(PlayerInfo[playerid][pVeh2CarID]);
        }
        else if(PlayerInfo[playerid][pVeh3CarID]!=-1)
        {
            PlayerInfo[playerid][pVeh3Fuel] = Fuel[PlayerInfo[playerid][pVeh3CarID]];
            DestroyVehicle(PlayerInfo[playerid][pVeh3CarID]);
        }
        if(CopOnDuty[playerid] == 1)
        {
            new string[MAX_PLAYER_NAME + 32];
            format(string, sizeof(string), "[POLICE:] %s is no longer on duty.",GetPlayerNameEx(playerid));
            SendFactionTypeMessage(1, COLOR_POLICE, string);
        }
        OnPlayerDataSave(playerid);
        DestroyVehicle(DMVCar[playerid]);
        DestroyObject(PlantID[playerid]);
        KillTimer(WeedTimer[playerid]);
        KillTimer(DeathTimer[playerid]);
    }
    return 1;
}

Please help me out, this is very important. I don't know what I am doing wrong :/
Reply
#2

In your OnPlayerDataSave function you have an IsPlayerConnected check, yet you are calling this function in OnPlayerDisconnect, if the player is disconnected then IsPlayerConnected isn't going to be true

I may be wrong though, it may actually return true, other than that you should do some debugging, add some print values before/after each if statement in your function and make sure it is passing the statements.
Reply
#3

Okay, I tried debugging it and this is what I got:

Код:
[22:43:19] [part] Marcus_Keaton has left the server (0:1)
[22:43:19] Passed
[22:43:19] Resetting stats
[22:43:19] KILLED
[22:43:19] Destroying weed, DMV car and killing timers...
[22:43:19] Passed the save...
[22:43:19] pre-return part
[22:43:19] PASSED
[22:43:19] Resetting weapons...
[22:43:19] Starting to write in the file... checking if file exists.
[22:43:19] Saved the weapons
[22:43:19] Checking if on duty...
[22:43:19] Set the money
[22:43:19] CHECK PASSED
[22:43:19] Checking for money hacks...
[22:43:19] CHECK PASSED
[22:43:19] Checking of player is logged in...
[22:43:19] Starting to save...
[22:43:19] Checking if on duty
[22:43:19] Vehicle check passed
[22:43:19] Checking for spawned personal vehicles...
[22:43:19] reason 1 passed
[22:43:19] Check passed, player is leaving...
[22:43:19] Checking disconnection reason...
[22:43:19] Checking if player is logged in...
It seems like it skipped the whole file saving part:

pawn Код:
print("Saved the weapons");
            new string3[128];
            format(string3, sizeof(string3), "Accounts/%s.ini", PlayerName(playerid));
            new File: hFile = fopen(string3, io_write);
            print("Starting to write in the file... checking if file exists.");
            if (hFile)
            {
                print("File exists...");
                new var[32];
                PlayerInfo[playerid][pCash] = GetPlayerCash(playerid);
                format(var, 32, "Key=%s\n", PlayerInfo[playerid][pKey]);fwrite(hFile, var);
                format(var, 32, "Level=%d\n",PlayerInfo[playerid][pLevel]);fwrite(hFile, var);
                format(var, 32, "AdminLevel=%d\n",PlayerInfo[playerid][pAdmin]);fwrite(hFile, var);
                format(var, 32, "GMLevel=%d\n",PlayerInfo[playerid][pGM]);fwrite(hFile, var);
                format(var, 32, "DonateRank=%d\n",PlayerInfo[playerid][pDonateRank]);fwrite(hFile, var);
                format(var, 32, "Registered=%d\n",PlayerInfo[playerid][pRegistered]);fwrite(hFile, var);
                format(var, 32, "Sex=%d\n",PlayerInfo[playerid][pSex]);fwrite(hFile, var);
                format(var, 32, "Race=%d\n",PlayerInfo[playerid][pRace]);fwrite(hFile, var);
                format(var, 32, "Experience=%d\n",PlayerInfo[playerid][pExp]);fwrite(hFile, var);
                format(var, 32, "Money=%d\n",PlayerInfo[playerid][pCash]);fwrite(hFile, var);
                format(var, 32, "Bank=%d\n",PlayerInfo[playerid][pBank]);fwrite(hFile, var);
                format(var, 32, "Skin=%i\n",PlayerInfo[playerid][pSkin]);fwrite(hFile, var);
                format(var, 32, "PlayingHours=%d\n",PlayerInfo[playerid][pPlayingHours]);fwrite(hFile, var);
                format(var, 32, "AllowedPayday=%d\n",PlayerInfo[playerid][pAllowedPayday]);fwrite(hFile, var);
                format(var, 32, "Insurance=%d\n",PlayerInfo[playerid][pInsurance]);fwrite(hFile, var);
                format(var, 32, "Faction=%d\n",PlayerInfo[playerid][pFaction]);fwrite(hFile, var);
                format(var, 32, "Rank=%d\n",PlayerInfo[playerid][pRank]);fwrite(hFile, var);
                format(var, 32, "HouseKey=%d\n",PlayerInfo[playerid][pHouseKey]);fwrite(hFile, var);
                format(var, 32, "BizKey=%d\n",PlayerInfo[playerid][pBizKey]);fwrite(hFile, var);
                format(var, 32, "SpawnPoint=%d\n",PlayerInfo[playerid][pSpawnPoint]);fwrite(hFile, var);
                format(var, 32, "PhoneNumber=%d\n",PlayerInfo[playerid][pPhoneNumber]);fwrite(hFile, var);
                format(var, 32, "PhoneC=%d\n",PlayerInfo[playerid][pPhoneC]);fwrite(hFile, var);
                format(var, 32, "PhoneBook=%d\n",PlayerInfo[playerid][pPhoneBook]);fwrite(hFile, var);
                format(var, 32, "ListNumber=%d\n",PlayerInfo[playerid][pListNumber]);fwrite(hFile, var);
                format(var, 32, "Donator=%d\n",PlayerInfo[playerid][pDonator]);fwrite(hFile, var);
                format(var, 32, "Job=%d\n",PlayerInfo[playerid][pJob]);fwrite(hFile, var);
                format(var, 32, "Ajailed=%d\n",PlayerInfo[playerid][pAjailed]);fwrite(hFile, var);
                format(var, 32, "JailTime=%d\n",PlayerInfo[playerid][pJailTime]);fwrite(hFile, var);
                format(var, 32, "Jailed=%d\n",PlayerInfo[playerid][pJailed]);fwrite(hFile, var);
                format(var, 32, "Wanted=%d\n",PlayerInfo[playerid][pWanted]);fwrite(hFile, var);
                format(var, 32, "WantedFor=%s\n",PlayerInfo[playerid][pWantedFor]);fwrite(hFile, var);
                format(var, 32, "DriverLicense=%d\n",PlayerInfo[playerid][pDriverLicense]);fwrite(hFile, var);
                format(var, 32, "WeaponLicense=%d\n",PlayerInfo[playerid][pWeaponLicense]);fwrite(hFile, var);
                format(var, 32, "CrashX=%.1f\n",PlayerInfo[playerid][pCrashX]);fwrite(hFile, var);
                format(var, 32, "CrashY=%.1f\n",PlayerInfo[playerid][pCrashY]);fwrite(hFile, var);
                format(var, 32, "CrashZ=%.1f\n",PlayerInfo[playerid][pCrashZ]);fwrite(hFile, var);
                GetPlayerHealth(playerid, PlayerInfo[playerid][pHealth]);
                if(PlayerInfo[playerid][pHealth] > 100) PlayerInfo[playerid][pHealth] = oldhp[playerid];
                format(var, 32, "Health=%f\n", PlayerInfo[playerid][pHealth]);fwrite(hFile, var);
                GetPlayerArmour(playerid, PlayerInfo[playerid][pArmour]);
                if(CopOnDuty[playerid] != 0) PlayerInfo[playerid][pArmour] = 0;
                format(var, 32, "Armour=%f\n", PlayerInfo[playerid][pArmour]);fwrite(hFile, var);
                format(var, 32, "Paycheck=%d\n",PlayerInfo[playerid][pPaycheck]);fwrite(hFile, var);
                format(var, 32, "CrashInt=%d\n",PlayerInfo[playerid][pCrashInt]);fwrite(hFile, var);
                format(var, 32, "CrashW=%d\n",PlayerInfo[playerid][pCrashW]);fwrite(hFile, var);
                format(var, 32, "Crashed=%d\n",PlayerInfo[playerid][pCrashed]);fwrite(hFile, var);
                format(var, 64, "Gun1=%d\n",PlayerInfo[playerid][pGun1]);fwrite(hFile, var);
                format(var, 64, "Gun2=%d\n",PlayerInfo[playerid][pGun2]);fwrite(hFile, var);
                format(var, 64, "Gun3=%d\n",PlayerInfo[playerid][pGun3]);fwrite(hFile, var);
                format(var, 64, "Gun4=%d\n",PlayerInfo[playerid][pGun4]);fwrite(hFile, var);
                format(var, 64, "Ammo1=%d\n",PlayerInfo[playerid][pAmmo1]);fwrite(hFile, var);
                format(var, 64, "Ammo2=%d\n",PlayerInfo[playerid][pAmmo2]);fwrite(hFile, var);
                format(var, 64, "Ammo3=%d\n",PlayerInfo[playerid][pAmmo3]);fwrite(hFile, var);
                format(var, 64, "Ammo4=%d\n",PlayerInfo[playerid][pAmmo4]);fwrite(hFile, var);
                format(var, 32, "LearningPoints=%d\n",PlayerInfo[playerid][pLearn]);fwrite(hFile, var);
                format(var, 32, "UniqueID=%d\n",PlayerInfo[playerid][pUniqueID]);fwrite(hFile, var);
                format(var, 64, "Seeds=%d\n",PlayerInfo[playerid][pSeeds]);fwrite(hFile, var);
                format(var, 64, "Weed=%d\n",PlayerInfo[playerid][pWeed]);fwrite(hFile, var);
                format(var, 32, "WeedX=%f\n",PlayerInfo[playerid][pWeedX]);fwrite(hFile, var);
                format(var, 32, "WeedY=%f\n",PlayerInfo[playerid][pWeedY]);fwrite(hFile, var);
                format(var, 32, "WeedZ=%f\n",PlayerInfo[playerid][pWeedZ]);fwrite(hFile, var);
                format(var, 32, "WeedR=%f\n",PlayerInfo[playerid][pWeedR]);fwrite(hFile, var);
                format(var, 64, "WeedTimeLeft=%d\n",PlayerInfo[playerid][pWeedTimeLeft]);fwrite(hFile, var);
                format(var, 32, "MaskID=%s\n",PlayerInfo[playerid][pMaskID]);fwrite(hFile, var);
                format(var, 32, "Veh1_Model=%d\n", PlayerInfo[playerid][pVeh1Model]); fwrite(hFile, var);
                format(var, 32, "Veh1_X=%f\n", PlayerInfo[playerid][pVeh1X]); fwrite(hFile, var);
                format(var, 32, "Veh1_Y=%f\n", PlayerInfo[playerid][pVeh1Y]); fwrite(hFile, var);
                format(var, 32, "Veh1_Z=%f\n", PlayerInfo[playerid][pVeh1Z]); fwrite(hFile, var);
                format(var, 32, "Veh1_Rot=%f\n", PlayerInfo[playerid][pVeh1Rotation]); fwrite(hFile, var);
                format(var, 32, "Veh1_Paintjob=%d\n", PlayerInfo[playerid][pVeh1PaintJob]); fwrite(hFile, var);
                format(var, 32, "Veh1_Color1=%d\n", PlayerInfo[playerid][pVeh1Color1]); fwrite(hFile, var);
                format(var, 32, "Veh1_Color2=%d\n", PlayerInfo[playerid][pVeh1Color2]); fwrite(hFile, var);
                format(var, 32, "Veh1_Fuel=%d\n", PlayerInfo[playerid][pVeh1Fuel]); fwrite(hFile, var);
                format(var, 32, "Veh1_Destroyed=%d\n", PlayerInfo[playerid][pVeh1Destroyed]); fwrite(hFile, var);
                format(var, 32, "Veh1_Mod1=%d\n", PlayerInfo[playerid][pVeh1Mod1]); fwrite(hFile, var);
                format(var, 32, "Veh1_Mod2=%d\n", PlayerInfo[playerid][pVeh1Mod2]); fwrite(hFile, var);
                format(var, 32, "Veh1_Mod3=%d\n", PlayerInfo[playerid][pVeh1Mod3]); fwrite(hFile, var);
                format(var, 32, "Veh1_Mod4=%d\n", PlayerInfo[playerid][pVeh1Mod4]); fwrite(hFile, var);
                format(var, 32, "Veh1_Mod5=%d\n", PlayerInfo[playerid][pVeh1Mod5]); fwrite(hFile, var);
                format(var, 32, "Veh1_Mod6=%d\n", PlayerInfo[playerid][pVeh1Mod6]); fwrite(hFile, var);
                format(var, 32, "Veh1_Mod7=%d\n", PlayerInfo[playerid][pVeh1Mod7]); fwrite(hFile, var);
                format(var, 32, "Veh1_Mod8=%d\n", PlayerInfo[playerid][pVeh1Mod8]); fwrite(hFile, var);
                format(var, 32, "Veh1_Mod9=%d\n", PlayerInfo[playerid][pVeh1Mod9]); fwrite(hFile, var);
                format(var, 32, "Veh1_Mod10=%d\n", PlayerInfo[playerid][pVeh1Mod10]); fwrite(hFile, var);
                format(var, 32, "Veh1_Mod11=%d\n", PlayerInfo[playerid][pVeh1Mod11]); fwrite(hFile, var);
                format(var, 32, "Veh1_Mod12=%d\n", PlayerInfo[playerid][pVeh1Mod12]); fwrite(hFile, var);
                format(var, 32, "Veh1_Mod13=%d\n", PlayerInfo[playerid][pVeh1Mod13]); fwrite(hFile, var);
                format(var, 32, "Veh1_Mod14=%d\n", PlayerInfo[playerid][pVeh1Mod14]); fwrite(hFile, var);
                format(var, 32, "Veh1_Mod15=%d\n", PlayerInfo[playerid][pVeh1Mod15]); fwrite(hFile, var);
                format(var, 32, "Veh1_Mod16=%d\n", PlayerInfo[playerid][pVeh1Mod16]); fwrite(hFile, var);
                format(var, 32, "Veh1_Mod17=%d\n", PlayerInfo[playerid][pVeh1Mod17]); fwrite(hFile, var);
                format(var, 32, "Veh1_Mod18=%d\n", PlayerInfo[playerid][pVeh1Mod18]); fwrite(hFile, var);
                format(var, 32, "Veh2_Model=%d\n", PlayerInfo[playerid][pVeh2Model]); fwrite(hFile, var);
                format(var, 32, "Veh2_X=%f\n", PlayerInfo[playerid][pVeh2X]); fwrite(hFile, var);
                format(var, 32, "Veh2_Y=%f\n", PlayerInfo[playerid][pVeh2Y]); fwrite(hFile, var);
                format(var, 32, "Veh2_Z=%f\n", PlayerInfo[playerid][pVeh2Z]); fwrite(hFile, var);
                format(var, 32, "Veh2_Rot=%d\n", PlayerInfo[playerid][pVeh2Rotation]); fwrite(hFile, var);
                format(var, 32, "Veh2_Paintjob=%d\n", PlayerInfo[playerid][pVeh2PaintJob]); fwrite(hFile, var);
                format(var, 32, "Veh2_Color1=%d\n", PlayerInfo[playerid][pVeh2Color1]); fwrite(hFile, var);
                format(var, 32, "Veh2_Color2=%d\n", PlayerInfo[playerid][pVeh2Color2]); fwrite(hFile, var);
                format(var, 32, "Veh2_Fuel=%d\n", PlayerInfo[playerid][pVeh2Fuel]); fwrite(hFile, var);
                format(var, 32, "Veh2_Destroyed=%d\n", PlayerInfo[playerid][pVeh2Destroyed]); fwrite(hFile, var);
                format(var, 32, "Veh2_Mod1=%d\n", PlayerInfo[playerid][pVeh2Mod1]); fwrite(hFile, var);
                format(var, 32, "Veh2_Mod2=%d\n", PlayerInfo[playerid][pVeh2Mod2]); fwrite(hFile, var);
                format(var, 32, "Veh2_Mod3=%d\n", PlayerInfo[playerid][pVeh2Mod3]); fwrite(hFile, var);
                format(var, 32, "Veh2_Mod4=%d\n", PlayerInfo[playerid][pVeh2Mod4]); fwrite(hFile, var);
                format(var, 32, "Veh2_Mod5=%d\n", PlayerInfo[playerid][pVeh2Mod5]); fwrite(hFile, var);
                format(var, 32, "Veh2_Mod6=%d\n", PlayerInfo[playerid][pVeh2Mod6]); fwrite(hFile, var);
                format(var, 32, "Veh2_Mod7=%d\n", PlayerInfo[playerid][pVeh2Mod7]); fwrite(hFile, var);
                format(var, 32, "Veh2_Mod8=%d\n", PlayerInfo[playerid][pVeh2Mod8]); fwrite(hFile, var);
                format(var, 32, "Veh2_Mod9=%d\n", PlayerInfo[playerid][pVeh2Mod9]); fwrite(hFile, var);
                format(var, 32, "Veh2_Mod10=%d\n", PlayerInfo[playerid][pVeh2Mod10]); fwrite(hFile, var);
                format(var, 32, "Veh2_Mod11=%d\n", PlayerInfo[playerid][pVeh2Mod11]); fwrite(hFile, var);
                format(var, 32, "Veh2_Mod12=%d\n", PlayerInfo[playerid][pVeh2Mod12]); fwrite(hFile, var);
                format(var, 32, "Veh2_Mod13=%d\n", PlayerInfo[playerid][pVeh2Mod13]); fwrite(hFile, var);
                format(var, 32, "Veh2_Mod14=%d\n", PlayerInfo[playerid][pVeh2Mod14]); fwrite(hFile, var);
                format(var, 32, "Veh2_Mod15=%d\n", PlayerInfo[playerid][pVeh2Mod15]); fwrite(hFile, var);
                format(var, 32, "Veh2_Mod16=%d\n", PlayerInfo[playerid][pVeh2Mod16]); fwrite(hFile, var);
                format(var, 32, "Veh2_Mod17=%d\n", PlayerInfo[playerid][pVeh2Mod17]); fwrite(hFile, var);
                format(var, 32, "Veh2_Mod18=%d\n", PlayerInfo[playerid][pVeh2Mod18]); fwrite(hFile, var);
                format(var, 32, "Veh3_Model=%d\n", PlayerInfo[playerid][pVeh3Model]); fwrite(hFile, var);
                format(var, 32, "Veh3_X=%f\n", PlayerInfo[playerid][pVeh3X]); fwrite(hFile, var);
                format(var, 32, "Veh3_Y=%f\n", PlayerInfo[playerid][pVeh3Y]); fwrite(hFile, var);
                format(var, 32, "Veh3_Z=%f\n", PlayerInfo[playerid][pVeh3Z]); fwrite(hFile, var);
                format(var, 32, "Veh3_Rot=%f\n", PlayerInfo[playerid][pVeh3Rotation]); fwrite(hFile, var);
                format(var, 32, "Veh3_Paintjob=%d\n", PlayerInfo[playerid][pVeh3PaintJob]); fwrite(hFile, var);
                format(var, 32, "Veh3_Color1=%d\n", PlayerInfo[playerid][pVeh3Color1]); fwrite(hFile, var);
                format(var, 32, "Veh3_Color2=%d\n", PlayerInfo[playerid][pVeh3Color2]); fwrite(hFile, var);
                format(var, 32, "Veh3_Fuel=%d\n", PlayerInfo[playerid][pVeh3Fuel]); fwrite(hFile, var);
                format(var, 32, "Veh3_Destroyed=%d\n", PlayerInfo[playerid][pVeh3Destroyed]); fwrite(hFile, var);
                format(var, 32, "Veh3_Mod1=%d\n", PlayerInfo[playerid][pVeh3Mod1]); fwrite(hFile, var);
                format(var, 32, "Veh3_Mod2=%d\n", PlayerInfo[playerid][pVeh3Mod2]); fwrite(hFile, var);
                format(var, 32, "Veh3_Mod3=%d\n", PlayerInfo[playerid][pVeh3Mod3]); fwrite(hFile, var);
                format(var, 32, "Veh3_Mod4=%d\n", PlayerInfo[playerid][pVeh3Mod4]); fwrite(hFile, var);
                format(var, 32, "Veh3_Mod5=%d\n", PlayerInfo[playerid][pVeh3Mod5]); fwrite(hFile, var);
                format(var, 32, "Veh3_Mod6=%d\n", PlayerInfo[playerid][pVeh3Mod6]); fwrite(hFile, var);
                format(var, 32, "Veh3_Mod7=%d\n", PlayerInfo[playerid][pVeh3Mod7]); fwrite(hFile, var);
                format(var, 32, "Veh3_Mod8=%d\n", PlayerInfo[playerid][pVeh3Mod8]); fwrite(hFile, var);
                format(var, 32, "Veh3_Mod9=%d\n", PlayerInfo[playerid][pVeh3Mod9]); fwrite(hFile, var);
                format(var, 32, "Veh3_Mod10=%d\n", PlayerInfo[playerid][pVeh3Mod10]); fwrite(hFile, var);
                format(var, 32, "Veh3_Mod11=%d\n", PlayerInfo[playerid][pVeh3Mod11]); fwrite(hFile, var);
                format(var, 32, "Veh3_Mod12=%d\n", PlayerInfo[playerid][pVeh3Mod12]); fwrite(hFile, var);
                format(var, 32, "Veh3_Mod13=%d\n", PlayerInfo[playerid][pVeh3Mod13]); fwrite(hFile, var);
                format(var, 32, "Veh3_Mod14=%d\n", PlayerInfo[playerid][pVeh3Mod14]); fwrite(hFile, var);
                format(var, 32, "Veh3_Mod15=%d\n", PlayerInfo[playerid][pVeh3Mod15]); fwrite(hFile, var);
                format(var, 32, "Veh3_Mod16=%d\n", PlayerInfo[playerid][pVeh3Mod16]); fwrite(hFile, var);
                format(var, 32, "Veh3_Mod17=%d\n", PlayerInfo[playerid][pVeh3Mod17]); fwrite(hFile, var);
                format(var, 32, "Veh3_Mod18=%d\n", PlayerInfo[playerid][pVeh3Mod18]); fwrite(hFile, var);
                format(var, 32, "Veh1License=%s\n",PlayerInfo[playerid][pVeh1License]);fwrite(hFile, var);
                format(var, 32, "Veh2License=%s\n",PlayerInfo[playerid][pVeh2License]);fwrite(hFile, var);
                format(var, 32, "Veh3License=%s\n",PlayerInfo[playerid][pVeh3License]);fwrite(hFile, var);
                format(var, 32, "Veh1Slot1=%d\n", PlayerInfo[playerid][pVeh1Slot1]); fwrite(hFile, var);
                format(var, 32, "Veh1Slot1a=%d\n", PlayerInfo[playerid][pVeh1Slot1a]); fwrite(hFile, var);
                format(var, 32, "Veh1Slot2=%f\n", PlayerInfo[playerid][pVeh1Slot2]); fwrite(hFile, var);
                format(var, 32, "Veh1Slot3=%d\n", PlayerInfo[playerid][pVeh1Slot3]); fwrite(hFile, var);
                format(var, 32, "Veh2Slot1=%d\n", PlayerInfo[playerid][pVeh2Slot1]); fwrite(hFile, var);
                format(var, 32, "Veh2Slot1a=%d\n", PlayerInfo[playerid][pVeh2Slot1a]); fwrite(hFile, var);
                format(var, 32, "Veh2Slot2=%f\n", PlayerInfo[playerid][pVeh2Slot2]); fwrite(hFile, var);
                format(var, 32, "Veh2Slot3=%d\n", PlayerInfo[playerid][pVeh2Slot3]); fwrite(hFile, var);
                format(var, 32, "Veh3Slot1=%d\n", PlayerInfo[playerid][pVeh3Slot1]); fwrite(hFile, var);
                format(var, 32, "Veh3Slot1a=%d\n", PlayerInfo[playerid][pVeh3Slot1a]); fwrite(hFile, var);
                format(var, 32, "Veh3Slot2=%f\n", PlayerInfo[playerid][pVeh3Slot2]); fwrite(hFile, var);
                format(var, 32, "Veh3Slot3=%d\n", PlayerInfo[playerid][pVeh3Slot3]); fwrite(hFile, var);
                format(var, 32, "Object1=%d\n", PlayerInfo[playerid][pObject1]); fwrite(hFile, var);
                format(var, 32, "Object2=%d\n", PlayerInfo[playerid][pObject2]); fwrite(hFile, var);
                format(var, 32, "Object3=%d\n", PlayerInfo[playerid][pObject3]); fwrite(hFile, var);
                format(var, 32, "Object4=%d\n", PlayerInfo[playerid][pObject4]); fwrite(hFile, var);
                format(var, 32, "Object5=%d\n", PlayerInfo[playerid][pObject5]); fwrite(hFile, var);
                print("Saved mutual variables, checking if donator...");
                if(PlayerInfo[playerid][pDonator] > 1)
                {
                    format(var, 32, "Mask=%d\n", PlayerInfo[playerid][pMask]); fwrite(hFile, var);
                }
                if(PlayerInfo[playerid][pDonator] < 1)
                {
                    format(var, 32, "Mask=%d\n", 0); fwrite(hFile, var);
                }
                print("Passed the donator check");
                print("Checking if player is human or vampire...");
                if(PlayerInfo[playerid][pRace] == 1)
                {
                    print("Saving human stats");
                    format(var, 32, "hColt45=%d\n",HumanSkill[playerid][hColt45]);fwrite(hFile, var);
                    format(var, 32, "hDesertEagle=%d\n",HumanSkill[playerid][hDesertEagle]);fwrite(hFile, var);
                    format(var, 32, "hSilencedPistol=%d\n",HumanSkill[playerid][hSilencedPistol]);fwrite(hFile, var);
                    format(var, 32, "hMicroUzi=%d\n",HumanSkill[playerid][hMicroUzi]);fwrite(hFile, var);
                    format(var, 32, "hMP5=%d\n",HumanSkill[playerid][hMP5]);fwrite(hFile, var);
                    format(var, 32, "hAK47=%d\n",HumanSkill[playerid][hAK47]);fwrite(hFile, var);
                    format(var, 32, "hM4=%d\n",HumanSkill[playerid][hM4]);fwrite(hFile, var);
                    format(var, 32, "hShotgun=%d\n",HumanSkill[playerid][hShotgun]);fwrite(hFile, var);
                    format(var, 32, "hSPAS12=%d\n",HumanSkill[playerid][hSPAS12]);fwrite(hFile, var);
                    format(var, 32, "hSniperRifle=%d\n",HumanSkill[playerid][hSniperRifle]);fwrite(hFile, var);
                }
                if(PlayerInfo[playerid][pRace] == 2)
                {
                    print("Saving vampire stats");
                    format(var, 32, "vJump=%d\n",VampireAbility[playerid][vJump]);fwrite(hFile, var);
                    format(var, 32, "vSpeed=%d\n",VampireAbility[playerid][vSpeed]);fwrite(hFile, var);
                    format(var, 32, "vSniff=%d\n",VampireAbility[playerid][vSniff]);fwrite(hFile, var);
                    format(var, 32, "vComb=%d\n",VampireAbility[playerid][vComb]);fwrite(hFile, var);
                    format(var, 32, "vBite=%d\n",VampireAbility[playerid][vBite]);fwrite(hFile, var);
                    format(var, 32, "vBloodPoints=%d\n",VampireAbility[playerid][vBloodPoints]);fwrite(hFile, var);
                    format(var, 32, "vBPMax=%d\n",VampireAbility[playerid][vBPMax]);fwrite(hFile, var);
                }
                print("File saved, closing it...");
                fclose(hFile);
                print("File closed");
            }
            print("Resetting weapons...");
            PlayerInfo[playerid][pGun1] = 0; PlayerInfo[playerid][pAmmo1] = 0;
            PlayerInfo[playerid][pGun2] = 0; PlayerInfo[playerid][pAmmo2] = 0;
            PlayerInfo[playerid][pGun3] = 0; PlayerInfo[playerid][pAmmo3] = 0;
            PlayerInfo[playerid][pGun4] = 0; PlayerInfo[playerid][pAmmo4] = 0;
            print("PASSED");
        }
        print("pre-return part");
        return 1;
Now, account path on FTP is the following: "/scriptfiles/Accounts", which is the same as defined in the script. Now I really don't know what the problem is :/

This is my PlayerName(playerid) stock function:
pawn Код:
stock PlayerName(playerid)
{
  new name[255];
  GetPlayerName(playerid, name, 255);
  return name;
}
Reply
#4

What I did notice is that you have a function called ResetStats, earlier on in the OnPlayerDisconnect callback, is that by any chance resetting something like the gPlayerLogged[playerid] variable? If it is, then none of the saving code will get run because you're logging the player out before saving it.

Also, the debug information, while useful to you, isn't helping me because you have not posted your updated code with the prints, so I can't see where the final print happened when you disconnected
Reply
#5

pawn Код:
stock PlayerName(playerid)
{
  new name[255];
  GetPlayerName(playerid, name, 255);
  return name;
}
Why are you using 255 for a simple player name string? That's a waste of memory. The max length of playername is 24.
Reply
#6

Okay, I moved the ResetStats, ResetHumanSkills and ResetVampireAbbilities to OnPlayerConnect and still the same thing is happening. Here's the updated code.

OnPlayerDisconnect
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
    print("OnPlayerDisconnect Started");
    print("==================================");
    print("Checking if player is logged in...");
    if(gPlayerLogged[playerid])
    {
        print("Checking disconnection reason...");
        if(reason == 0)
        {
            new Float:x,Float:y,Float:z;
            GetPlayerPos(playerid,x,y,z);
            PlayerInfo[playerid][pCrashX] = x;
            PlayerInfo[playerid][pCrashY] = y;
            PlayerInfo[playerid][pCrashZ] = z;
            PlayerInfo[playerid][pCrashInt] = GetPlayerInterior(playerid);
            PlayerInfo[playerid][pCrashW] = GetPlayerVirtualWorld(playerid);
            PlayerInfo[playerid][pCrashed] = 1;
            PlayerLocalMessage(playerid,20.0,"left the server. (Timed out)");
            for(new i = 0; i < MAX_ONLINE_PLAYERS; i++)
            {
                if(JoinStatus[i] == 0 && PlayerInfo[i][pAdmin] > 0)
                {
                    new joinstring[128];
                    format(joinstring,sizeof joinstring,"*** %s left the server. (Timed out)",GetPlayerNameEx(playerid));
                    SendClientMessage(i,COLOR_GREY,joinstring);
                }
            }
        }
        else if(reason == 1)
        {
            print("Check passed, player is leaving...");
            PlayerLocalMessage(playerid,20.0,"left the server. (Leaving)");
            for(new i = 0; i < MAX_ONLINE_PLAYERS; i++)
            {
                if(JoinStatus[i] == 0 && PlayerInfo[i][pAdmin] > 0)
                {
                    new joinstring[128];
                    format(joinstring,sizeof joinstring,"*** %s left the server. (Leaving)",GetPlayerNameEx(playerid));
                    SendClientMessage(i,COLOR_GREY,joinstring);
                }
            }
            print("reason 1 passed");
        }
        else if(reason == 2)
        {
            PlayerLocalMessage(playerid,20.0,"left the server. (Kicked)");
            for(new i = 0; i < MAX_ONLINE_PLAYERS; i++)
            {
                if(JoinStatus[i] == 0 && PlayerInfo[i][pAdmin] > 0)
                {
                    new joinstring[128];
                    format(joinstring,sizeof joinstring,"*** %s left the server. (Kicked)",GetPlayerNameEx(playerid));
                    SendClientMessage(i,COLOR_GREY,joinstring);
                }
            }
        }
        print("Checking for spawned personal vehicles...");
        if(PlayerInfo[playerid][pVeh1CarID]!=-1)
        {
            PlayerInfo[playerid][pVeh1Fuel] = Fuel[PlayerInfo[playerid][pVeh1CarID]];
            DestroyVehicle(PlayerInfo[playerid][pVeh1CarID]);
        }
        else if(PlayerInfo[playerid][pVeh2CarID]!=-1)
        {
            PlayerInfo[playerid][pVeh2Fuel] = Fuel[PlayerInfo[playerid][pVeh2CarID]];
            DestroyVehicle(PlayerInfo[playerid][pVeh2CarID]);
        }
        else if(PlayerInfo[playerid][pVeh3CarID]!=-1)
        {
            PlayerInfo[playerid][pVeh3Fuel] = Fuel[PlayerInfo[playerid][pVeh3CarID]];
            DestroyVehicle(PlayerInfo[playerid][pVeh3CarID]);
        }
        print("Vehicle check passed");
        print("Checking if on duty");
        if(CopOnDuty[playerid] == 1)
        {
            new string[MAX_PLAYER_NAME + 32];
            format(string, sizeof(string), "[POLICE:] %s is no longer on duty.",GetPlayerNameEx(playerid));
            SendFactionTypeMessage(1, COLOR_POLICE, string);
        }
        print("Starting to save...");
        OnPlayerDataSave(playerid);
        print("Passed the save...");
        print("Destroying weed, DMV car and killing timers...");
        DestroyVehicle(DMVCar[playerid]);
        DestroyObject(PlantID[playerid]);
        KillTimer(WeedTimer[playerid]);
        KillTimer(DeathTimer[playerid]);
        print("KILLED");
        print("Resetting stats");
        print("Passed");
    }
    return 1;
}
OnPlayerDataSave
pawn Код:
public OnPlayerDataSave(playerid)
{
        print("Checking of player is logged in...");
        if(gPlayerLogged[playerid])
        {
            print("CHECK PASSED");
            print("Checking for money hacks...");
            if(GetPlayerCash(playerid) >= GetPlayerMoney(playerid))
            {
                PlayerInfo[playerid][pCash] = GetPlayerMoney(playerid);
            }
            else
            {
                new string[128];
                format(string, sizeof(string), "[WARNING:] [%s (Leaving)] Money Out: $%d; Should Have (Server-Side): $%d.",GetPlayerNameEx(playerid),playerid,GetPlayerMoney(playerid),GetPlayerCash(playerid));
                AdministratorMessage(COLOR_LIGHTRED, string,1);
                HackLog(string);
            }
            print("CHECK PASSED");
            print("Set the money");
            print("Checking if on duty...");
            if(CopOnDuty[playerid] == 0)
            {
                if(PlayerInfo[playerid][pRace] == 1)//Humans Saving Slots
                {
                    for(new slot = 0; slot != 12; slot++)
                    {
                        new wep, ammo;
                        GetPlayerWeaponData(playerid, slot, wep, ammo);
                        if(wep != 0 && ammo != 0)
                        {
                            if(PlayerInfo[playerid][pGun1] == 0 && (slot == 0 || slot == 1)) { PlayerInfo[playerid][pGun1] = wep; PlayerInfo[playerid][pAmmo1] = ammo; }
                            else if(PlayerInfo[playerid][pGun2] == 0 && slot == 2) { PlayerInfo[playerid][pGun2] = wep; PlayerInfo[playerid][pAmmo2] = ammo; }
                            else if(PlayerInfo[playerid][pGun3] == 0 && (slot == 3 || slot == 4 || slot == 5 || slot == 6)) { PlayerInfo[playerid][pGun3] = wep; PlayerInfo[playerid][pAmmo3] = ammo; }
                            else if(PlayerInfo[playerid][pGun4] == 0 && (slot == 1 || slot == 4 || slot == 5 || slot == 6)) { PlayerInfo[playerid][pGun4] = wep; PlayerInfo[playerid][pAmmo4] = ammo; }
                        }
                    }
                }
                else//Vampires Saving Slots
                {
                    for(new slot = 0; slot != 12; slot++)
                    {
                        new wep, ammo;
                        GetPlayerWeaponData(playerid, slot, wep, ammo);
                        if(wep != 0 && ammo != 0)
                        {
                            if(PlayerInfo[playerid][pGun1] == 0 && slot == 0) { PlayerInfo[playerid][pGun1] = wep; PlayerInfo[playerid][pAmmo1] = ammo; }
                            else if(PlayerInfo[playerid][pGun2] == 0 && slot == 1) { PlayerInfo[playerid][pGun2] = wep; PlayerInfo[playerid][pAmmo2] = ammo; }
                            else if(PlayerInfo[playerid][pGun3] == 0 && slot == 10) { PlayerInfo[playerid][pGun3] = wep; PlayerInfo[playerid][pAmmo3] = ammo; }
                        }
                    }
                }
            }
            print("Saved the weapons");
            new filestring[256];
            format(filestring, sizeof(filestring), "Accounts/%s.ini", PlayerName(playerid));
            new File: hFile = fopen(filestring, io_write);
            print("Starting to write in the file... checking if file exists.");
            if (hFile)
            {
                print("File exists...");
                new var[32];
                PlayerInfo[playerid][pCash] = GetPlayerCash(playerid);
                format(var, 32, "Key=%s\n", PlayerInfo[playerid][pKey]);fwrite(hFile, var);
                format(var, 32, "Level=%d\n",PlayerInfo[playerid][pLevel]);fwrite(hFile, var);
                format(var, 32, "AdminLevel=%d\n",PlayerInfo[playerid][pAdmin]);fwrite(hFile, var);
                format(var, 32, "GMLevel=%d\n",PlayerInfo[playerid][pGM]);fwrite(hFile, var);
                format(var, 32, "DonateRank=%d\n",PlayerInfo[playerid][pDonateRank]);fwrite(hFile, var);
                format(var, 32, "Registered=%d\n",PlayerInfo[playerid][pRegistered]);fwrite(hFile, var);
                format(var, 32, "Sex=%d\n",PlayerInfo[playerid][pSex]);fwrite(hFile, var);
                format(var, 32, "Race=%d\n",PlayerInfo[playerid][pRace]);fwrite(hFile, var);
                format(var, 32, "Experience=%d\n",PlayerInfo[playerid][pExp]);fwrite(hFile, var);
                format(var, 32, "Money=%d\n",PlayerInfo[playerid][pCash]);fwrite(hFile, var);
                format(var, 32, "Bank=%d\n",PlayerInfo[playerid][pBank]);fwrite(hFile, var);
                format(var, 32, "Skin=%i\n",PlayerInfo[playerid][pSkin]);fwrite(hFile, var);
                format(var, 32, "PlayingHours=%d\n",PlayerInfo[playerid][pPlayingHours]);fwrite(hFile, var);
                format(var, 32, "AllowedPayday=%d\n",PlayerInfo[playerid][pAllowedPayday]);fwrite(hFile, var);
                format(var, 32, "Insurance=%d\n",PlayerInfo[playerid][pInsurance]);fwrite(hFile, var);
                format(var, 32, "Faction=%d\n",PlayerInfo[playerid][pFaction]);fwrite(hFile, var);
                format(var, 32, "Rank=%d\n",PlayerInfo[playerid][pRank]);fwrite(hFile, var);
                format(var, 32, "HouseKey=%d\n",PlayerInfo[playerid][pHouseKey]);fwrite(hFile, var);
                format(var, 32, "BizKey=%d\n",PlayerInfo[playerid][pBizKey]);fwrite(hFile, var);
                format(var, 32, "SpawnPoint=%d\n",PlayerInfo[playerid][pSpawnPoint]);fwrite(hFile, var);
                format(var, 32, "PhoneNumber=%d\n",PlayerInfo[playerid][pPhoneNumber]);fwrite(hFile, var);
                format(var, 32, "PhoneC=%d\n",PlayerInfo[playerid][pPhoneC]);fwrite(hFile, var);
                format(var, 32, "PhoneBook=%d\n",PlayerInfo[playerid][pPhoneBook]);fwrite(hFile, var);
                format(var, 32, "ListNumber=%d\n",PlayerInfo[playerid][pListNumber]);fwrite(hFile, var);
                format(var, 32, "Donator=%d\n",PlayerInfo[playerid][pDonator]);fwrite(hFile, var);
                format(var, 32, "Job=%d\n",PlayerInfo[playerid][pJob]);fwrite(hFile, var);
                format(var, 32, "Ajailed=%d\n",PlayerInfo[playerid][pAjailed]);fwrite(hFile, var);
                format(var, 32, "JailTime=%d\n",PlayerInfo[playerid][pJailTime]);fwrite(hFile, var);
                format(var, 32, "Jailed=%d\n",PlayerInfo[playerid][pJailed]);fwrite(hFile, var);
                format(var, 32, "Wanted=%d\n",PlayerInfo[playerid][pWanted]);fwrite(hFile, var);
                format(var, 32, "WantedFor=%s\n",PlayerInfo[playerid][pWantedFor]);fwrite(hFile, var);
                format(var, 32, "DriverLicense=%d\n",PlayerInfo[playerid][pDriverLicense]);fwrite(hFile, var);
                format(var, 32, "WeaponLicense=%d\n",PlayerInfo[playerid][pWeaponLicense]);fwrite(hFile, var);
                format(var, 32, "CrashX=%.1f\n",PlayerInfo[playerid][pCrashX]);fwrite(hFile, var);
                format(var, 32, "CrashY=%.1f\n",PlayerInfo[playerid][pCrashY]);fwrite(hFile, var);
                format(var, 32, "CrashZ=%.1f\n",PlayerInfo[playerid][pCrashZ]);fwrite(hFile, var);
                GetPlayerHealth(playerid, PlayerInfo[playerid][pHealth]);
                if(PlayerInfo[playerid][pHealth] > 100) PlayerInfo[playerid][pHealth] = oldhp[playerid];
                format(var, 32, "Health=%f\n", PlayerInfo[playerid][pHealth]);fwrite(hFile, var);
                GetPlayerArmour(playerid, PlayerInfo[playerid][pArmour]);
                if(CopOnDuty[playerid] != 0) PlayerInfo[playerid][pArmour] = 0;
                format(var, 32, "Armour=%f\n", PlayerInfo[playerid][pArmour]);fwrite(hFile, var);
                format(var, 32, "Paycheck=%d\n",PlayerInfo[playerid][pPaycheck]);fwrite(hFile, var);
                format(var, 32, "CrashInt=%d\n",PlayerInfo[playerid][pCrashInt]);fwrite(hFile, var);
                format(var, 32, "CrashW=%d\n",PlayerInfo[playerid][pCrashW]);fwrite(hFile, var);
                format(var, 32, "Crashed=%d\n",PlayerInfo[playerid][pCrashed]);fwrite(hFile, var);
                format(var, 64, "Gun1=%d\n",PlayerInfo[playerid][pGun1]);fwrite(hFile, var);
                format(var, 64, "Gun2=%d\n",PlayerInfo[playerid][pGun2]);fwrite(hFile, var);
                format(var, 64, "Gun3=%d\n",PlayerInfo[playerid][pGun3]);fwrite(hFile, var);
                format(var, 64, "Gun4=%d\n",PlayerInfo[playerid][pGun4]);fwrite(hFile, var);
                format(var, 64, "Ammo1=%d\n",PlayerInfo[playerid][pAmmo1]);fwrite(hFile, var);
                format(var, 64, "Ammo2=%d\n",PlayerInfo[playerid][pAmmo2]);fwrite(hFile, var);
                format(var, 64, "Ammo3=%d\n",PlayerInfo[playerid][pAmmo3]);fwrite(hFile, var);
                format(var, 64, "Ammo4=%d\n",PlayerInfo[playerid][pAmmo4]);fwrite(hFile, var);
                format(var, 32, "LearningPoints=%d\n",PlayerInfo[playerid][pLearn]);fwrite(hFile, var);
                format(var, 32, "UniqueID=%d\n",PlayerInfo[playerid][pUniqueID]);fwrite(hFile, var);
                format(var, 64, "Seeds=%d\n",PlayerInfo[playerid][pSeeds]);fwrite(hFile, var);
                format(var, 64, "Weed=%d\n",PlayerInfo[playerid][pWeed]);fwrite(hFile, var);
                format(var, 32, "WeedX=%f\n",PlayerInfo[playerid][pWeedX]);fwrite(hFile, var);
                format(var, 32, "WeedY=%f\n",PlayerInfo[playerid][pWeedY]);fwrite(hFile, var);
                format(var, 32, "WeedZ=%f\n",PlayerInfo[playerid][pWeedZ]);fwrite(hFile, var);
                format(var, 32, "WeedR=%f\n",PlayerInfo[playerid][pWeedR]);fwrite(hFile, var);
                format(var, 64, "WeedTimeLeft=%d\n",PlayerInfo[playerid][pWeedTimeLeft]);fwrite(hFile, var);
                format(var, 32, "MaskID=%s\n",PlayerInfo[playerid][pMaskID]);fwrite(hFile, var);
                format(var, 32, "Veh1_Model=%d\n", PlayerInfo[playerid][pVeh1Model]); fwrite(hFile, var);
                format(var, 32, "Veh1_X=%f\n", PlayerInfo[playerid][pVeh1X]); fwrite(hFile, var);
                format(var, 32, "Veh1_Y=%f\n", PlayerInfo[playerid][pVeh1Y]); fwrite(hFile, var);
                format(var, 32, "Veh1_Z=%f\n", PlayerInfo[playerid][pVeh1Z]); fwrite(hFile, var);
                format(var, 32, "Veh1_Rot=%f\n", PlayerInfo[playerid][pVeh1Rotation]); fwrite(hFile, var);
                format(var, 32, "Veh1_Paintjob=%d\n", PlayerInfo[playerid][pVeh1PaintJob]); fwrite(hFile, var);
                format(var, 32, "Veh1_Color1=%d\n", PlayerInfo[playerid][pVeh1Color1]); fwrite(hFile, var);
                format(var, 32, "Veh1_Color2=%d\n", PlayerInfo[playerid][pVeh1Color2]); fwrite(hFile, var);
                format(var, 32, "Veh1_Fuel=%d\n", PlayerInfo[playerid][pVeh1Fuel]); fwrite(hFile, var);
                format(var, 32, "Veh1_Destroyed=%d\n", PlayerInfo[playerid][pVeh1Destroyed]); fwrite(hFile, var);
                format(var, 32, "Veh1_Mod1=%d\n", PlayerInfo[playerid][pVeh1Mod1]); fwrite(hFile, var);
                format(var, 32, "Veh1_Mod2=%d\n", PlayerInfo[playerid][pVeh1Mod2]); fwrite(hFile, var);
                format(var, 32, "Veh1_Mod3=%d\n", PlayerInfo[playerid][pVeh1Mod3]); fwrite(hFile, var);
                format(var, 32, "Veh1_Mod4=%d\n", PlayerInfo[playerid][pVeh1Mod4]); fwrite(hFile, var);
                format(var, 32, "Veh1_Mod5=%d\n", PlayerInfo[playerid][pVeh1Mod5]); fwrite(hFile, var);
                format(var, 32, "Veh1_Mod6=%d\n", PlayerInfo[playerid][pVeh1Mod6]); fwrite(hFile, var);
                format(var, 32, "Veh1_Mod7=%d\n", PlayerInfo[playerid][pVeh1Mod7]); fwrite(hFile, var);
                format(var, 32, "Veh1_Mod8=%d\n", PlayerInfo[playerid][pVeh1Mod8]); fwrite(hFile, var);
                format(var, 32, "Veh1_Mod9=%d\n", PlayerInfo[playerid][pVeh1Mod9]); fwrite(hFile, var);
                format(var, 32, "Veh1_Mod10=%d\n", PlayerInfo[playerid][pVeh1Mod10]); fwrite(hFile, var);
                format(var, 32, "Veh1_Mod11=%d\n", PlayerInfo[playerid][pVeh1Mod11]); fwrite(hFile, var);
                format(var, 32, "Veh1_Mod12=%d\n", PlayerInfo[playerid][pVeh1Mod12]); fwrite(hFile, var);
                format(var, 32, "Veh1_Mod13=%d\n", PlayerInfo[playerid][pVeh1Mod13]); fwrite(hFile, var);
                format(var, 32, "Veh1_Mod14=%d\n", PlayerInfo[playerid][pVeh1Mod14]); fwrite(hFile, var);
                format(var, 32, "Veh1_Mod15=%d\n", PlayerInfo[playerid][pVeh1Mod15]); fwrite(hFile, var);
                format(var, 32, "Veh1_Mod16=%d\n", PlayerInfo[playerid][pVeh1Mod16]); fwrite(hFile, var);
                format(var, 32, "Veh1_Mod17=%d\n", PlayerInfo[playerid][pVeh1Mod17]); fwrite(hFile, var);
                format(var, 32, "Veh1_Mod18=%d\n", PlayerInfo[playerid][pVeh1Mod18]); fwrite(hFile, var);
                format(var, 32, "Veh2_Model=%d\n", PlayerInfo[playerid][pVeh2Model]); fwrite(hFile, var);
                format(var, 32, "Veh2_X=%f\n", PlayerInfo[playerid][pVeh2X]); fwrite(hFile, var);
                format(var, 32, "Veh2_Y=%f\n", PlayerInfo[playerid][pVeh2Y]); fwrite(hFile, var);
                format(var, 32, "Veh2_Z=%f\n", PlayerInfo[playerid][pVeh2Z]); fwrite(hFile, var);
                format(var, 32, "Veh2_Rot=%d\n", PlayerInfo[playerid][pVeh2Rotation]); fwrite(hFile, var);
                format(var, 32, "Veh2_Paintjob=%d\n", PlayerInfo[playerid][pVeh2PaintJob]); fwrite(hFile, var);
                format(var, 32, "Veh2_Color1=%d\n", PlayerInfo[playerid][pVeh2Color1]); fwrite(hFile, var);
                format(var, 32, "Veh2_Color2=%d\n", PlayerInfo[playerid][pVeh2Color2]); fwrite(hFile, var);
                format(var, 32, "Veh2_Fuel=%d\n", PlayerInfo[playerid][pVeh2Fuel]); fwrite(hFile, var);
                format(var, 32, "Veh2_Destroyed=%d\n", PlayerInfo[playerid][pVeh2Destroyed]); fwrite(hFile, var);
                format(var, 32, "Veh2_Mod1=%d\n", PlayerInfo[playerid][pVeh2Mod1]); fwrite(hFile, var);
                format(var, 32, "Veh2_Mod2=%d\n", PlayerInfo[playerid][pVeh2Mod2]); fwrite(hFile, var);
                format(var, 32, "Veh2_Mod3=%d\n", PlayerInfo[playerid][pVeh2Mod3]); fwrite(hFile, var);
                format(var, 32, "Veh2_Mod4=%d\n", PlayerInfo[playerid][pVeh2Mod4]); fwrite(hFile, var);
                format(var, 32, "Veh2_Mod5=%d\n", PlayerInfo[playerid][pVeh2Mod5]); fwrite(hFile, var);
                format(var, 32, "Veh2_Mod6=%d\n", PlayerInfo[playerid][pVeh2Mod6]); fwrite(hFile, var);
                format(var, 32, "Veh2_Mod7=%d\n", PlayerInfo[playerid][pVeh2Mod7]); fwrite(hFile, var);
                format(var, 32, "Veh2_Mod8=%d\n", PlayerInfo[playerid][pVeh2Mod8]); fwrite(hFile, var);
                format(var, 32, "Veh2_Mod9=%d\n", PlayerInfo[playerid][pVeh2Mod9]); fwrite(hFile, var);
                format(var, 32, "Veh2_Mod10=%d\n", PlayerInfo[playerid][pVeh2Mod10]); fwrite(hFile, var);
                format(var, 32, "Veh2_Mod11=%d\n", PlayerInfo[playerid][pVeh2Mod11]); fwrite(hFile, var);
                format(var, 32, "Veh2_Mod12=%d\n", PlayerInfo[playerid][pVeh2Mod12]); fwrite(hFile, var);
                format(var, 32, "Veh2_Mod13=%d\n", PlayerInfo[playerid][pVeh2Mod13]); fwrite(hFile, var);
                format(var, 32, "Veh2_Mod14=%d\n", PlayerInfo[playerid][pVeh2Mod14]); fwrite(hFile, var);
                format(var, 32, "Veh2_Mod15=%d\n", PlayerInfo[playerid][pVeh2Mod15]); fwrite(hFile, var);
                format(var, 32, "Veh2_Mod16=%d\n", PlayerInfo[playerid][pVeh2Mod16]); fwrite(hFile, var);
                format(var, 32, "Veh2_Mod17=%d\n", PlayerInfo[playerid][pVeh2Mod17]); fwrite(hFile, var);
                format(var, 32, "Veh2_Mod18=%d\n", PlayerInfo[playerid][pVeh2Mod18]); fwrite(hFile, var);
                format(var, 32, "Veh3_Model=%d\n", PlayerInfo[playerid][pVeh3Model]); fwrite(hFile, var);
                format(var, 32, "Veh3_X=%f\n", PlayerInfo[playerid][pVeh3X]); fwrite(hFile, var);
                format(var, 32, "Veh3_Y=%f\n", PlayerInfo[playerid][pVeh3Y]); fwrite(hFile, var);
                format(var, 32, "Veh3_Z=%f\n", PlayerInfo[playerid][pVeh3Z]); fwrite(hFile, var);
                format(var, 32, "Veh3_Rot=%f\n", PlayerInfo[playerid][pVeh3Rotation]); fwrite(hFile, var);
                format(var, 32, "Veh3_Paintjob=%d\n", PlayerInfo[playerid][pVeh3PaintJob]); fwrite(hFile, var);
                format(var, 32, "Veh3_Color1=%d\n", PlayerInfo[playerid][pVeh3Color1]); fwrite(hFile, var);
                format(var, 32, "Veh3_Color2=%d\n", PlayerInfo[playerid][pVeh3Color2]); fwrite(hFile, var);
                format(var, 32, "Veh3_Fuel=%d\n", PlayerInfo[playerid][pVeh3Fuel]); fwrite(hFile, var);
                format(var, 32, "Veh3_Destroyed=%d\n", PlayerInfo[playerid][pVeh3Destroyed]); fwrite(hFile, var);
                format(var, 32, "Veh3_Mod1=%d\n", PlayerInfo[playerid][pVeh3Mod1]); fwrite(hFile, var);
                format(var, 32, "Veh3_Mod2=%d\n", PlayerInfo[playerid][pVeh3Mod2]); fwrite(hFile, var);
                format(var, 32, "Veh3_Mod3=%d\n", PlayerInfo[playerid][pVeh3Mod3]); fwrite(hFile, var);
                format(var, 32, "Veh3_Mod4=%d\n", PlayerInfo[playerid][pVeh3Mod4]); fwrite(hFile, var);
                format(var, 32, "Veh3_Mod5=%d\n", PlayerInfo[playerid][pVeh3Mod5]); fwrite(hFile, var);
                format(var, 32, "Veh3_Mod6=%d\n", PlayerInfo[playerid][pVeh3Mod6]); fwrite(hFile, var);
                format(var, 32, "Veh3_Mod7=%d\n", PlayerInfo[playerid][pVeh3Mod7]); fwrite(hFile, var);
                format(var, 32, "Veh3_Mod8=%d\n", PlayerInfo[playerid][pVeh3Mod8]); fwrite(hFile, var);
                format(var, 32, "Veh3_Mod9=%d\n", PlayerInfo[playerid][pVeh3Mod9]); fwrite(hFile, var);
                format(var, 32, "Veh3_Mod10=%d\n", PlayerInfo[playerid][pVeh3Mod10]); fwrite(hFile, var);
                format(var, 32, "Veh3_Mod11=%d\n", PlayerInfo[playerid][pVeh3Mod11]); fwrite(hFile, var);
                format(var, 32, "Veh3_Mod12=%d\n", PlayerInfo[playerid][pVeh3Mod12]); fwrite(hFile, var);
                format(var, 32, "Veh3_Mod13=%d\n", PlayerInfo[playerid][pVeh3Mod13]); fwrite(hFile, var);
                format(var, 32, "Veh3_Mod14=%d\n", PlayerInfo[playerid][pVeh3Mod14]); fwrite(hFile, var);
                format(var, 32, "Veh3_Mod15=%d\n", PlayerInfo[playerid][pVeh3Mod15]); fwrite(hFile, var);
                format(var, 32, "Veh3_Mod16=%d\n", PlayerInfo[playerid][pVeh3Mod16]); fwrite(hFile, var);
                format(var, 32, "Veh3_Mod17=%d\n", PlayerInfo[playerid][pVeh3Mod17]); fwrite(hFile, var);
                format(var, 32, "Veh3_Mod18=%d\n", PlayerInfo[playerid][pVeh3Mod18]); fwrite(hFile, var);
                format(var, 32, "Veh1License=%s\n",PlayerInfo[playerid][pVeh1License]);fwrite(hFile, var);
                format(var, 32, "Veh2License=%s\n",PlayerInfo[playerid][pVeh2License]);fwrite(hFile, var);
                format(var, 32, "Veh3License=%s\n",PlayerInfo[playerid][pVeh3License]);fwrite(hFile, var);
                format(var, 32, "Veh1Slot1=%d\n", PlayerInfo[playerid][pVeh1Slot1]); fwrite(hFile, var);
                format(var, 32, "Veh1Slot1a=%d\n", PlayerInfo[playerid][pVeh1Slot1a]); fwrite(hFile, var);
                format(var, 32, "Veh1Slot2=%f\n", PlayerInfo[playerid][pVeh1Slot2]); fwrite(hFile, var);
                format(var, 32, "Veh1Slot3=%d\n", PlayerInfo[playerid][pVeh1Slot3]); fwrite(hFile, var);
                format(var, 32, "Veh2Slot1=%d\n", PlayerInfo[playerid][pVeh2Slot1]); fwrite(hFile, var);
                format(var, 32, "Veh2Slot1a=%d\n", PlayerInfo[playerid][pVeh2Slot1a]); fwrite(hFile, var);
                format(var, 32, "Veh2Slot2=%f\n", PlayerInfo[playerid][pVeh2Slot2]); fwrite(hFile, var);
                format(var, 32, "Veh2Slot3=%d\n", PlayerInfo[playerid][pVeh2Slot3]); fwrite(hFile, var);
                format(var, 32, "Veh3Slot1=%d\n", PlayerInfo[playerid][pVeh3Slot1]); fwrite(hFile, var);
                format(var, 32, "Veh3Slot1a=%d\n", PlayerInfo[playerid][pVeh3Slot1a]); fwrite(hFile, var);
                format(var, 32, "Veh3Slot2=%f\n", PlayerInfo[playerid][pVeh3Slot2]); fwrite(hFile, var);
                format(var, 32, "Veh3Slot3=%d\n", PlayerInfo[playerid][pVeh3Slot3]); fwrite(hFile, var);
                format(var, 32, "Object1=%d\n", PlayerInfo[playerid][pObject1]); fwrite(hFile, var);
                format(var, 32, "Object2=%d\n", PlayerInfo[playerid][pObject2]); fwrite(hFile, var);
                format(var, 32, "Object3=%d\n", PlayerInfo[playerid][pObject3]); fwrite(hFile, var);
                format(var, 32, "Object4=%d\n", PlayerInfo[playerid][pObject4]); fwrite(hFile, var);
                format(var, 32, "Object5=%d\n", PlayerInfo[playerid][pObject5]); fwrite(hFile, var);
                print("Saved mutual variables, checking if donator...");
                if(PlayerInfo[playerid][pDonator] > 1)
                {
                    format(var, 32, "Mask=%d\n", PlayerInfo[playerid][pMask]); fwrite(hFile, var);
                }
                if(PlayerInfo[playerid][pDonator] < 1)
                {
                    format(var, 32, "Mask=%d\n", 0); fwrite(hFile, var);
                }
                print("Passed the donator check");
                print("Checking if player is human or vampire...");
                if(PlayerInfo[playerid][pRace] == 1)
                {
                    print("Saving human stats");
                    format(var, 32, "hColt45=%d\n",HumanSkill[playerid][hColt45]);fwrite(hFile, var);
                    format(var, 32, "hDesertEagle=%d\n",HumanSkill[playerid][hDesertEagle]);fwrite(hFile, var);
                    format(var, 32, "hSilencedPistol=%d\n",HumanSkill[playerid][hSilencedPistol]);fwrite(hFile, var);
                    format(var, 32, "hMicroUzi=%d\n",HumanSkill[playerid][hMicroUzi]);fwrite(hFile, var);
                    format(var, 32, "hMP5=%d\n",HumanSkill[playerid][hMP5]);fwrite(hFile, var);
                    format(var, 32, "hAK47=%d\n",HumanSkill[playerid][hAK47]);fwrite(hFile, var);
                    format(var, 32, "hM4=%d\n",HumanSkill[playerid][hM4]);fwrite(hFile, var);
                    format(var, 32, "hShotgun=%d\n",HumanSkill[playerid][hShotgun]);fwrite(hFile, var);
                    format(var, 32, "hSPAS12=%d\n",HumanSkill[playerid][hSPAS12]);fwrite(hFile, var);
                    format(var, 32, "hSniperRifle=%d\n",HumanSkill[playerid][hSniperRifle]);fwrite(hFile, var);
                }
                if(PlayerInfo[playerid][pRace] == 2)
                {
                    print("Saving vampire stats");
                    format(var, 32, "vJump=%d\n",VampireAbility[playerid][vJump]);fwrite(hFile, var);
                    format(var, 32, "vSpeed=%d\n",VampireAbility[playerid][vSpeed]);fwrite(hFile, var);
                    format(var, 32, "vSniff=%d\n",VampireAbility[playerid][vSniff]);fwrite(hFile, var);
                    format(var, 32, "vComb=%d\n",VampireAbility[playerid][vComb]);fwrite(hFile, var);
                    format(var, 32, "vBite=%d\n",VampireAbility[playerid][vBite]);fwrite(hFile, var);
                    format(var, 32, "vBloodPoints=%d\n",VampireAbility[playerid][vBloodPoints]);fwrite(hFile, var);
                    format(var, 32, "vBPMax=%d\n",VampireAbility[playerid][vBPMax]);fwrite(hFile, var);
                }
                print("File saved, closing it...");
                fclose(hFile);
                print("File closed");
            }
            print("Resetting weapons...");
            PlayerInfo[playerid][pGun1] = 0; PlayerInfo[playerid][pAmmo1] = 0;
            PlayerInfo[playerid][pGun2] = 0; PlayerInfo[playerid][pAmmo2] = 0;
            PlayerInfo[playerid][pGun3] = 0; PlayerInfo[playerid][pAmmo3] = 0;
            PlayerInfo[playerid][pGun4] = 0; PlayerInfo[playerid][pAmmo4] = 0;
            print("PASSED");
        }
        print("pre-return part");
        return 1;
    }
Basically, it gets stucked on this part:
pawn Код:
if (hFile)
Now I know that if the file path is wrong when loading stats, the server would crash, but it loads it. So there must be something with file writing part of the script.

EDIT: @Dodo9655
Thanks, I set it to MAX_PLAYER_NAME now.
Reply
#7

Shouldn't it be this:

pawn Код:
if(fexist(hFile))
{
I figured since there was fwrite, fclose and shit, I searched fexist and saw that those were included as-well. Figured this would make the most sense.
Reply
#8

Nah, still nothing happens. I figure that if "if(hFile)" works on OnPlayerLogin then it should work here as well. I changed it to what you said but still it skips the writing part :S

EDIT: It managed to print me the part "File exists", but stats haven't saved. I'll try modifying the code a bit and see what'll happen.
Reply
#9

Quote:
Originally Posted by Kindred
Посмотреть сообщение
Shouldn't it be this:

pawn Код:
if(fexist(hFile))
{
I figured since there was fwrite, fclose and shit, I searched fexist and saw that those were included as-well. Figured this would make the most sense.
He's checking if the file was opened successfully, rather than if it exists.

Let's see the file path and make sure it's valid:
pawn Код:
printf("Filepath: %s", filestring);
Add that under where the format sets the path and check the output.

Also, let's be clear, the last thing that prints is "Starting to write in the file... checking if file exists.", right? Nothing else within that statement gets printed?
Reply
#10

After I followed Kindred's suggestion, it printed out the next print() - "File exists". I added more print() commands to see does it start saving some variables.

EDIT: Still nothing

Код:
[23:21:33] Set the cash
[23:21:33] Created var
[23:21:33] File exists...
[23:21:33] Starting to write in the file... checking if file exists.
[23:21:33] Saved the weapons
[23:21:33] Checking if on duty...
[23:21:33] Set the money
[23:21:33] CHECK PASSED
[23:21:33] Checking for money hacks...
[23:21:33] CHECK PASSED
[23:21:33] Checking of player is logged in...
[23:21:33] Starting to save...
[23:21:33] Checking if on duty
[23:21:33] Vehicle check passed
[23:21:33] Checking for spawned personal vehicles...
[23:21:33] reason 1 passed
[23:21:33] Check passed, player is leaving...
[23:21:33] Checking disconnection reason...
[23:21:33] Checking if player is logged in...
[23:21:33] ==================================
[23:21:33] OnPlayerDisconnect Started
Updated OnPlayerDataSave()
pawn Код:
public OnPlayerDataSave(playerid)
{
        print("Checking of player is logged in...");
        if(gPlayerLogged[playerid])
        {
            print("CHECK PASSED");
            print("Checking for money hacks...");
            if(GetPlayerCash(playerid) >= GetPlayerMoney(playerid))
            {
                PlayerInfo[playerid][pCash] = GetPlayerMoney(playerid);
            }
            else
            {
                new string[128];
                format(string, sizeof(string), "[WARNING:] [%s (Leaving)] Money Out: $%d; Should Have (Server-Side): $%d.",GetPlayerNameEx(playerid),playerid,GetPlayerMoney(playerid),GetPlayerCash(playerid));
                AdministratorMessage(COLOR_LIGHTRED, string,1);
                HackLog(string);
            }
            print("CHECK PASSED");
            print("Set the money");
            print("Checking if on duty...");
            if(CopOnDuty[playerid] == 0)
            {
                if(PlayerInfo[playerid][pRace] == 1)//Humans Saving Slots
                {
                    for(new slot = 0; slot != 12; slot++)
                    {
                        new wep, ammo;
                        GetPlayerWeaponData(playerid, slot, wep, ammo);
                        if(wep != 0 && ammo != 0)
                        {
                            if(PlayerInfo[playerid][pGun1] == 0 && (slot == 0 || slot == 1)) { PlayerInfo[playerid][pGun1] = wep; PlayerInfo[playerid][pAmmo1] = ammo; }
                            else if(PlayerInfo[playerid][pGun2] == 0 && slot == 2) { PlayerInfo[playerid][pGun2] = wep; PlayerInfo[playerid][pAmmo2] = ammo; }
                            else if(PlayerInfo[playerid][pGun3] == 0 && (slot == 3 || slot == 4 || slot == 5 || slot == 6)) { PlayerInfo[playerid][pGun3] = wep; PlayerInfo[playerid][pAmmo3] = ammo; }
                            else if(PlayerInfo[playerid][pGun4] == 0 && (slot == 1 || slot == 4 || slot == 5 || slot == 6)) { PlayerInfo[playerid][pGun4] = wep; PlayerInfo[playerid][pAmmo4] = ammo; }
                        }
                    }
                }
                else//Vampires Saving Slots
                {
                    for(new slot = 0; slot != 12; slot++)
                    {
                        new wep, ammo;
                        GetPlayerWeaponData(playerid, slot, wep, ammo);
                        if(wep != 0 && ammo != 0)
                        {
                            if(PlayerInfo[playerid][pGun1] == 0 && slot == 0) { PlayerInfo[playerid][pGun1] = wep; PlayerInfo[playerid][pAmmo1] = ammo; }
                            else if(PlayerInfo[playerid][pGun2] == 0 && slot == 1) { PlayerInfo[playerid][pGun2] = wep; PlayerInfo[playerid][pAmmo2] = ammo; }
                            else if(PlayerInfo[playerid][pGun3] == 0 && slot == 10) { PlayerInfo[playerid][pGun3] = wep; PlayerInfo[playerid][pAmmo3] = ammo; }
                        }
                    }
                }
            }
            print("Saved the weapons");
            new filestring[256];
            format(filestring, sizeof(filestring), "Accounts/%s.ini", PlayerName(playerid));
            new File: hFile = fopen(filestring, io_write);
            print("Starting to write in the file... checking if file exists.");
            if (fexist(filestring))
            {
                print("File exists...");
                new var[32];
                print("Created var");
                PlayerInfo[playerid][pCash] = GetPlayerCash(playerid);
                print("Set the cash");
                format(var, 32, "Key=%s\n", PlayerInfo[playerid][pKey]);fwrite(hFile, var);
                print("Saved 1");
                format(var, 32, "Level=%d\n",PlayerInfo[playerid][pLevel]);fwrite(hFile, var);
                format(var, 32, "AdminLevel=%d\n",PlayerInfo[playerid][pAdmin]);fwrite(hFile, var);
                format(var, 32, "GMLevel=%d\n",PlayerInfo[playerid][pGM]);fwrite(hFile, var);
                format(var, 32, "DonateRank=%d\n",PlayerInfo[playerid][pDonateRank]);fwrite(hFile, var);
                format(var, 32, "Registered=%d\n",PlayerInfo[playerid][pRegistered]);fwrite(hFile, var);
                format(var, 32, "Sex=%d\n",PlayerInfo[playerid][pSex]);fwrite(hFile, var);
                format(var, 32, "Race=%d\n",PlayerInfo[playerid][pRace]);fwrite(hFile, var);
                format(var, 32, "Experience=%d\n",PlayerInfo[playerid][pExp]);fwrite(hFile, var);
                format(var, 32, "Money=%d\n",PlayerInfo[playerid][pCash]);fwrite(hFile, var);
                print("Saved 2");
                format(var, 32, "Bank=%d\n",PlayerInfo[playerid][pBank]);fwrite(hFile, var);
                format(var, 32, "Skin=%i\n",PlayerInfo[playerid][pSkin]);fwrite(hFile, var);
                format(var, 32, "PlayingHours=%d\n",PlayerInfo[playerid][pPlayingHours]);fwrite(hFile, var);
                format(var, 32, "AllowedPayday=%d\n",PlayerInfo[playerid][pAllowedPayday]);fwrite(hFile, var);
                format(var, 32, "Insurance=%d\n",PlayerInfo[playerid][pInsurance]);fwrite(hFile, var);
                format(var, 32, "Faction=%d\n",PlayerInfo[playerid][pFaction]);fwrite(hFile, var);
                format(var, 32, "Rank=%d\n",PlayerInfo[playerid][pRank]);fwrite(hFile, var);
                format(var, 32, "HouseKey=%d\n",PlayerInfo[playerid][pHouseKey]);fwrite(hFile, var);
                format(var, 32, "BizKey=%d\n",PlayerInfo[playerid][pBizKey]);fwrite(hFile, var);
                format(var, 32, "SpawnPoint=%d\n",PlayerInfo[playerid][pSpawnPoint]);fwrite(hFile, var);
                format(var, 32, "PhoneNumber=%d\n",PlayerInfo[playerid][pPhoneNumber]);fwrite(hFile, var);
                format(var, 32, "PhoneC=%d\n",PlayerInfo[playerid][pPhoneC]);fwrite(hFile, var);
                format(var, 32, "PhoneBook=%d\n",PlayerInfo[playerid][pPhoneBook]);fwrite(hFile, var);
                format(var, 32, "ListNumber=%d\n",PlayerInfo[playerid][pListNumber]);fwrite(hFile, var);
                format(var, 32, "Donator=%d\n",PlayerInfo[playerid][pDonator]);fwrite(hFile, var);
                format(var, 32, "Job=%d\n",PlayerInfo[playerid][pJob]);fwrite(hFile, var);
                format(var, 32, "Ajailed=%d\n",PlayerInfo[playerid][pAjailed]);fwrite(hFile, var);
                format(var, 32, "JailTime=%d\n",PlayerInfo[playerid][pJailTime]);fwrite(hFile, var);
                format(var, 32, "Jailed=%d\n",PlayerInfo[playerid][pJailed]);fwrite(hFile, var);
                format(var, 32, "Wanted=%d\n",PlayerInfo[playerid][pWanted]);fwrite(hFile, var);
                format(var, 32, "WantedFor=%s\n",PlayerInfo[playerid][pWantedFor]);fwrite(hFile, var);
                format(var, 32, "DriverLicense=%d\n",PlayerInfo[playerid][pDriverLicense]);fwrite(hFile, var);
                format(var, 32, "WeaponLicense=%d\n",PlayerInfo[playerid][pWeaponLicense]);fwrite(hFile, var);
                format(var, 32, "CrashX=%.1f\n",PlayerInfo[playerid][pCrashX]);fwrite(hFile, var);
                format(var, 32, "CrashY=%.1f\n",PlayerInfo[playerid][pCrashY]);fwrite(hFile, var);
                format(var, 32, "CrashZ=%.1f\n",PlayerInfo[playerid][pCrashZ]);fwrite(hFile, var);
                print("Saved 3");
                GetPlayerHealth(playerid, PlayerInfo[playerid][pHealth]);
                if(PlayerInfo[playerid][pHealth] > 100) PlayerInfo[playerid][pHealth] = oldhp[playerid];
                format(var, 32, "Health=%f\n", PlayerInfo[playerid][pHealth]);fwrite(hFile, var);
                GetPlayerArmour(playerid, PlayerInfo[playerid][pArmour]);
                if(CopOnDuty[playerid] != 0) PlayerInfo[playerid][pArmour] = 0;
                print("Saved 4");
                format(var, 32, "Armour=%f\n", PlayerInfo[playerid][pArmour]);fwrite(hFile, var);
                format(var, 32, "Paycheck=%d\n",PlayerInfo[playerid][pPaycheck]);fwrite(hFile, var);
                format(var, 32, "CrashInt=%d\n",PlayerInfo[playerid][pCrashInt]);fwrite(hFile, var);
                format(var, 32, "CrashW=%d\n",PlayerInfo[playerid][pCrashW]);fwrite(hFile, var);
                format(var, 32, "Crashed=%d\n",PlayerInfo[playerid][pCrashed]);fwrite(hFile, var);
                format(var, 64, "Gun1=%d\n",PlayerInfo[playerid][pGun1]);fwrite(hFile, var);
                format(var, 64, "Gun2=%d\n",PlayerInfo[playerid][pGun2]);fwrite(hFile, var);
                format(var, 64, "Gun3=%d\n",PlayerInfo[playerid][pGun3]);fwrite(hFile, var);
                format(var, 64, "Gun4=%d\n",PlayerInfo[playerid][pGun4]);fwrite(hFile, var);
                format(var, 64, "Ammo1=%d\n",PlayerInfo[playerid][pAmmo1]);fwrite(hFile, var);
                format(var, 64, "Ammo2=%d\n",PlayerInfo[playerid][pAmmo2]);fwrite(hFile, var);
                format(var, 64, "Ammo3=%d\n",PlayerInfo[playerid][pAmmo3]);fwrite(hFile, var);
                format(var, 64, "Ammo4=%d\n",PlayerInfo[playerid][pAmmo4]);fwrite(hFile, var);
                format(var, 32, "LearningPoints=%d\n",PlayerInfo[playerid][pLearn]);fwrite(hFile, var);
                format(var, 32, "UniqueID=%d\n",PlayerInfo[playerid][pUniqueID]);fwrite(hFile, var);
                format(var, 64, "Seeds=%d\n",PlayerInfo[playerid][pSeeds]);fwrite(hFile, var);
                format(var, 64, "Weed=%d\n",PlayerInfo[playerid][pWeed]);fwrite(hFile, var);
                format(var, 32, "WeedX=%f\n",PlayerInfo[playerid][pWeedX]);fwrite(hFile, var);
                format(var, 32, "WeedY=%f\n",PlayerInfo[playerid][pWeedY]);fwrite(hFile, var);
                format(var, 32, "WeedZ=%f\n",PlayerInfo[playerid][pWeedZ]);fwrite(hFile, var);
                format(var, 32, "WeedR=%f\n",PlayerInfo[playerid][pWeedR]);fwrite(hFile, var);
                format(var, 64, "WeedTimeLeft=%d\n",PlayerInfo[playerid][pWeedTimeLeft]);fwrite(hFile, var);
                format(var, 32, "MaskID=%s\n",PlayerInfo[playerid][pMaskID]);fwrite(hFile, var);
                format(var, 32, "Veh1_Model=%d\n", PlayerInfo[playerid][pVeh1Model]); fwrite(hFile, var);
                format(var, 32, "Veh1_X=%f\n", PlayerInfo[playerid][pVeh1X]); fwrite(hFile, var);
                format(var, 32, "Veh1_Y=%f\n", PlayerInfo[playerid][pVeh1Y]); fwrite(hFile, var);
                format(var, 32, "Veh1_Z=%f\n", PlayerInfo[playerid][pVeh1Z]); fwrite(hFile, var);
                format(var, 32, "Veh1_Rot=%f\n", PlayerInfo[playerid][pVeh1Rotation]); fwrite(hFile, var);
                format(var, 32, "Veh1_Paintjob=%d\n", PlayerInfo[playerid][pVeh1PaintJob]); fwrite(hFile, var);
                format(var, 32, "Veh1_Color1=%d\n", PlayerInfo[playerid][pVeh1Color1]); fwrite(hFile, var);
                format(var, 32, "Veh1_Color2=%d\n", PlayerInfo[playerid][pVeh1Color2]); fwrite(hFile, var);
                format(var, 32, "Veh1_Fuel=%d\n", PlayerInfo[playerid][pVeh1Fuel]); fwrite(hFile, var);
                format(var, 32, "Veh1_Destroyed=%d\n", PlayerInfo[playerid][pVeh1Destroyed]); fwrite(hFile, var);
                format(var, 32, "Veh1_Mod1=%d\n", PlayerInfo[playerid][pVeh1Mod1]); fwrite(hFile, var);
                format(var, 32, "Veh1_Mod2=%d\n", PlayerInfo[playerid][pVeh1Mod2]); fwrite(hFile, var);
                format(var, 32, "Veh1_Mod3=%d\n", PlayerInfo[playerid][pVeh1Mod3]); fwrite(hFile, var);
                format(var, 32, "Veh1_Mod4=%d\n", PlayerInfo[playerid][pVeh1Mod4]); fwrite(hFile, var);
                format(var, 32, "Veh1_Mod5=%d\n", PlayerInfo[playerid][pVeh1Mod5]); fwrite(hFile, var);
                format(var, 32, "Veh1_Mod6=%d\n", PlayerInfo[playerid][pVeh1Mod6]); fwrite(hFile, var);
                format(var, 32, "Veh1_Mod7=%d\n", PlayerInfo[playerid][pVeh1Mod7]); fwrite(hFile, var);
                format(var, 32, "Veh1_Mod8=%d\n", PlayerInfo[playerid][pVeh1Mod8]); fwrite(hFile, var);
                format(var, 32, "Veh1_Mod9=%d\n", PlayerInfo[playerid][pVeh1Mod9]); fwrite(hFile, var);
                format(var, 32, "Veh1_Mod10=%d\n", PlayerInfo[playerid][pVeh1Mod10]); fwrite(hFile, var);
                format(var, 32, "Veh1_Mod11=%d\n", PlayerInfo[playerid][pVeh1Mod11]); fwrite(hFile, var);
                format(var, 32, "Veh1_Mod12=%d\n", PlayerInfo[playerid][pVeh1Mod12]); fwrite(hFile, var);
                format(var, 32, "Veh1_Mod13=%d\n", PlayerInfo[playerid][pVeh1Mod13]); fwrite(hFile, var);
                format(var, 32, "Veh1_Mod14=%d\n", PlayerInfo[playerid][pVeh1Mod14]); fwrite(hFile, var);
                format(var, 32, "Veh1_Mod15=%d\n", PlayerInfo[playerid][pVeh1Mod15]); fwrite(hFile, var);
                format(var, 32, "Veh1_Mod16=%d\n", PlayerInfo[playerid][pVeh1Mod16]); fwrite(hFile, var);
                format(var, 32, "Veh1_Mod17=%d\n", PlayerInfo[playerid][pVeh1Mod17]); fwrite(hFile, var);
                format(var, 32, "Veh1_Mod18=%d\n", PlayerInfo[playerid][pVeh1Mod18]); fwrite(hFile, var);
                format(var, 32, "Veh2_Model=%d\n", PlayerInfo[playerid][pVeh2Model]); fwrite(hFile, var);
                format(var, 32, "Veh2_X=%f\n", PlayerInfo[playerid][pVeh2X]); fwrite(hFile, var);
                format(var, 32, "Veh2_Y=%f\n", PlayerInfo[playerid][pVeh2Y]); fwrite(hFile, var);
                format(var, 32, "Veh2_Z=%f\n", PlayerInfo[playerid][pVeh2Z]); fwrite(hFile, var);
                format(var, 32, "Veh2_Rot=%d\n", PlayerInfo[playerid][pVeh2Rotation]); fwrite(hFile, var);
                format(var, 32, "Veh2_Paintjob=%d\n", PlayerInfo[playerid][pVeh2PaintJob]); fwrite(hFile, var);
                format(var, 32, "Veh2_Color1=%d\n", PlayerInfo[playerid][pVeh2Color1]); fwrite(hFile, var);
                format(var, 32, "Veh2_Color2=%d\n", PlayerInfo[playerid][pVeh2Color2]); fwrite(hFile, var);
                format(var, 32, "Veh2_Fuel=%d\n", PlayerInfo[playerid][pVeh2Fuel]); fwrite(hFile, var);
                format(var, 32, "Veh2_Destroyed=%d\n", PlayerInfo[playerid][pVeh2Destroyed]); fwrite(hFile, var);
                format(var, 32, "Veh2_Mod1=%d\n", PlayerInfo[playerid][pVeh2Mod1]); fwrite(hFile, var);
                format(var, 32, "Veh2_Mod2=%d\n", PlayerInfo[playerid][pVeh2Mod2]); fwrite(hFile, var);
                format(var, 32, "Veh2_Mod3=%d\n", PlayerInfo[playerid][pVeh2Mod3]); fwrite(hFile, var);
                format(var, 32, "Veh2_Mod4=%d\n", PlayerInfo[playerid][pVeh2Mod4]); fwrite(hFile, var);
                format(var, 32, "Veh2_Mod5=%d\n", PlayerInfo[playerid][pVeh2Mod5]); fwrite(hFile, var);
                format(var, 32, "Veh2_Mod6=%d\n", PlayerInfo[playerid][pVeh2Mod6]); fwrite(hFile, var);
                format(var, 32, "Veh2_Mod7=%d\n", PlayerInfo[playerid][pVeh2Mod7]); fwrite(hFile, var);
                format(var, 32, "Veh2_Mod8=%d\n", PlayerInfo[playerid][pVeh2Mod8]); fwrite(hFile, var);
                format(var, 32, "Veh2_Mod9=%d\n", PlayerInfo[playerid][pVeh2Mod9]); fwrite(hFile, var);
                format(var, 32, "Veh2_Mod10=%d\n", PlayerInfo[playerid][pVeh2Mod10]); fwrite(hFile, var);
                format(var, 32, "Veh2_Mod11=%d\n", PlayerInfo[playerid][pVeh2Mod11]); fwrite(hFile, var);
                format(var, 32, "Veh2_Mod12=%d\n", PlayerInfo[playerid][pVeh2Mod12]); fwrite(hFile, var);
                format(var, 32, "Veh2_Mod13=%d\n", PlayerInfo[playerid][pVeh2Mod13]); fwrite(hFile, var);
                format(var, 32, "Veh2_Mod14=%d\n", PlayerInfo[playerid][pVeh2Mod14]); fwrite(hFile, var);
                format(var, 32, "Veh2_Mod15=%d\n", PlayerInfo[playerid][pVeh2Mod15]); fwrite(hFile, var);
                format(var, 32, "Veh2_Mod16=%d\n", PlayerInfo[playerid][pVeh2Mod16]); fwrite(hFile, var);
                format(var, 32, "Veh2_Mod17=%d\n", PlayerInfo[playerid][pVeh2Mod17]); fwrite(hFile, var);
                format(var, 32, "Veh2_Mod18=%d\n", PlayerInfo[playerid][pVeh2Mod18]); fwrite(hFile, var);
                format(var, 32, "Veh3_Model=%d\n", PlayerInfo[playerid][pVeh3Model]); fwrite(hFile, var);
                format(var, 32, "Veh3_X=%f\n", PlayerInfo[playerid][pVeh3X]); fwrite(hFile, var);
                format(var, 32, "Veh3_Y=%f\n", PlayerInfo[playerid][pVeh3Y]); fwrite(hFile, var);
                format(var, 32, "Veh3_Z=%f\n", PlayerInfo[playerid][pVeh3Z]); fwrite(hFile, var);
                format(var, 32, "Veh3_Rot=%f\n", PlayerInfo[playerid][pVeh3Rotation]); fwrite(hFile, var);
                format(var, 32, "Veh3_Paintjob=%d\n", PlayerInfo[playerid][pVeh3PaintJob]); fwrite(hFile, var);
                format(var, 32, "Veh3_Color1=%d\n", PlayerInfo[playerid][pVeh3Color1]); fwrite(hFile, var);
                format(var, 32, "Veh3_Color2=%d\n", PlayerInfo[playerid][pVeh3Color2]); fwrite(hFile, var);
                format(var, 32, "Veh3_Fuel=%d\n", PlayerInfo[playerid][pVeh3Fuel]); fwrite(hFile, var);
                format(var, 32, "Veh3_Destroyed=%d\n", PlayerInfo[playerid][pVeh3Destroyed]); fwrite(hFile, var);
                format(var, 32, "Veh3_Mod1=%d\n", PlayerInfo[playerid][pVeh3Mod1]); fwrite(hFile, var);
                format(var, 32, "Veh3_Mod2=%d\n", PlayerInfo[playerid][pVeh3Mod2]); fwrite(hFile, var);
                format(var, 32, "Veh3_Mod3=%d\n", PlayerInfo[playerid][pVeh3Mod3]); fwrite(hFile, var);
                format(var, 32, "Veh3_Mod4=%d\n", PlayerInfo[playerid][pVeh3Mod4]); fwrite(hFile, var);
                format(var, 32, "Veh3_Mod5=%d\n", PlayerInfo[playerid][pVeh3Mod5]); fwrite(hFile, var);
                format(var, 32, "Veh3_Mod6=%d\n", PlayerInfo[playerid][pVeh3Mod6]); fwrite(hFile, var);
                format(var, 32, "Veh3_Mod7=%d\n", PlayerInfo[playerid][pVeh3Mod7]); fwrite(hFile, var);
                format(var, 32, "Veh3_Mod8=%d\n", PlayerInfo[playerid][pVeh3Mod8]); fwrite(hFile, var);
                format(var, 32, "Veh3_Mod9=%d\n", PlayerInfo[playerid][pVeh3Mod9]); fwrite(hFile, var);
                format(var, 32, "Veh3_Mod10=%d\n", PlayerInfo[playerid][pVeh3Mod10]); fwrite(hFile, var);
                format(var, 32, "Veh3_Mod11=%d\n", PlayerInfo[playerid][pVeh3Mod11]); fwrite(hFile, var);
                format(var, 32, "Veh3_Mod12=%d\n", PlayerInfo[playerid][pVeh3Mod12]); fwrite(hFile, var);
                format(var, 32, "Veh3_Mod13=%d\n", PlayerInfo[playerid][pVeh3Mod13]); fwrite(hFile, var);
                format(var, 32, "Veh3_Mod14=%d\n", PlayerInfo[playerid][pVeh3Mod14]); fwrite(hFile, var);
                format(var, 32, "Veh3_Mod15=%d\n", PlayerInfo[playerid][pVeh3Mod15]); fwrite(hFile, var);
                format(var, 32, "Veh3_Mod16=%d\n", PlayerInfo[playerid][pVeh3Mod16]); fwrite(hFile, var);
                format(var, 32, "Veh3_Mod17=%d\n", PlayerInfo[playerid][pVeh3Mod17]); fwrite(hFile, var);
                format(var, 32, "Veh3_Mod18=%d\n", PlayerInfo[playerid][pVeh3Mod18]); fwrite(hFile, var);
                format(var, 32, "Veh1License=%s\n",PlayerInfo[playerid][pVeh1License]);fwrite(hFile, var);
                format(var, 32, "Veh2License=%s\n",PlayerInfo[playerid][pVeh2License]);fwrite(hFile, var);
                format(var, 32, "Veh3License=%s\n",PlayerInfo[playerid][pVeh3License]);fwrite(hFile, var);
                format(var, 32, "Veh1Slot1=%d\n", PlayerInfo[playerid][pVeh1Slot1]); fwrite(hFile, var);
                format(var, 32, "Veh1Slot1a=%d\n", PlayerInfo[playerid][pVeh1Slot1a]); fwrite(hFile, var);
                format(var, 32, "Veh1Slot2=%f\n", PlayerInfo[playerid][pVeh1Slot2]); fwrite(hFile, var);
                format(var, 32, "Veh1Slot3=%d\n", PlayerInfo[playerid][pVeh1Slot3]); fwrite(hFile, var);
                format(var, 32, "Veh2Slot1=%d\n", PlayerInfo[playerid][pVeh2Slot1]); fwrite(hFile, var);
                format(var, 32, "Veh2Slot1a=%d\n", PlayerInfo[playerid][pVeh2Slot1a]); fwrite(hFile, var);
                format(var, 32, "Veh2Slot2=%f\n", PlayerInfo[playerid][pVeh2Slot2]); fwrite(hFile, var);
                format(var, 32, "Veh2Slot3=%d\n", PlayerInfo[playerid][pVeh2Slot3]); fwrite(hFile, var);
                format(var, 32, "Veh3Slot1=%d\n", PlayerInfo[playerid][pVeh3Slot1]); fwrite(hFile, var);
                format(var, 32, "Veh3Slot1a=%d\n", PlayerInfo[playerid][pVeh3Slot1a]); fwrite(hFile, var);
                format(var, 32, "Veh3Slot2=%f\n", PlayerInfo[playerid][pVeh3Slot2]); fwrite(hFile, var);
                format(var, 32, "Veh3Slot3=%d\n", PlayerInfo[playerid][pVeh3Slot3]); fwrite(hFile, var);
                format(var, 32, "Object1=%d\n", PlayerInfo[playerid][pObject1]); fwrite(hFile, var);
                format(var, 32, "Object2=%d\n", PlayerInfo[playerid][pObject2]); fwrite(hFile, var);
                format(var, 32, "Object3=%d\n", PlayerInfo[playerid][pObject3]); fwrite(hFile, var);
                format(var, 32, "Object4=%d\n", PlayerInfo[playerid][pObject4]); fwrite(hFile, var);
                format(var, 32, "Object5=%d\n", PlayerInfo[playerid][pObject5]); fwrite(hFile, var);
                print("Saved mutual variables, checking if donator...");
                if(PlayerInfo[playerid][pDonator] > 1)
                {
                    format(var, 32, "Mask=%d\n", PlayerInfo[playerid][pMask]); fwrite(hFile, var);
                }
                if(PlayerInfo[playerid][pDonator] < 1)
                {
                    format(var, 32, "Mask=%d\n", 0); fwrite(hFile, var);
                }
                print("Passed the donator check");
                print("Checking if player is human or vampire...");
                if(PlayerInfo[playerid][pRace] == 1)
                {
                    print("Saving human stats");
                    format(var, 32, "hColt45=%d\n",HumanSkill[playerid][hColt45]);fwrite(hFile, var);
                    format(var, 32, "hDesertEagle=%d\n",HumanSkill[playerid][hDesertEagle]);fwrite(hFile, var);
                    format(var, 32, "hSilencedPistol=%d\n",HumanSkill[playerid][hSilencedPistol]);fwrite(hFile, var);
                    format(var, 32, "hMicroUzi=%d\n",HumanSkill[playerid][hMicroUzi]);fwrite(hFile, var);
                    format(var, 32, "hMP5=%d\n",HumanSkill[playerid][hMP5]);fwrite(hFile, var);
                    format(var, 32, "hAK47=%d\n",HumanSkill[playerid][hAK47]);fwrite(hFile, var);
                    format(var, 32, "hM4=%d\n",HumanSkill[playerid][hM4]);fwrite(hFile, var);
                    format(var, 32, "hShotgun=%d\n",HumanSkill[playerid][hShotgun]);fwrite(hFile, var);
                    format(var, 32, "hSPAS12=%d\n",HumanSkill[playerid][hSPAS12]);fwrite(hFile, var);
                    format(var, 32, "hSniperRifle=%d\n",HumanSkill[playerid][hSniperRifle]);fwrite(hFile, var);
                }
                if(PlayerInfo[playerid][pRace] == 2)
                {
                    print("Saving vampire stats");
                    format(var, 32, "vJump=%d\n",VampireAbility[playerid][vJump]);fwrite(hFile, var);
                    format(var, 32, "vSpeed=%d\n",VampireAbility[playerid][vSpeed]);fwrite(hFile, var);
                    format(var, 32, "vSniff=%d\n",VampireAbility[playerid][vSniff]);fwrite(hFile, var);
                    format(var, 32, "vComb=%d\n",VampireAbility[playerid][vComb]);fwrite(hFile, var);
                    format(var, 32, "vBite=%d\n",VampireAbility[playerid][vBite]);fwrite(hFile, var);
                    format(var, 32, "vBloodPoints=%d\n",VampireAbility[playerid][vBloodPoints]);fwrite(hFile, var);
                    format(var, 32, "vBPMax=%d\n",VampireAbility[playerid][vBPMax]);fwrite(hFile, var);
                }
                print("File saved, closing it...");
                fclose(hFile);
                print("File closed");
            }
            print("Resetting weapons...");
            PlayerInfo[playerid][pGun1] = 0; PlayerInfo[playerid][pAmmo1] = 0;
            PlayerInfo[playerid][pGun2] = 0; PlayerInfo[playerid][pAmmo2] = 0;
            PlayerInfo[playerid][pGun3] = 0; PlayerInfo[playerid][pAmmo3] = 0;
            PlayerInfo[playerid][pGun4] = 0; PlayerInfo[playerid][pAmmo4] = 0;
            print("PASSED");
        }
        print("pre-return part");
        return 1;
    }
So it stops on "Create var", it creates a variable and just stops there.

EDIT2: I ran this on my Windows PC and it saves correctly.

Код:
[23:24:46] OnPlayerDisconnect Started
[23:24:46] ==================================
[23:24:46] Checking if player is logged in...
[23:24:46] Checking disconnection reason...
[23:24:46] Check passed, player is leaving...
[23:24:46] reason 1 passed
[23:24:46] Checking for spawned personal vehicles...
[23:24:46] Vehicle check passed
[23:24:46] Checking if on duty
[23:24:46] Starting to save...
[23:24:46] Checking of player is logged in...
[23:24:46] CHECK PASSED
[23:24:46] Checking for money hacks...
[23:24:46] CHECK PASSED
[23:24:46] Set the money
[23:24:46] Checking if on duty...
[23:24:46] Saved the weapons
[23:24:46] Starting to write in the file... checking if file exists.
[23:24:46] Filepath: Accounts/Marcus_Keaton.ini
[23:24:46] File exists...
[23:24:46] Created var
[23:24:46] Set the cash
[23:24:46] Saved 1
[23:24:46] Saved 2
[23:24:46] Saved 3
[23:24:46] Saved 4
[23:24:46] Saved mutual variables, checking if donator...
[23:24:46] Passed the donator check
[23:24:46] Checking if player is human or vampire...
[23:24:46] Saving human stats
[23:24:46] File saved, closing it...
[23:24:46] File closed
[23:24:46] Resetting weapons...
[23:24:46] PASSED
[23:24:46] pre-return part
[23:24:46] Passed the save...
[23:24:46] Destroying weed, DMV car and killing timers...
[23:24:46] KILLED
[23:24:46] Resetting stats
[23:24:46] Passed
[23:24:46] [part] Marcus_Keaton has left the server (0:1)
EDIT 3: Seems like the server crashes after a user disconnects:

Код:
[23:29:39] Number of vehicle models: 26
[23:29:39] _________________________________________________________________________
[23:29:39] > Total Number of Characters: 1.044.433
[23:29:39] > Current Script Lines: 26824
[23:29:39] > Last Update: 19th July 2012
[23:29:39] > Developer: Gerira
[23:29:39] > Website: vhrp.infodiscussion.com
[23:29:39] > Map: Red County
[23:29:39] > Version: 1.0 RC1
[23:29:39] > Gamemode: CS:RP 1.2.3
[23:29:39] > Server Name: Creekside Roleplay
[23:29:39] > CS:RP 1.2.3 - Red County by Gerira loaded.
[23:29:39] _________________________________________________________________________
[23:29:39] [DYNAMIC FACTIONS:] Faction Name: Faction9, Type: 0, ID: 9
[23:29:39] [DYNAMIC FACTIONS:] Faction Name: Faction8, Type: 0, ID: 8
[23:29:39] [DYNAMIC FACTIONS:] Faction Name: Faction7, Type: 0, ID: 7
[23:29:39] [DYNAMIC FACTIONS:] Faction Name: Faction6, Type: 0, ID: 6
[23:29:39] [DYNAMIC FACTIONS:] Faction Name: Faction5, Type: 0, ID: 5
[23:29:39] [DYNAMIC FACTIONS:] Faction Name: Faction4, Type: 0, ID: 4
[23:29:39] [DYNAMIC FACTIONS:] Faction Name: The Sabbat, Type: 0, ID: 3
[23:29:39] [DYNAMIC FACTIONS:] Faction Name: Emergency Medical Services, Type: 3, ID: 2
[23:29:39] [DYNAMIC FACTIONS:] Faction Name: San Andreas State Police, Type: 1, ID: 1
[23:29:39] [DYNAMIC FACTIONS:] Faction Name: Federal Bureau of Investigation, Type: 2, ID: 0
[23:29:39] file "UniqueVisitorsCounter.txt" located, variable UniqueVisitorsCounter loaded (26 unique visitors)
[23:29:39] file "JoinCounter.txt" located, variable JoinCounter loaded (1163 visitors)

[23:29:39]   Loaded 0 filterscripts.
[23:29:39] ---------------
[23:29:39] Filterscripts
[23:29:39] 
[23:29:39] 
[23:29:39]  Loaded: samp.ban
[23:29:39] --------
[23:29:39] Ban list
[23:29:39] 

[23:29:39]  Loaded 3 plugins.
[23:29:39]   Loaded.

*** Streamer Plugin v2.6.1 by Incognito loaded ***

[23:29:39] 
[23:29:39]  Loading plugin: streamer.so
[23:29:39]   Loaded.

[23:29:39]  ===============================

[23:29:39]    0.3d-R2 500 Players "dnee"

[23:29:39]    © 2009 Alex "******" Cole

[23:29:39]       sscanf plugin loaded.     

[23:29:39]  ===============================

[23:29:39] 
[23:29:39]  Loading plugin: sscanf.so
[23:29:39]   Loaded.
[23:29:39]   crashdetect v4.5.1 is OK.
[23:29:39]  Loading plugin: crashdetect.so
[23:29:39] --------------
[23:29:39] Server Plugins
[23:29:39] 
[23:29:39] filterscripts = ""  (string)

v0.3e, ©2005-2012 SA-MP Team
----------------------
SA-MP Dedicated Server

----------
Loaded log file: "server_log.txt".
----------

[23:29:37] Set the cash
[23:29:37] Created var
[23:29:37] File exists...
[23:29:37] Filepath: Accounts/Marcus_Keaton.ini
[23:29:37] Starting to write in the file... checking if file exists.
[23:29:37] Saved the weapons
[23:29:37] Checking if on duty...
[23:29:37] Set the money
[23:29:37] CHECK PASSED
[23:29:37] Checking for money hacks...
[23:29:37] CHECK PASSED
[23:29:37] Checking of player is logged in...
[23:29:37] Starting to save...
[23:29:37] Checking if on duty
[23:29:37] Vehicle check passed
[23:29:37] Checking for spawned personal vehicles...
[23:29:37] reason 1 passed
[23:29:37] Check passed, player is leaving...
[23:29:37] Checking disconnection reason...
[23:29:37] Checking if player is logged in...
[23:29:37] ==================================
[23:29:37] OnPlayerDisconnect Started
[23:29:30] [join] Marcus_Keaton has joined the server
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)