Need help with faster loading.
#1

My current gamemode is mysql based, so whenever someone logins all the data needs to be transported from the DB to the server. Therefor I'm using the following thing.

Код:
pInfo[playerid][AdminLevel] = cache_get_field_content_int(0, "AdminLevel", Handle);
	pInfo[playerid][HelperLevel] = cache_get_field_content_int(0, "HelperLevel", Handle);
	pInfo[playerid][VIPLevel] = cache_get_field_content_int(0, "VIPLevel", Handle);
	pInfo[playerid][Money] = cache_get_field_content_int(0, "Money", Handle );//Extrag din baza de date banii. Banii sunt o variabila de tip integer, se extrag cu aceasta functie.
	pInfo[playerid][Bank] = cache_get_field_content_int(0, "Bank", Handle);
	pInfo[playerid][Pincode] = cache_get_field_content_int(0, "Pincode", Handle);
	pInfo[playerid][Score] = cache_get_field_content_int(0, "Score", Handle);
	pInfo[playerid][Skin] = cache_get_field_content_int(0, "Skin", Handle);
	pInfo[playerid][Gender] = cache_get_field_content_int(0, "Gender", Handle);
	pInfo[playerid][Age] = cache_get_field_content_int(0, "Age", Handle);
	cache_get_field_content( 0, "Email", pInfo[playerid][Email], Handle, 256 );
	cache_get_field_content( 0, "IP", pInfo [playerid] [IP], Handle, 20 );//Extrag din baza de date ip-ul. IP-ul este un string iar string-urile se extrag cu aceasta functie.
	pInfo[playerid][DrivingLic] = cache_get_field_content_int(0, "DrivingLic", Handle);
	pInfo[playerid][MotorLic] = cache_get_field_content_int(0, "MotorLic", Handle);
	pInfo[playerid][GunLic] = cache_get_field_content_int(0, "GunLic", Handle);
	pInfo[playerid][BoatLic] = cache_get_field_content_int(0, "BoatLic", Handle);
	pInfo[playerid][FishLic] = cache_get_field_content_int(0, "FishLic", Handle);
	pInfo[playerid][MatsLic] = cache_get_field_content_int(0, "MatsLic", Handle);
	pInfo[playerid][Banned] = cache_get_field_content_int(0, "Banned", Handle);
	cache_get_field_content( 0, "Banner", pInfo[playerid][Banner], Handle, 256 );
	cache_get_field_content( 0, "Reason", pInfo[playerid][Reason], Handle, 256 );
	pInfo[playerid][pMember] = cache_get_field_content_int(0, "pMember", Handle);
	pInfo[playerid][pLeader] = cache_get_field_content_int(0, "pLeader", Handle);
	pInfo[playerid][pRank] = cache_get_field_content_int(0, "pRank", Handle);
	pInfo[playerid][Kicks] = cache_get_field_content_int(0, "Kicks", Handle);
	pInfo[playerid][Bans] = cache_get_field_content_int(0, "Bans", Handle);
	pInfo[playerid][WantedLevel] = cache_get_field_content_int(0, "WantedLevel", Handle);
	pInfo[playerid][Drugs] = cache_get_field_content_int(0, "Drugs", Handle);
	pInfo[playerid][Materials] = cache_get_field_content_int(0, "Materials", Handle);
	pInfo[playerid][Job] = cache_get_field_content_int(0, "Job", Handle);
	pInfo[playerid][SkillTruck] = cache_get_field_content_int(0, "SkillTruck", Handle);
What can I do to reduce the loading time?
Reply
#2

Show the query you use for selecting player data.
Reply
#3

Quote:
Originally Posted by Abagail
Посмотреть сообщение
Show the query you use for selecting player data.
Код:
mysql_tquery(Handle, szQuery, "LoadPlayerData", "d", playerid);
here yo go.
Reply
#4

Anyone?
Reply
#5

Show the szQuery.
Reply
#6

Quote:
Originally Posted by Jacket
Посмотреть сообщение
Show the szQuery.
I assume you mean this one.

