Problem with Character Data not loading....
#1

For some reasons when retrieving the characters data the values are not being stored correctly. (EG. http://prntscr.com/36hfgl), i thought it might have been the factions not loading correctly but i tested both that and the character data loading and found that Characater Data loading was the problem. (Name loads fine, Position loads fine, ect.)

MySQL Structure: http://prntscr.com/36hgbs
Data View: http://prntscr.com/36hhag
pawn Код:
public LoadCharacterData(playerid)
{
    new fields, rows, fetch[256];
    cache_get_data(rows, fields, MySQL_Connection);

    print("Loading Data");
    if(rows !=0)
    {
        for(new i = 0; i < rows; i++)
        {
            print("Loading Character Stats");
            cache_get_field_content(i, "CharacterID", fetch, MySQL_Connection);
            CharacterInfo[playerid][CharacterID] = strval(fetch);
            cache_get_field_content(i, "CharacterName", fetch, MySQL_Connection);
            format(CharacterInfo[playerid][cCharacterName], MAX_PLAYER_NAME, "%s", fetch);
            printf("Character Name: %s", CharacterInfo[playerid][cCharacterName]);
            cache_get_field_content(i, "cPassword", fetch, MySQL_Connection);
            format(CharacterInfo[playerid][cPassword], 126, "%s", fetch);

            cache_get_field_content(i, "cStaffName", fetch, MySQL_Connection);
            format(CharacterInfo[playerid][cStaffName], 25, "%s", fetch);
            printf("Staff Level: %d", fetch);
            cache_get_field_content(i, "cStaffLevel", fetch, MySQL_Connection);
            CharacterInfo[playerid][cStaffLevel] = fetch;
           
            cache_get_field_content(i, "cHelperLevel", fetch, MySQL_Connection);
            CharacterInfo[playerid][cHelperLevel] = strval(fetch);

            cache_get_field_content(i, "cFaction", fetch, MySQL_Connection);
            CharacterInfo[playerid][cFaction] = strval(fetch);
            printf("Player Faction: %d", fetch);

            cache_get_field_content(i, "cFactionRank", fetch, MySQL_Connection);
            CharacterInfo[playerid][cFactionRank] = strval(fetch);  
            cache_get_field_content(i, "cFactionBadge", fetch, MySQL_Connection);
            format(CharacterInfo[playerid][cFactionBadge], 10, "%s", fetch);  

            cache_get_field_content(i, "Character_X",fetch, MySQL_Connection);
            CharacterInfo[playerid][Character_X] = floatstr(fetch);
            cache_get_field_content(i, "Character_Y",fetch, MySQL_Connection);
            CharacterInfo[playerid][Character_Y] = floatstr(fetch);
            cache_get_field_content(i, "Character_Z",fetch, MySQL_Connection);
            CharacterInfo[playerid][Character_Z] = floatstr(fetch);                    
            cache_get_field_content(i, "Character_R",fetch, MySQL_Connection);
            CharacterInfo[playerid][Character_R] = floatstr(fetch);        

            cache_get_field_content(i, "cSkin", fetch, MySQL_Connection);
            CharacterInfo[playerid][cSkin] = strval(fetch);
            cache_get_field_content(i, "cCashOnHand", fetch, MySQL_Connection);
            CharacterInfo[playerid][cCashOnHand] = strval(fetch);          
            cache_get_field_content(i, "cHasRadio", fetch, MySQL_Connection);
            CharacterInfo[playerid][cHasRadio] = strval(fetch);
            cache_get_field_content(i, "cRadioPower", fetch, MySQL_Connection);
            CharacterInfo[playerid][cRadioPower] = strval(fetch);
            cache_get_field_content(i, "cRadioFrequency", fetch, MySQL_Connection);
            CharacterInfo[playerid][cRadioFrequency] = strval(fetch);                                                                                      
            cache_get_field_content(i, "cDrivingLicense", fetch, MySQL_Connection);
            CharacterInfo[playerid][cDrivingLicense] = strval(fetch);
            cache_get_field_content(i, "cWeaponsLicense", fetch, MySQL_Connection);
            CharacterInfo[playerid][cWeaponsLicense] = strval(fetch);
            cache_get_field_content(i, "cTruckingLicense", fetch, MySQL_Connection);
            CharacterInfo[playerid][cTruckingLicense] = strval(fetch);
            cache_get_field_content(i, "cCookies", fetch, MySQL_Connection);
            CharacterInfo[playerid][cCookies] = strval(fetch);
            cache_get_field_content(i, "cGoldNuggets", fetch, MySQL_Connection);
            CharacterInfo[playerid][cGoldNuggets] = strval(fetch);
            cache_get_field_content(i, "cStaffJailed", fetch, MySQL_Connection);
            CharacterInfo[playerid][cStaffJailed] = strval(fetch);
            cache_get_field_content(i, "cStaffJailedTime", fetch, MySQL_Connection);
            CharacterInfo[playerid][cStaffJailedTime] = strval(fetch);

            CharacterInfo[playerid][HasLogged] = 1;
            SetPlayerSkin(playerid, CharacterInfo[playerid][cSkin]);
            SetPlayerPos(playerid, CharacterInfo[playerid][Character_X], CharacterInfo[playerid][Character_Y], CharacterInfo[playerid][Character_Z]);
            SetPlayerFacingAngle(playerid,CharacterInfo[playerid][Character_R]);             
        }
    } else {
        ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Welcome to {EN}", "Please provide the password you provided where you registered.", "Continue", "Quit");
    }  
    return 1;
}
Reply
#2

Bump
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)