SA-MP Forums Archive
Delay, Sleep, Pause??????? - 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: Delay, Sleep, Pause??????? (/showthread.php?tid=339309)



Delay, Sleep, Pause??????? - LeetModz - 03.05.2012

I need some kind of delay or pause function to use in my script.

timer is not really what I want, I dont need a function run after the time is up, I just want the code below the pause line to continue on after the pause time is up.

Anyone know of any?


Re: Delay, Sleep, Pause??????? - WarriorEd22 - 03.05.2012

TogglePlayerControllable


Re: Delay, Sleep, Pause??????? - LeetModz - 03.05.2012

Quote:
Originally Posted by WarriorEd22
Посмотреть сообщение
Totally not what I'm talking about.

I need something like this, in plain english

display textdraw
wait 4 seconds then continue<------ this is what I need
hide textdraw


Re: Delay, Sleep, Pause??????? - Reynolds - 03.05.2012

Somebody has created a function called "halt". I'm afaird this isn't what you're looking for, since it stops the thread, means it freezes the server for all players (multi-thread plugins' calculations will also run).

What you'd like to do is not possible without timers. I hate them too, but no other way. You can't just wait for a few seconds, even not in callbacks. This can be really annyoing, but this is the best you can do ATM.

pawn Код:
forward Continue(playerid);

function(){
    DoSomething  = 1;
    SetTimerEx("Continue",4000,false,"i",playerid);
    continue_label: new DoSomething = 3; //the continue of your function
    new DoSomething = 4;
}

public Continue() {
    DoSomething = 2;
    goto continue_label;
}
Although using labels in PAWN is not recommended, the code above should work.


Re: Delay, Sleep, Pause??????? - LeetModz - 03.05.2012

Quote:
Originally Posted by Reynolds
Посмотреть сообщение
Somebody has created a function called "halt". I'm afaird this isn't what you're looking for, since it stops the thread, means it freezes the server for all players (multi-thread plugins' calculations will also run).

What you'd like to do is not possible without timers. I hate them too, but no other way. You can't just wait for a few seconds, even not in callbacks. This can be really annyoing, but this is the best you can do ATM.

pawn Код:
forward Continue(playerid);

function(){
    DoSomething  = 1;
    SetTimerEx("Continue",4000,false,"i",playerid);
    continue_label: new DoSomething = 3; //the continue of your function
    new DoSomething = 4;
}

public Continue() {
    DoSomething = 2;
    goto continue_label;
}
Although using labels in PAWN is not recommended, the code above should work.
Thank you for letting me know. It sucks but oh well.

And Ill give that code a test later and see if it works. Looks very promising