Помогите пожалуйста! У меня при дисконнекте с сервера все отлично сохраняет, но если я выключу и включу мод то у меня сохранит только: Ник, ключ, лвл, а переменную тест, и деньги не сохраняет

PHP код:
#include <a_samp>
#include <a_mysql>
#include <streamer>
#include <zcmd>
#include <sscanf2>
#define mysql_host "localhost"
#define mysql_db "new"
#define mysql_user "root"
#define mysql_pass ""
#define COLOR_WHITE 0xFFFFFFAA
#include "../include/gl_common.inc"
#include <foreach>


new connectionHandle;
enum pInfo
{
    
Key[128],
    
Level[60],
    
Money,
    
Test
};
new 
PlayerInfo[MAX_PLAYERS][pInfo];

#define send(%0,%1) SendClientMessage(%0, -1, %1)

#if defined FILTERSCRIPT

public OnFilterScriptInit()
{
    return 
1;
}

public 
OnFilterScriptExit()
{
    return 
1;
}

#else

main()
{
}

#endif

public OnGameModeInit()
{
    
connectionHandle mysql_connect(mysql_hostmysql_usermysql_dbmysql_pass);
    if(
mysql_ping() != 1) print("MySQL ñîåäèíåíèå, false.");
    
SetGameModeText("Blank Script");
    
AddPlayerClass(01958.37831343.157215.3746269.1425000000);
    return 
1;
}

public 
OnGameModeExit()
{
    
SaveAccounts();
    
mysql_close(connectionHandle);
    return 
1;
}

public 
OnPlayerRequestClass(playeridclassid)
{
    
SetPlayerPos(playerid1958.37831343.157215.3746);
    
SetPlayerCameraPos(playerid1958.37831343.157215.3746);
    
SetPlayerCameraLookAt(playerid1958.37831343.157215.3746);
    return 
1;
}

public 
OnPlayerConnect(playerid)
{
    new 
str[128];
    
mysql_real_escape_string(Name(playerid), Name(playerid));
    
format(strsizeof(str),"SELECT `Name` FROM `Accounts` WHERE `Name` = '%s'"Name(playerid));
    
mysql_function_query(connectionHandlestrtrue"OnPlayerRegCheck","d"playerid);
    return 
1;
}

public 
OnPlayerDisconnect(playeridreason)
{
    
SaveKey(playerid);
    
SaveMoney(playerid);
    
SaveTest(playerid);
    return 
1;
}

public 
OnPlayerSpawn(playerid)
{
    if(!
GetPVarInt(playerid"Logged")) return true;
    return 
1;
}

public 
OnPlayerDeath(playeridkilleridreason)
{
    return 
1;
}

public 
OnVehicleSpawn(vehicleid)
{
    return 
1;
}

public 
OnVehicleDeath(vehicleidkillerid)
{
    return 
1;
}

public 
OnPlayerText(playeridtext[])
{
    if(!
GetPVarInt(playerid"Logged")) return true;
    return 
1;
}

public 
OnPlayerCommandText(playeridcmdtext[])
{
    if (
strcmp("/mycommand"cmdtexttrue10) == 0)
    {
        
// Do something here
        
return 1;
    }
    return 
0;
}

public 
OnPlayerEnterVehicle(playeridvehicleidispassenger)
{
    return 
1;
}

public 
OnPlayerExitVehicle(playeridvehicleid)
{
    return 
1;
}

public 
OnPlayerStateChange(playeridnewstateoldstate)
{
    return 
1;
}

public 
OnPlayerEnterCheckpoint(playerid)
{
    return 
1;
}

public 
OnPlayerLeaveCheckpoint(playerid)
{
    return 
1;
}

public 
OnPlayerEnterRaceCheckpoint(playerid)
{
    return 
1;
}

public 
OnPlayerLeaveRaceCheckpoint(playerid)
{
    return 
1;
}

public 
OnRconCommand(cmd[])
{
    return 
1;
}

public 
OnPlayerRequestSpawn(playerid)
{
    return 
1;
}

public 
OnObjectMoved(objectid)
{
    return 
1;
}

public 
OnPlayerObjectMoved(playeridobjectid)
{
    return 
1;
}

public 
OnPlayerPickUpPickup(playeridpickupid)
{
    return 
1;
}

public 
OnVehicleMod(playeridvehicleidcomponentid)
{
    return 
1;
}

public 
OnVehiclePaintjob(playeridvehicleidpaintjobid)
{
    return 
1;
}

public 
OnVehicleRespray(playeridvehicleidcolor1color2)
{
    return 
1;
}

