Multiple queries (or queries queue)
I'm trying to execute the code bellow, but the only the first query executes:
Code:
for(int i = 0; i <= MAXPLAYERS; i++) |
Re: Multiple queries (or queries queue)
not sure why exactly, but initialize the loop like this:
Code:
for(int i = 1; i <= MaxClients; i++) |
Re: Multiple queries (or queries queue)
Quote:
The usual game is only 5 vs. 5, i don't think that the size of loop is the problem. The problem is that only the first query is executed, the other 9 (in case of 5vs5) are ignored. |
Re: Multiple queries (or queries queue)
I'm not sure if I'm right about this but starting a query inside the for loop will break it (end the for loop) and wait for the query to respond.
You could try using transactions instead of doing each query individually - Transactions take several queries and execute them sequentially then pass results back to callbacks. See this for more information: https://sm.alliedmods.net/new-api/dbi/Database/Execute eg: Code:
Transaction th_Queries = null; |
Re: Multiple queries (or queries queue)
Also if you plan on passing a client id through the transaction make sure you convert it to userid then convert it back to index when the callback is called.
Transactions are the best way to catch all players instead of doing one by one. I have an example of using two different queries to get player settings etc in my build mod:
Spoiler
|
Re: Multiple queries (or queries queue)
Thanks guys! both Mitchell and Kryptanyte solutions worked for me
|
All times are GMT -4. The time now is 20:04. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.