SA-MP Forums Archive
Hi - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Hi (/showthread.php?tid=495399)



Hi - audriuxxx - 17.02.2014

Hi,

How to sleep your code without while? because i know when you use while for a long time, then sometimes server will be always crashed even the time will be passed...


Re: Hi - iZN - 17.02.2014

Use timer?


Re: Hi - audriuxxx - 17.02.2014

Because i want to do, when a lot of queries is not completed, then i want to sleep my server for a while, when queries is completed then again on. I know how to check how much queries is not completed, just how well sleep your server. If with timer, please show how.


Re: Hi - Flake. - 17.02.2014

I really don't understand what you're trying to say but a timer will be your best bet

pawn Код:
forward blahblah();

//Under OnGameModeInit
SetTimer("blahblah", 1000, true); //1000 Is the time (In milliseconds) and True/False repeat or not


//Anywhere
public blahblah()
{
//code here
}



Re: Hi - audriuxxx - 17.02.2014

This timer don't sleep my server... I need a function which can sleep server like that:

Код:
new bool:TWQEWEQEWt;
while(TWQEWEQEWt==false)
{

}
If i do like that, even i have a settimer made like:


Код:
new bool:TWQEWEQEWt;


SetTimer("OFFTQWEQWE",20000,false);
while(TWQEWEQEWt==false)
{

}
Код:
forward OFFTQWEQWE( );
public OFFTQWEQWE( )
{
TWQEWEQEWt = true;
}
I make this function when player spawn for test.

But here even 20 sec. have passed code is still hang.


Re: Hi - iZN - 17.02.2014

Use mysql_query because this native sends a non-threaded query to the MySQL server. The SA:MP server (the main PAWN thread) waits until the query has been executed and then returns the cache handle.

pawn Код:
native mysql_query(conhandle, query[], bool:use_cache = true); // BlueG's R33+



Re: Hi - audriuxxx - 17.02.2014

But know i have all make into R37, and i don't remake everything to R33 or lower...


Re: Hi - iZN - 17.02.2014

Quote:
Originally Posted by audriuxxx
Посмотреть сообщение
But know i have all make into R37, and i don't remake everything to R33 or lower...
R33+ means R33 and above. It can be used with R37 too. :facepalm:


Re: Hi - audriuxxx - 17.02.2014

But here:

native mysql_query(conhandle, query[], bool:use_cache = true); // BlueG's R33+

Is no callback. Because in mysql_tquery you have to put a callback.