public 
OnPlayerSelectedMenuRow(playeridrow)
{
    return 
1;
}

public 
OnPlayerExitedMenu(playerid)
{
    return 
1;
}

public 
OnPlayerInteriorChange(playeridnewinterioridoldinteriorid)
{
    return 
1;
}

public 
OnPlayerKeyStateChange(playeridnewkeysoldkeys)
{
    return 
1;
}

public 
OnRconLoginAttempt(ip[], password[], success)
{
    return 
1;
}

public 
OnPlayerUpdate(playerid)
{
    
SetMoney(playeridPlayerInfo[playerid][Money]);
    
SetPlayerScore(playeridPlayerInfo[playerid][Level]);
    return 
1;
}

public 
OnPlayerStreamIn(playeridforplayerid)
{
    return 
1;
}

public 
OnPlayerStreamOut(playeridforplayerid)
{
    return 
1;
}

public 
OnVehicleStreamIn(vehicleidforplayerid)
{
    return 
1;
}

public 
OnVehicleStreamOut(vehicleidforplayerid)
{
    return 
1;
}

public 
OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    switch(
dialogid)
    {
         case 
1:
        {
            if(!
strlen(inputtext))return ShowPlayerDialog(playerid,1,DIALOG_STYLE_INPUT,"Ðåãèñòðàöèÿ","____________________________________________\nÄîáðî ïîæàëîâàòü íà ñåðâåð!\nÂàø àêêàóíò íå çàðåãèñòðèðîâàí!\n\nÂâåäèòå ïàðîëü:\n____________________________________________","Äàëåå","Îòìåíà");
            
OnPlayerRegister(playerid,inputtext);
            return 
1;
        }
        case 
2:
        {
            if(!
strlen(inputtext))return ShowPlayerDialog(playerid,2,DIALOG_STYLE_PASSWORD,"Àâòîðèçàöèÿ","____________________________________________\nÇäðàâñòâóéòå!\n\nÂû çàðåãèñòðèðîâàíû!\nÂâåäèòå ïàðîëü:\n____________________________________________","Âõîä","Îòìåíà");
            
OnPlayerLogin(playerid,inputtext);
            return 
1;
        }
    }
    return 
1;
}

public 
OnPlayerClickPlayer(playeridclickedplayeridsource)
{
    return 
1;
}
stock Name(i) { new pl[24]; GetPlayerName(ipl24); return pl; }

forward OnPlayerRegCheck(playerid);
public 
OnPlayerRegCheck(playerid)
{
    if(
IsPlayerConnected(playerid))
    {
        new 
rowsfields;
        
cache_get_data(rowsfields);
        if(
rows)
            
ShowPlayerDialog(playerid,2,DIALOG_STYLE_PASSWORD,"Àâòîðèçàöèÿ","\n____________________________________________\nÇäðàâñòâóéòå!\n\nÂû çàðåãèñòðèðîâàíû!\nÂâåäèòå ïàðîëü:\n____________________________________________","Âõîä","Îòìåíà");
        else
            
ShowPlayerDialog(playerid,1,DIALOG_STYLE_INPUT,"Ðåãèñòðàöèÿ","____________________________________________\nÄîáðî ïîæàëîâàòü íà ñåðâåð!\nÂàø àêêàóíò íå çàðåãèñòðèðîâàí!\n\nÂâåäèòå ïàðîëü:\n____________________________________________","Äàëåå","Îòìåíà");
    }
    return 
1;
}

stock OnPlayerRegister(ppassword[])
{
    new 
str[128];
    
format(strsizeof(str), "INSERT INTO `accounts` (`Name`, `Key`) VALUES ('%s', '%s')"Name(p), password);
    
mysql_function_query(connectionHandlestrfalse"RegisterCallback","d"p);
    return 
1;
}

forward RegisterCallback(playerid);
public 
RegisterCallback(playerid)
{
    
send(playerid,"Ðåãèñòðàöèÿ ïðîøëà óñïåøíî!");
    
PlayerInfo[playerid][Level] = 1;
    
PlayerInfo[playerid][Money] = 0;
    
SetPVarInt(playerid,"Logged"1), SpawnPlayer(playerid);
    return 
1;
}

