Pause / Sleep function?
#1

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
Reply
#2

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 ******.
Reply
#3

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.
Reply
#4

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
Reply
#5

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
Reply
#6

i think this can be done with macros
Reply
#7

Quote:
Originally Posted by wups
Посмотреть сообщение
i think this can be done with macros
More info?:P
Reply
#8

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.
Reply
#9

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
Reply
#10

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)