need a bit help
#1

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?
pawn Код:
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
Reply
#2

Wait what? Let me see your table structure.
Reply
#3

I can't show you the table structure
Reply
#4

Quote:
Originally Posted by mineralo
Посмотреть сообщение
I can't show you the table structure
Then what did you expect , to help you wichout see your code
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)