Master Accounts Not Loading
#1

Basically the master account names aren't showing in the dialog.

pawn Код:
stock LoadCharacterAccounts(playerid)
{
    new count = 0,CharacterName[MAX_PLAYER_NAME];
    format(MasterAccounts[playerid][CharacterString], 128,"");

    format(Query,sizeof(Query),"SELECT * FROM `characters` WHERE `MasterID` = '%d'",MasterAccounts[playerid][MasterAccountID]);
    mysql_query(Query);
    count = mysql_num_rows();
   
    if(count == 0)
    {
        ShowPlayerDialog(playerid, 200, DIALOG_STYLE_LIST, "Your Characters", "None to load, create one on the ucp", "", "Quit");
    }
    for(new a; a < count; a++)
    {
        mysql_fetch_field_row(CharacterName,"username");
        format(MasterAccounts[playerid][CharacterString], 128, "%s\n%s", MasterAccounts[playerid][CharacterString], CharacterName);
        printf("Character %s ,Owned By %s has been loaded",CharacterInfo[playerid][Character], GetOriginalName(playerid));
    }
    if(strlen(MasterAccounts[playerid][CharacterString]) >= 1) { ShowPlayerDialog(playerid, 200, DIALOG_STYLE_LIST, "Your Characters", MasterAccounts[playerid][CharacterString], "Select", "Quit"); }
    mysql_free_result();
    return 1;
}
Reply
#2

You didn't use mysql_store_result.
Reply
#3

Okay i've made it so it loads the correct Item now (Character) but it isn't showing the dialog anymore, this is really annoying me now :P

pawn Код:
stock LoadCharacterAccounts(playerid)
{
    new count = 0,CharacterName[MAX_PLAYER_NAME];
    format(MasterAccounts[playerid][CharacterString], 128,"");

    format(Query,sizeof(Query),"SELECT * FROM `characters` WHERE `MasterID` = '%d'",MasterAccounts[playerid][MasterAccountID]);
    mysql_query(Query);
    mysql_store_result();
    count = mysql_num_rows();

    if(count == 0)
    {
        ShowPlayerDialog(playerid, 200, DIALOG_STYLE_LIST, "Your Characters", "None to load, create one on the ucp", "", "Quit");
    }
    for(new a; a < count; a++)
    {
        mysql_fetch_field_row(CharacterName,"Character");
        format(MasterAccounts[playerid][CharacterString], 128, "%s\n%s", MasterAccounts[playerid][CharacterString], CharacterName);
        printf("Character %s ,Owned By %s has been loaded",CharacterInfo[playerid][Character], GetOriginalName(playerid));
    }
    if(strlen(MasterAccounts[playerid][CharacterString]) >= 1) { ShowPlayerDialog(playerid, 200, DIALOG_STYLE_LIST, "Your Characters", MasterAccounts[playerid][CharacterString], "Select", "Quit"); }
    mysql_free_result();
    return 1;
}
Reply
#4

Tried everything to fix this but still can't get it to load the data.

pawn Код:
stock LoadCharacterAccounts(playerid)
{
    new count = 0,CharacterName[MAX_PLAYER_NAME];
    format(MasterAccounts[playerid][CharacterString], 128,"");

    format(Query,sizeof(Query),"SELECT * FROM `characters` WHERE `MasterID` = '%d'",MasterAccounts[playerid][MasterAccountID]);
    mysql_query(Query);
    count = mysql_num_rows();
    mysql_store_result();

    if(count == 0)
    {
        ShowPlayerDialog(playerid, 200, DIALOG_STYLE_LIST, "Your Characters", "None to load, create one on the ucp", "", "Quit");
    }
    for(new a; a < count; a++)
    {
        mysql_fetch_field_row(CharacterName,"CharacterName");
        format(MasterAccounts[playerid][CharacterString], 128, "%s\n%s", MasterAccounts[playerid][CharacterString], strreplace(CharacterName, '_', ' '));
        printf("Character %s ,Owned By %s has been loaded",CharacterInfo[playerid][Character], GetOriginalName(playerid));
    }
    if(strlen(MasterAccounts[playerid][CharacterString]) >= 1) { ShowPlayerDialog(playerid, 200, DIALOG_STYLE_LIST, "Your Characters", MasterAccounts[playerid][CharacterString], "Select", "Quit"); }
    mysql_free_result();
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)