Command out of sync. I give rep !!!!
#1

pawn Код:
[15:47:30] errorid: 2014 | error: Commands out of sync; you can't run this command now | resultid: -1 | extraid: -1 | callback: NULL | query: SELECT playerGroupRank FROM playeraccounts WHERE playerGroup = 8
pawn Код:
CMD:members(playerid, params[])
{
    if(playerVariables[playerid][pGroup] >= 1 && playerVariables[playerid][pGroupRank] >= 6)
    {
        new aim[256];
        format(aim, 256,"{FFB300}%s members ({00B3FF}%d{FFFFFF}/{00B3FF}10{FFB300}):{FFFFFF} \n",groupVariables[playerVariables[playerid][pGroup]][gGroupName],groupVariables[playerVariables[playerid][pGroup]][gMembers]);
        new query[300],test[300],test2[256];
        format(query, sizeof(query), "SELECT playerName, playerGroupRank, playerCarWeapon3 FROM playeraccounts WHERE playerGroup = %d ORDER BY playerGroupRank DESC LIMIT 10",playerVariables[playerid][pGroup]);
        mysql_query(query);
        format(test, sizeof(test), "SELECT playerGroupRank FROM playeraccounts WHERE playerGroup = %d",playerVariables[playerid][pGroup]);
        mysql_query(test);
        format(test2, sizeof(test2), "SELECT playerCarWeapon3 FROM playeraccounts WHERE playerGroup = %d",playerVariables[playerid][pGroup]);
        mysql_query(test2);
        mysql_store_result();
        new memid;
        while(mysql_retrieve_row())
        {
            mysql_fetch_field_row(query, "playerName");
            format(Selected[memid][snume],24,"%s",query);
            mysql_fetch_field_row(test, "playerGroupRank");
            Selected[memid][srank] = strval(test);
            mysql_fetch_field_row(test2, "playerCarWeapon3");
            Selected[memid][swarn] = strval(test2);
            format(aim, sizeof(aim), "%s %s - Rank: %s - Warns: %s/3 \n",aim,query, test,test2);
            memid ++;
        }
        mysql_free_result();
        ShowPlayerDialog(playerid,DIALOG_MEMBERS,DIALOG_STYLE_LIST,"Members:",aim,"Sellect","Cancel");
    }
}
That's the error , hope you can help me.
Reply
#2

With mysql_query() - you must use mysql_store_result() after the query if you're using a SELECT statement.

For example

Код:
       format(query, sizeof(query), "SELECT playerName, playerGroupRank, playerCarWeapon3 FROM playeraccounts WHERE playerGroup = %d ORDER BY playerGroupRank DESC LIMIT 10",playerVariables[playerid][pGroup]);
        mysql_query(query);
        format(test, sizeof(test), "SELECT playerGroupRank FROM playeraccounts WHERE playerGroup = %d",playerVariables[playerid][pGroup]);
        mysql_query(test);
        mysql_store_result();
        while(mysql_retrieve_row())
        {

        }
        mysql_free_result();
        format(test2, sizeof(test2), "SELECT playerCarWeapon3 FROM playeraccounts WHERE playerGroup = %d",playerVariables[playerid][pGroup]);
        mysql_query(test2);
        mysql_store_result();
        new memid;
        while(mysql_retrieve_row())
        {
Reply
#3

Can u add it to the command inside , and give me the command fixed pls / i can't understand where i have to modify
Reply
#4

Код:
CMD:members(playerid, params[])
{
    if(playerVariables[playerid][pGroup] >= 1 && playerVariables[playerid][pGroupRank] >= 6)
    {
        new aim[256];
        format(aim, 256,"{FFB300}%s members ({00B3FF}%d{FFFFFF}/{00B3FF}10{FFB300}):{FFFFFF} \n",groupVariables[playerVariables[playerid][pGroup]][gGroupName],groupVariables[playerVariables[playerid][pGroup]][gMembers]);
        new query[300],test[300],test2[256];
        format(query, sizeof(query), "SELECT * FROM playeraccounts WHERE playerGroup = %d ORDER BY playerGroupRank DESC LIMIT 10",playerVariables[playerid][pGroup]);
        mysql_query(query);
        mysql_store_result();
        new memid;
        while(mysql_retrieve_row())
        {
            mysql_fetch_field_row(query, "playerName");
            format(Selected[memid][snume],24,"%s",query);
            mysql_fetch_field_row(test, "playerGroupRank");
            Selected[memid][srank] = strval(test);
            mysql_fetch_field_row(test2, "playerCarWeapon3");
            Selected[memid][swarn] = strval(test2);
            format(aim, sizeof(aim), "%s %s - Rank: %s - Warns: %s/3 \n",aim,query, test,test2);
            memid ++;
        }
        mysql_free_result();
        ShowPlayerDialog(playerid,DIALOG_MEMBERS,DIALOG_STYLE_LIST,"Members:",aim,"Sellect","Cancel");
    }
}
Try that
Reply
#5

Why are you querying multiple times? Surely just use one query? Also you should consider updating your MySQL plugin.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)