stock SaveKey(playerid)
{
    new 
src[128],query[256];
    
format(query,sizeof(query),"UPDATE 'accounts' SET ");
    
format(src,sizeof(src),"UPDATE `Accounts` SET `Key` = '%d'"PlayerInfo[playerid][Key]);
    
format(src,sizeof(src)," WHERE `Name`='%s'",Name(playerid));
    
strcat(query,src,sizeof(query));
    
mysql_query(src, -10connectionHandle);
    return 
true;
}
stock SaveLevel(p)
{
    if(
GetPVarInt(p,"Logged") > 0)
    {
        new 
str[128];
        
format(str,sizeof(str),"UPDATE `Accounts` SET `Level` = '%d'"PlayerInfo[p][Level]);
        
format(strsizeof(str),"%s WHERE `Name` = '%s'"strName(p));
        
mysql_query(str, -10connectionHandle);
    }
     return 
1;
}
stock SaveMoney(p)
{
    if(
GetPVarInt(p,"Logged") > 0)
    {
        new 
str[128];
        
format(str,sizeof(str),"UPDATE `Accounts` SET `Money` = '%d'"PlayerInfo[p][Money]);
        
format(strsizeof(str),"%s WHERE `Name` = '%s'"strName(p));
        
mysql_query(str, -10connectionHandle);
    }
     return 
1;
}
stock SaveTest(p)
{
    if(
GetPVarInt(p,"Logged") > 0)
    {
        new 
str[128];
        
format(str,sizeof(str),"UPDATE `Accounts` SET `Test` = '%d'"PlayerInfo[p][Test]);
        
format(strsizeof(str),"%s WHERE `Name` = '%s'"strName(p));
        
mysql_query(str, -10connectionHandle);
    }
     return 
1;
}
stock OnPlayerLogin(ipassword[])
{
    new 
str[128];
    
format(strsizeof(str),"SELECT * FROM `accounts` WHERE `Name` = '%s' AND `Key` = '%s'"Name(i), password);
    
mysql_function_query(connectionHandlestrtrue"LoginCallback","ds"ipassword);
    return 
1;
}

forward LoginCallback(ipassword[]);
public 
LoginCallback(ipassword[])
{
    new 
rowsfieldsstring[144], maximum[128];
    
cache_get_data(rowsfields);
    if(!
rows)
    {
              if(
GetPVarInt(i"wrongPass") == 2) return send(i,"Âû ââåëè 3 ðàçà íåâåðíûé ïàðîëü, ïîýòîìó áûëè êèêíóòû ñåðâåðîì."), Kick(i);
               
SetPVarInt(i"wrongPass"GetPVarInt(i"wrongPass")+1);
             
format(stringsizeof(string), "Íåâåðíûé ïàðîëü(îñòàëîñü %i/3)\nÂâåäèòå ïàðîëü:"GetPVarInt(i"wrongPass"));
              
ShowPlayerDialog(i2DIALOG_STYLE_PASSWORD"Àâòîðèçàöèÿ"string"Âõîä""Îòìåíà");
        return 
1;
    }
    
cache_get_field_content(0"Level"maximum), PlayerInfo[i][Level] = strval(maximum);
    
SetPVarInt(i"Logged"1);
    
send(i"Âû óñïåøíî àâòîðèçîâàëèñü!");
    
SpawnPlayer(i), SaveKey(i), SaveMoney(i), SaveTest(i);
    return 
1;
}
stock GiveMoney(playeridamount)
{
    
PlayerInfo[playerid][Money] += amount;
    
GivePlayerMoney(playeridamount);
}
//------------------------------------------------------------------------------
stock SetMoney(playeridamount)
{
    
PlayerInfo[playerid][Money] = amount;
    
ResetPlayerMoney(playerid);
    
GivePlayerMoney(playeridamount);
}
stock SaveAccounts()
{
    foreach(
Playeri)
    {
        if(!
IsPlayerConnected(i)) continue;
        
SaveKey(i);
        
SaveLevel(i);
        
SaveMoney(i);
        
SaveTest(i);
    }
    return 
1;
}
CMD:g(playeridparams[])
{
    if(
GetPVarInt(playerid"Logged") == 0) return 1;
    if(
sscanf(params"ud"params[0],params[1])) return SendClientMessage(playeridCOLOR_WHITE"Ââåäèòå: /givemoney [id èãðîêà] [êîë-âî äåíåã]");
    if(!
IsPlayerConnected(params[0])) return SendClientMessage(playeridCOLOR_WHITE"Èãðîê íå â ñåòè!");
    if(
params[1] > 10000000 || params[1] < 1) return SendClientMessage(playeridCOLOR_WHITE"Êîë-âî äåíåã îò 1 äî 10000000!");
    
GiveMoney(params[0], params[1]);
    return 
1;
}
CMD:b(playerid)
{
    
PlayerInfo[playerid][Test] ++;
    return 
true;