Command out of sync. I give rep !!!! -
buburuzu19 - 09.10.2014
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.
Re: Command out of sync. I give rep !!!! -
DowntownGangster - 09.10.2014
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())
{
Re: Command out of sync. I give rep !!!! -
buburuzu19 - 09.10.2014
Can u add it to the command inside , and give me the command fixed pls / i can't understand where i have to modify
Re: Command out of sync. I give rep !!!! -
DowntownGangster - 09.10.2014
Код:
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
Re: Command out of sync. I give rep !!!! -
thefatshizms - 09.10.2014
Why are you querying multiple times? Surely just use one query? Also you should consider updating your MySQL plugin.