Hey guys i've posted two topics about this same thing before but since have re-written the code for this part and for some reason it's showing as a 'Dead Connection' in the mysql_log (debug) but it loads the dynamic factions correctly. (Its also not loading the dialog)
pawn Код:
[14:26:00] >> mysql_query( Connection handle: 1 )
[14:26:00] CMySQLHandler::Query(SELECT * FROM `characters` WHERE ( `MasterAccountID` = '1' )) - Successfully executed.
[14:26:00] >> mysql_num_rows( Connection handle: 1 )
[14:26:00] CMySQLHandler::NumRows() - You cannot call this function now. (Reason: Dead Connection)
[14:26:00] >> mysql_free_result( Connection handle: 1 )
[14:26:00] CMySQLHandler::FreeResult() - The result is already empty.
[14:26:00] >> mysql_free_result( Connection handle: 1 )
[14:26:00] CMySQLHandler::FreeResult() - The result is already empty.
pawn Код:
public ShowMenuDialog(playerid)
{
new count = 0, CharacterName[MAX_PLAYER_NAME];
format(MasterAccounts[playerid][CharacterString], 128, ""); // Resetting Character list string, because reading text from list is impossible.
if(MasterAccounts[playerid][IsLogged])
{
format(Query, sizeof(Query), "SELECT * FROM `characters` WHERE ( `MasterAccountID` = '%d' )", MasterAccounts[playerid][MasterAccountID]);
mysql_query(Query);
count = mysql_num_rows();
if(count == 0)
{
ShowPlayerDialog(playerid, DIALOG_MAINMENU, DIALOG_STYLE_LIST, "Main Menu - Character Selection", "No characters available.", "Spawn", "Options");
}
for(new a;a<count;a++)
{
mysql_get_field("CharacterName",CharacterName); //(qresult, "name", CharacterName, MAX_PLAYER_NAME);
format(MasterAccounts[playerid][CharacterString], 128, "%s\n%s", MasterAccounts[playerid][CharacterString], strreplace(CharacterName, '_', ' '));
printf("Character Loaded: %s - Master ID: %d",CharacterName, MasterAccounts[playerid][MasterAccountID]);
mysql_next_row();
}
if(strlen(MasterAccounts[playerid][CharacterString]) >= 1) { ShowPlayerDialog(playerid, DIALOG_MAINMENU, DIALOG_STYLE_LIST, "Main Menu - Character Selection", MasterAccounts[playerid][CharacterString], "Spawn", "Options"); }
mysql_free_result();
}
}