MySQL Thread
#1

Hello,
I'm having a problem. I'm running a query which select a username, however the thread takes for ever. So before I even manage to get the username from the thread, my script has already printed out a name which is blank. Now, I'm using a stock and I know that you can print out a message through the thread, but I don't want it done that way. I'm using SetPVar and GetPVar. The thread sets a PVar and the stock sends the PVar to a player.

Thanks.
Reply
#2

I suggest that you separate the query and the code that processes the result. Most plugins have an OnQueryFinish callback such as:

Код:
public OnQueryFinish(query[], resultid, extraid, connectionHandle)
{
	if(resultid == something)
	{
		//Process result
	}
	
	return 1;
}
This will guarantee that your code will not execute until the query has finished.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)