Sometimes account not loading right on mysql?
#1

Ok so i'm having a huge player database.

The problem is:

In the last month i had some of this errors named ' losing connection during query '

I checked my disconnect and connect loading scripts and save scripts.

On disconnect the problem is that i excecuted a query for one variable, now i'm gonna execute a single query for all
variables.


But now the question is about the account load, what is wrong maybe here?

The probleme is after the 'OnAccountLoad' is send it takes a few seconds and after that is called SuccesfullyLoad(playerid) which spawn him.


So have a look:

Код:
if(!strcmp(MyHash, PlayerInfo[playerid][pKey]))
{
	mysql_format(mysql, query, sizeof(query), "SELECT * FROM `players` WHERE `Name` = '%s' LIMIT 1", GetName(playerid));
	mysql_tquery( mysql, query, "OnAccountLoad", "i", playerid);
}
Код:
public OnAccountLoad(playerid)
{
	PlayerInfo[playerid][pMysqlID] = cache_get_field_content_int(0, "id");
	PlayerInfo[playerid][pInactivitate] = 	cache_get_field_content_int(0, "Inactivitate");
	PlayerInfo[playerid][pLevel] = 	cache_get_field_content_int(0, "PlayerLevel");
	PlayerInfo[playerid][fActivity] = 	cache_get_field_content_int(0, "FactionActivity");
	PlayerInfo[playerid][pHelper] = cache_get_field_content_int(0, "HelperLevel");
	PlayerInfo[playerid][BanDays] = cache_get_field_content_int(0, "BanDays");
	PlayerInfo[playerid][Newbies] = cache_get_field_content_int(0, "Newbies");
	PlayerInfo[playerid][Reports] = cache_get_field_content_int(0, "Reports");
	PlayerInfo[playerid][ClanRank] = cache_get_field_content_int(0, "ClanRank");
	PlayerInfo[playerid][AdminJailed] = cache_get_field_content_int(0, "AdminJailed");
	PlayerInfo[playerid][Helps] = cache_get_field_content_int(0, "Helps");
	PlayerInfo[playerid][pAdmin] = cache_get_field_content_int(0, "AdminLevel");
	PlayerInfo[playerid][fPunish] = cache_get_field_content_int(0, "fPunish");
	PlayerInfo[playerid][SideJob] = cache_get_field_content_int(0, "SideJob");
	PlayerInfo[playerid][GiftWait] = cache_get_field_content_int(0, "GiftWait");
	PlayerInfo[playerid][DonateWait] = cache_get_field_content_int(0, "DonateWait");
	PlayerInfo[playerid][RobSkill] = cache_get_field_content_int(0, "RobSkill");
	PlayerInfo[playerid][Pin] = cache_get_field_content_int(0, "Pin");
	PlayerInfo[playerid][pWarn] = cache_get_field_content_int(0, "pWarn");
	PlayerInfo[playerid][JobBoost] = cache_get_field_content_int(0, "JobBoost");
	PlayerInfo[playerid][fWarn] = cache_get_field_content_int(0, "fWarn");
	PlayerInfo[playerid][pDice] = cache_get_field_content_int(0, "Dice");
	PlayerInfo[playerid][pCars] = cache_get_field_content_int(0, "SloturiVehicule");
	PlayerInfo[playerid][sWarns] = cache_get_field_content_int(0, "sWarns");
	PlayerInfo[playerid][pClan] = cache_get_field_content_int(0, "Clan");
	PlayerInfo[playerid][pRob] = cache_get_field_content_int(0, "pRob");
	PlayerInfo[playerid][pJobSkillL][1] = cache_get_field_content_int(0, "Skill1");
	PlayerInfo[playerid][pJobSkillA][1] = cache_get_field_content_int(0,"SkillA1");
	PlayerInfo[playerid][pJobSkillN][1] = cache_get_field_content_int(0, "SkillN1");
	PlayerInfo[playerid][pJobSkillL][2] = cache_get_field_content_int(0, "Skill2");
	PlayerInfo[playerid][pJobSkillA][2] = cache_get_field_content_int(0,"SkillA2");
	PlayerInfo[playerid][pJobSkillN][2] = cache_get_field_content_int(0, "SkillN2");
	PlayerInfo[playerid][pJobSkillL][3] = cache_get_field_content_int(0, "Skill3");
	PlayerInfo[playerid][pJobSkillA][3] = cache_get_field_content_int(0,"SkillA3");
	PlayerInfo[playerid][pJobSkillN][3] = cache_get_field_content_int(0, "SkillN3");
	PlayerInfo[playerid][pJobSkillL][4] = cache_get_field_content_int(0, "Skill4");
	PlayerInfo[playerid][pJobSkillA][4] = cache_get_field_content_int(0,"SkillA4");
	PlayerInfo[playerid][pJobSkillN][4] = cache_get_field_content_int(0, "SkillN4");
	PlayerInfo[playerid][pJobSkillL][5] = cache_get_field_content_int(0, "Skill5");
	PlayerInfo[playerid][pJobSkillA][5] = cache_get_field_content_int(0,"SkillA5");
	PlayerInfo[playerid][pJobSkillN][5] = cache_get_field_content_int(0, "SkillN5");
	PlayerInfo[playerid][pJobSkillL][6] = cache_get_field_content_int(0, "Skill6");
	PlayerInfo[playerid][pJobSkillA][6] = cache_get_field_content_int(0,"SkillA6");
	PlayerInfo[playerid][pJobSkillN][6] = cache_get_field_content_int(0, "SkillN6");
	PlayerInfo[playerid][pJobSkillL][7] = cache_get_field_content_int(0, "Skill7");
	PlayerInfo[playerid][pJobSkillA][7] = cache_get_field_content_int(0,"SkillA7");
	PlayerInfo[playerid][pJobSkillN][7] = cache_get_field_content_int(0, "SkillN7");
	PlayerInfo[playerid][pJobSkillL][8] = cache_get_field_content_int(0, "Skill8");
	PlayerInfo[playerid][pJobSkillA][8] = cache_get_field_content_int(0,"SkillA8");
	PlayerInfo[playerid][pJobSkillN][8] = cache_get_field_content_int(0, "SkillN8");
	PlayerInfo[playerid][pJobSkillL][9] = cache_get_field_content_int(0, "Skill9");
	PlayerInfo[playerid][pJobSkillA][9] = cache_get_field_content_int(0,"SkillA9");
	PlayerInfo[playerid][pJobSkillN][9] = cache_get_field_content_int(0, "SkillN9");
	PlayerInfo[playerid][pJobSkillL][10] = cache_get_field_content_int(0, "Skill10");
	PlayerInfo[playerid][pJobSkillA][10] = cache_get_field_content_int(0,"SkillA10");
	PlayerInfo[playerid][pJobSkillN][10] = cache_get_field_content_int(0, "SkillN10");

	for(new i = 1; i < 20; i++)
	{
	new stringul1[50];
	format(stringul1,50,"pInvType%d",i);
	new stringul2[50];
	format(stringul2,50,"pInvCant%d",i);
	PlayerInfo[playerid][pInvType][i] = cache_get_field_content_int(0,stringul1);
	PlayerInfo[playerid][pInvCant][i] = cache_get_field_content_int(0,stringul2);
	}
	//Personal #1
	PlayerInfo[playerid][pVehicle1] = cache_get_field_content_int(0, "pVehicle1");
	PlayerInfo[playerid][pVehicle1Model] = cache_get_field_content_int(0, "pVehicle1Model");
	PlayerInfo[playerid][pVehicle1Color1] = cache_get_field_content_int(0, "pVehicle1Color1");
	PlayerInfo[playerid][pVehicle1Color2] = cache_get_field_content_int(0, "pVehicle1Color2");
	PlayerInfo[playerid][pVehicle1Value] = cache_get_field_content_int(0, "pVehicle1Value");
	PlayerInfo[playerid][pVehicle1Lock] = cache_get_field_content_int(0, "pVehicle1Lock");
	PlayerInfo[playerid][pVehicle1X] = cache_get_field_content_float(0, "pVehicle1X");
	PlayerInfo[playerid][pVehicle1Y] = cache_get_field_content_float(0, "pVehicle1Y");
	PlayerInfo[playerid][pVehicle1Z] = cache_get_field_content_float(0, "pVehicle1Z");
	PlayerInfo[playerid][pVehicle1C] = cache_get_field_content_float(0, "pVehicle1C");
	cache_get_field_content( 0, "pVehicle1Plate", PlayerInfo[playerid][pVehicle1Plate], mysql, 80 );
	//
	//Personal #2
	PlayerInfo[playerid][pVehicle2] = cache_get_field_content_int(0, "pVehicle2");
	PlayerInfo[playerid][pVehicle2Model] = cache_get_field_content_int(0, "pVehicle2Model");
	PlayerInfo[playerid][pVehicle2Color1] = cache_get_field_content_int(0, "pVehicle2Color1");
	PlayerInfo[playerid][pVehicle2Color2] = cache_get_field_content_int(0, "pVehicle2Color2");
	PlayerInfo[playerid][pVehicle2Value] = cache_get_field_content_int(0, "pVehicle2Value");
	PlayerInfo[playerid][pVehicle2Lock] = cache_get_field_content_int(0, "pVehicle2Lock");
	PlayerInfo[playerid][pVehicle2X] = cache_get_field_content_float(0, "pVehicle2X");
	PlayerInfo[playerid][pVehicle2Y] = cache_get_field_content_float(0, "pVehicle2Y");
	PlayerInfo[playerid][pVehicle2Z] = cache_get_field_content_float(0, "pVehicle2Z");
	PlayerInfo[playerid][pVehicle2C] = cache_get_field_content_float(0, "pVehicle2C");
	PlayerInfo[playerid][pOdometer1] = cache_get_field_content_float(0, "pOdometer1");
	PlayerInfo[playerid][pOdometer2] = cache_get_field_content_float(0, "pOdometer2");
	PlayerInfo[playerid][pOdometer3] = cache_get_field_content_float(0, "pOdometer3");
	cache_get_field_content( 0, "pVehicle2Plate", PlayerInfo[playerid][pVehicle2Plate], mysql, 80 );
	//
	//Personal #3
	PlayerInfo[playerid][pVehicle3] = cache_get_field_content_int(0, "pVehicle3");
	PlayerInfo[playerid][pVehicle3Model] = cache_get_field_content_int(0, "pVehicle3Model");
	PlayerInfo[playerid][pVehicle3Color1] = cache_get_field_content_int(0, "pVehicle3Color1");
	PlayerInfo[playerid][pVehicle3Color2] = cache_get_field_content_int(0, "pVehicle3Color2");
	PlayerInfo[playerid][pVehicle3Value] = cache_get_field_content_int(0, "pVehicle3Value");
	PlayerInfo[playerid][pVehicle3Lock] = cache_get_field_content_int(0, "pVehicle3Lock");
	PlayerInfo[playerid][pVehicle3X] = cache_get_field_content_float(0, "pVehicle3X");
	PlayerInfo[playerid][pVehicle3Y] = cache_get_field_content_float(0, "pVehicle3Y");
	PlayerInfo[playerid][pVehicle3Z] = cache_get_field_content_float(0, "pVehicle3Z");
	PlayerInfo[playerid][pVehicle3C] = cache_get_field_content_float(0, "pVehicle3C");
	cache_get_field_content( 0, "pVehicle3Plate", PlayerInfo[playerid][pVehicle3Plate], mysql, 80 );
	PlayerInfo[playerid][pRob] = cache_get_field_content_int(0, "pRob");
	PlayerInfo[playerid][pDonateRank] = cache_get_field_content_int(0, "DonateRank");
	PlayerInfo[playerid][fHours] = cache_get_field_content_int(0, "FactionDays");
	PlayerInfo[playerid][pConnectTimeOre] = cache_get_field_content_int(0, "ConnectedTimeOre");
	PlayerInfo[playerid][pConnectTimeMinute] = cache_get_field_content_int(0, "ConnectedTimeMinute");
	PlayerInfo[playerid][pConnectTimeAFK] = cache_get_field_content_int(0, "ConnectedTimeAFK");
	PlayerInfo[playerid][pConnectTimeActive] = cache_get_field_content_int(0, "ConnectedTimeActive");
	PlayerInfo[playerid][pConnectTimeW] = cache_get_field_content_int(0, "ConnectedTimeW");
	PlayerInfo[playerid][pReg] = cache_get_field_content_int(0, "Registered");
	PlayerInfo[playerid][pSex] = cache_get_field_content_int(0, "Sex");
	PlayerInfo[playerid][pAge] = cache_get_field_content_int(0, "Age");
	PlayerInfo[playerid][IsConnected] = cache_get_field_content_int(0, "IsConnected");
	PlayerInfo[playerid][pMuted] = cache_get_field_content_int(0, "Muted");
	PlayerInfo[playerid][pMuteTime] = cache_get_field_content_int(0, "MuteTime");
	PlayerInfo[playerid][pExp] = cache_get_field_content_int(0, "Respect");
	PlayerInfo[playerid][pWanted] = cache_get_field_content_int(0, "Wanted");
	PlayerInfo[playerid][pCash] = cache_get_field_content_int(0, "Money");
	PlayerInfo[playerid][pAccount] = cache_get_field_content_int(0, "Bank");
	PlayerInfo[playerid][pCrimes] = cache_get_field_content_int(0, "Crimes");
	PlayerInfo[playerid][pPsbiskey] = cache_get_field_content_int(0, "pPsbiskey");
	PlayerInfo[playerid][pPhoneBook] = cache_get_field_content_int(0, "PhoneBook");
	PlayerInfo[playerid][gPoints] = cache_get_field_content_int(0, "gPoints");

	cache_get_field_content( 0, "RegisterDate", PlayerInfo[playerid][pRegisterDate], mysql, 80 );
	cache_get_field_content( 0, "LastOnline", PlayerInfo[playerid][pLastOnline], mysql, 80 );
	cache_get_field_content( 0, "IP", PlayerInfo[playerid][pIP], mysql, 80 );
	cache_get_field_content( 0, "Name", PlayerInfo[playerid][pName], mysql, 80 );
	cache_get_field_content( 0, "Masini", PlayerInfo[playerid][phGuard], mysql, 80 );
	cache_get_field_content( 0, "ClanName", PlayerInfo[playerid][ClanName], mysql, 80 );


	PlayerInfo[playerid][pJob] = cache_get_field_content_int(0, "Job");
	PlayerInfo[playerid][pHeadValue] = cache_get_field_content_int(0, "HeadValue");
	PlayerInfo[playerid][pJailed] = cache_get_field_content_int(0, "Jailed");
	PlayerInfo[playerid][pJailTime] = cache_get_field_content_int(0, "JailTime");
	PlayerInfo[playerid][pDrugs] = cache_get_field_content_int(0, "Drugs");
	PlayerInfo[playerid][pLeader] = cache_get_field_content_int(0, "Leader");

	PlayerInfo[playerid][pRank] = cache_get_field_content_int(0, "Rank");
	PlayerInfo[playerid][pChar] = cache_get_field_content_int(0, "Chara");
	cache_get_field_content( 0, "pLockedReason", PlayerInfo[playerid][pLockedReason], mysql, 80 );
	cache_get_field_content( 0, "pLockedBy", PlayerInfo[playerid][pLockedBy], mysql, 80 );
	PlayerInfo[playerid][pModel] = cache_get_field_content_int(0, "Model");
	PlayerInfo[playerid][pPnumber] = cache_get_field_content_int(0, "PhoneNr");
	PlayerInfo[playerid][pPhousekey] = cache_get_field_content_int(0, "House");
	//
	PlayerInfo[playerid][pPbiskey] = cache_get_field_content_int(0, "Bizz");
	PlayerInfo[playerid][pCarLic] = cache_get_field_content_int(0, "CarLic");
	PlayerInfo[playerid][pFlyLic] = cache_get_field_content_int(0, "FlyLic");
	PlayerInfo[playerid][pBoatLic] = cache_get_field_content_int(0, "BoatLic");
	PlayerInfo[playerid][pGunLic] = cache_get_field_content_int(0, "GunLic");
	PlayerInfo[playerid][pTut] = cache_get_field_content_int(0, "Tutorial");
	//GP SHOP
	PlayerInfo[playerid][pLighter] = cache_get_field_content_int(0, "pLighter");
	PlayerInfo[playerid][pCigarettes] = cache_get_field_content_int(0, "Cigarettes");
	PlayerInfo[playerid][pLocked] = cache_get_field_content_int(0, "pBan");
	PlayerInfo[playerid][pMark][0] = cache_get_field_content_float(0, "pMarkX");
	PlayerInfo[playerid][pMark][1] = cache_get_field_content_float(0, "pMarkY");
	PlayerInfo[playerid][pMark][2] = cache_get_field_content_float(0, "pMarkZ");
	//LastPos
	PlayerInfo[playerid][LastPos][0] = cache_get_field_content_float(0, "LastPosX");
	PlayerInfo[playerid][LastPos][1] = cache_get_field_content_float(0, "LastPosY");
	PlayerInfo[playerid][LastPos][2] = cache_get_field_content_float(0, "LastPosZ");
	//Hainele
	PlayerInfo[playerid][pHead] = cache_get_field_content_int(0, "Head");
	PlayerInfo[playerid][pFace] = cache_get_field_content_int(0, "Face");
	PlayerInfo[playerid][pBody] = cache_get_field_content_int(0, "Body");
	PlayerInfo[playerid][pMember] = cache_get_field_content_int(0, "Member");

	SuccesfullyLoad(playerid);
	return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)