Код:
		new Cache: r;
		szQuery[0] = EOS;
		mysql_format(Handle, szQuery, 128, "SELECT * FROM `accounts` WHERE `Username` = '%e' LIMIT 1;", GetPName(playerid));
		r = mysql_query(Handle, szQuery);
Reply
#7

Do you load all columns when the player initially loads? If you don't - you can only select the columns you need by replacing "*" with

pawn Код:
`ColumnName`, `ColumnName`, `ColumnName`, `ColumnName`
Reply
#8

Quote:
Originally Posted by Abagail
Посмотреть сообщение
Do you load all columns when the player initially loads? If you don't - you can only select the columns you need by replacing "*" with

pawn Код:
`ColumnName`, `ColumnName`, `ColumnName`, `ColumnName`
Yea, I load all columns. But its slow because of this part.

Код:
pInfo[playerid][AdminLevel] = cache_get_field_content_int(0, "AdminLevel", Handle);
	pInfo[playerid][HelperLevel] = cache_get_field_content_int(0, "HelperLevel", Handle);
	pInfo[playerid][VIPLevel] = cache_get_field_content_int(0, "VIPLevel", Handle);
	pInfo[playerid][Money] = cache_get_field_content_int(0, "Money", Handle );//Extrag din baza de date banii. Banii sunt o variabila de tip integer, se extrag cu aceasta functie.
	pInfo[playerid][Bank] = cache_get_field_content_int(0, "Bank", Handle);
	pInfo[playerid][Pincode] = cache_get_field_content_int(0, "Pincode", Handle);
	pInfo[playerid][Score] = cache_get_field_content_int(0, "Score", Handle);
	pInfo[playerid][Skin] = cache_get_field_content_int(0, "Skin", Handle);
	pInfo[playerid][Gender] = cache_get_field_content_int(0, "Gender", Handle);
	pInfo[playerid][Age] = cache_get_field_content_int(0, "Age", Handle);
	cache_get_field_content( 0, "Email", pInfo[playerid][Email], Handle, 256 );
	cache_get_field_content( 0, "IP", pInfo [playerid] [IP], Handle, 20 );//Extrag din baza de date ip-ul. IP-ul este un string iar string-urile se extrag cu aceasta functie.
	pInfo[playerid][DrivingLic] = cache_get_field_content_int(0, "DrivingLic", Handle);
	pInfo[playerid][MotorLic] = cache_get_field_content_int(0, "MotorLic", Handle);
	pInfo[playerid][GunLic] = cache_get_field_content_int(0, "GunLic", Handle);
	pInfo[playerid][BoatLic] = cache_get_field_content_int(0, "BoatLic", Handle);
	pInfo[playerid][FishLic] = cache_get_field_content_int(0, "FishLic", Handle);
	pInfo[playerid][MatsLic] = cache_get_field_content_int(0, "MatsLic", Handle);
	pInfo[playerid][Banned] = cache_get_field_content_int(0, "Banned", Handle);
	cache_get_field_content( 0, "Banner", pInfo[playerid][Banner], Handle, 256 );
	cache_get_field_content( 0, "Reason", pInfo[playerid][Reason], Handle, 256 );
	pInfo[playerid][pMember] = cache_get_field_content_int(0, "pMember", Handle);
	pInfo[playerid][pLeader] = cache_get_field_content_int(0, "pLeader", Handle);
	pInfo[playerid][pRank] = cache_get_field_content_int(0, "pRank", Handle);
	pInfo[playerid][Kicks] = cache_get_field_content_int(0, "Kicks", Handle);
	pInfo[playerid][Bans] = cache_get_field_content_int(0, "Bans", Handle);
	pInfo[playerid][WantedLevel] = cache_get_field_content_int(0, "WantedLevel", Handle);
	pInfo[playerid][Drugs] = cache_get_field_content_int(0, "Drugs", Handle);
	pInfo[playerid][Materials] = cache_get_field_content_int(0, "Materials", Handle);
	pInfo[playerid][Job] = cache_get_field_content_int(0, "Job", Handle);
	pInfo[playerid][SkillTruck] = cache_get_field_content_int(0, "SkillTruck", Handle);
Is there a way to make this way simpler and faster?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)