Creating a code in the command

Banana

New Member
Feb 21, 2018
11
0
Hello community, I have a small problem of code in the command event I explain myself:

in the command eha I wanted to put the bubble alert in the top right, I succeeded as soon as I put eha it also executes but I want the eha in itself to execute a few seconds after the bubble alert so what is the code of this, can you please help me? I can pass the entire code on request.
 

Gang67

|Jump out gang, we jump out those vehicles|
May 5, 2017
303
54
Hello community, I have a small problem of code in the command event I explain myself:

in the command eha I wanted to put the bubble alert in the top right, I succeeded as soon as I put eha it also executes but I want the eha in itself to execute a few seconds after the bubble alert so what is the code of this, can you please help me? I can pass the entire code on request.
Probably do this with threads
 

Blasteh

big tits
Apr 3, 2013
1,156
521
stop speaking french on an english forum, i dont have a clue what you're saying
He said he wants the code to delay for 10 seconds and that he wants someone to code it for him.

Je voudrais avoir la tâche. code de retard en 10 secondes pour plus d'une personne peut me le faire?
Parle anglais. Personne ici ne parle français, c'est un site anglais.

(I told him to Speak English, I’m not encouraging him to speak French)
 

JayC

Well-Known Member
Aug 8, 2013
5,505
1,401
Thread.Sleep(1000);
Absolutely against using thread.sleep anywhere in the emulator. This is a noobish way to do it. It causes the entire thread to stop processing - so the whole thread goes into a paused state. Putting this in the wrong spot, could cause your user to freeze until that time is up.

Also Sleep takes milliseconds - 1,000 is 1 second. You need to say 10,000 to sleep for 10 seconds.
 
Okay, so since I am going to reply to this and say what not to do, I will reply and give the best possible answer to how I would code this.
I would create a Timer for each user. Do NOT keep them running 24/7. When you need the timer inside of the code - CREATE IT. Wait for the timer to execute, then discard the timer until you need to create it again.

Timers are their own threads, which mean that when that part of your code is reached - You are not pausing the code that is already running. This way your thread can get in, and out and continue with whatever processes it needs to while your timer is ticking away in the background awaiting execution.
 

Users who are viewing this thread

Top