PDA

View Full Version : need a bit help


mineralo
02/10/2012, 12:27 PM
well, I'm started to work in mysql database and players have a lot stuff to save and to load, how to do more faster to load players' stuff?
forward onTHREAD_CompleteLoadPlayer(playerid);
public onTHREAD_CompleteLoadPlayer(playerid)
{
new temp[2][129];
new months,days,years,rows,fields,year,month,day;
cache_get_data(rows, fields);
for(new i = 0; i < rows; i++)
{
cache_get_row(i, 0, temp[0]);
cache_get_row(i, 1, temp[1]);
//this can be switched to something much faster
if(!strcmp(temp[0], "Score", true))
{
PlayerInfo[playerid][pScore] = strval(temp[1]);
}
else if(!strcmp(temp[0], "Admin", true))
{
PlayerInfo[playerid][pAdmin] = strval(temp[1]);
}
else if(!strcmp(temp[0], "Job", true))
{
PlayerInfo[playerid][pJob] = strval(temp[1]);
SetJob(playerid, PlayerInfo[playerid][pJob]);
}
else if(!strcmp(temp[0], "GCash", true))
{
PlayerInfo[playerid][pGCash] = strval(temp[1]);
}
else if(!strcmp(temp[0], "Kills", true))
{
PlayerInfo[playerid][pKills] = strval(temp[1]);
}
else if(!strcmp(temp[0], "Deaths", true))
{
PlayerInfo[playerid][pDeaths] = strval(temp[1]);
}
else if(!strcmp(temp[0], "health", true))
{
healthP[playerid] = strval(temp[1]);
}
else if(!strcmp(temp[0], "x", true))
{
PosX[playerid] = strval(temp[1]);
}
else if(!strcmp(temp[0], "y", true))
{
PosY[playerid] = strval(temp[1]);
}
else if(!strcmp(temp[0], "z", true))
{
PosZ[playerid] = strval(temp[1]);
}
else if(!strcmp(temp[0], "Interior", true))
{
Inter[playerid] = strval(temp[1]);
}
else if(!strcmp(temp[0], "Last_Log_Day", true))
{
days = strval(temp[1]);
}
else if(!strcmp(temp[0], "Last_Log_Month", true))
{
months = strval(temp[1]);
}
else if(!strcmp(temp[0], "Last_Log_Year", true))
{
years = strval(temp[1]);
}
}
LoadWeaponsFromDatabase(playerid);
Logged[playerid] = true;
return 1;
}
this is my loading system, I deleted from it to make it short

Vince
02/10/2012, 12:48 PM
Wait what? Let me see your table structure.

mineralo
02/10/2012, 01:53 PM
I can't show you the table structure

doreto
02/10/2012, 02:04 PM
I can't show you the table structure

Then what did you expect , to help you wichout see your code