06.12.2010, 12:50
Basically, you take everything after your query ( in your posted example ) and put it under OnQueryFinish(), that way if two queries are being performed close together they will not overlap ( I think this is the idea ). It also means your script wont "hang" while the queries are being processed.
[edit] I'm new to sql, so I'm not 100% sure that this will fix your problem, however I am pretty sure its a good way to script sql queries.
more info here:
http://forum.sa-mp.com/showthread.ph...ght=sql+plugin
pawn Code:
#define THREAD_FUNCTION1 1
#define THREAD_FUNCTION2 2
public YourFunction(playerid)
{
//format query here..
mysql_query(string,THREAD_FUNCTION1,playerid,connection);
//playerid is extraid in the callback
//connection is the result of the mysql_connect function ( usually 1 )
return 1;
}
//I put this in a function to simulate you putting it in your script
public OnQueryFinish(query[], resultid, extraid, connectionhandle)
{
if(connectionhandle == connection) //precaution in case of multiple sql connections
{
switch(resultid)
{
case THREAD_FUNCTION1:
{
mysql_store_result(query);
//put the rest of your code here
mysql_free_result(query); //im not sure if you need this line
}
}
}
return 1;
}
more info here:
http://forum.sa-mp.com/showthread.ph...ght=sql+plugin