Pause / Sleep function? -
DaneAMattie - 18.08.2010
Is there any sleep or pause function
So this function lets the code pause / sleep for a matter of time example:
SendClientMessage(1,COLOR_RED,"WIEEEEEE");
Pause(1000); //1000 ms
SendClientMessage(1,COLOR_REd,"1 second has passed")
and no i dont want to use timers :P
Re: Pause / Sleep function? -
iggy1 - 18.08.2010
Check YUP on ******' sig

was looking at that myself last night never knew it existed, will be using it myself for pausers.
Good work as always by ******.
Re: Pause / Sleep function? -
Mauzen - 18.08.2010
I have no idea if it works, just wrote it:
pawn Код:
new reset = 0;
public Pause(millis)
{
SetTimer("PauseReset", millis, 0)
while(!pause) {}
}
public PauseReset()
{
reset = 1;
}
Hmm, looks as this would make the server lag in the 'while' but was just a short idea.
Re: Pause / Sleep function? -
DaneAMattie - 18.08.2010
Thanks for all reply's, but is there any other way to do this?
Quote:
Originally Posted by ******
Why? You are essentially saying "is there any way to do this other than the method specifically designed for this sort of thing"!
|
and i wont use a timer becauze its irritating for just a pause function + lagging the servr
Re: Pause / Sleep function? -
DaneAMattie - 18.08.2010
Quote:
Originally Posted by ******
It doesn't lag the server at all if it's done correctly - Mauzen's way was not done correctly. There are two ways of doing it. Firstly look up the real sleep function in the pawn manual, but this can only be used in main(). Secondly do something like:
pawn Код:
FuncPart1() { printf("my code"); SetTimer("FuncPart2", 1000, 0); }
public FuncPart2() { printf("My other code"); }
|
yea i know how the timer works, but isnt there just a simple function like sleep(1000); becuz it kinda sux, im having a timer with a code and in that timer i need a sleep function
Re: Pause / Sleep function? -
wups - 18.08.2010
i think this can be done with macros
Re: Pause / Sleep function? -
DaneAMattie - 18.08.2010
Quote:
Originally Posted by wups
i think this can be done with macros 
|
More info?:P
Re: Pause / Sleep function? -
Mauzen - 18.08.2010
Quote:
Originally Posted by ******
It doesn't lag the server at all if it's done correctly - Mauzen's way was not done correctly. There are two ways of doing it. Firstly look up the real sleep function in the pawn manual, but this can only be used in main(). Secondly do something like:
(...)
|
Yeah, I knew this would not work jsut when I finished it, as i said at the end of my post. But I thought it might be useful to mention this way, even, if it does not work.

Another idea (but dont blame me again, if it is nonsense, i have no big plugin experience): C should support a native sleep function afaik. Maybe it would be possible to create a pause-plugin, meaning, you create a native pawn function, that calls sleep in C.
Re: Pause / Sleep function? -
DaneAMattie - 18.08.2010
Quote:
Originally Posted by Mauzen
Yeah, I knew this would not work jsut when I finished it, as i said at the end of my post. But I thought it might be useful to mention this way, even, if it does not work. 
Another idea (but dont blame me again, if it is nonsense, i have no big plugin experience): C should support a native sleep function afaik. Maybe it would be possible to create a pause-plugin, meaning, you create a native pawn function, that calls sleep in C.
|
i dont do C (atm, i will learn C# this year) for now i do VB
Re: Pause / Sleep function? -
Mauzen - 19.08.2010
I just tested it: Lags the server like while(). So it seems to be impossible with pawn, it blocks the server if a functions runs too long.