Forum C# Timer in server

Timer in server

Postby radmahdi » September 6th, 2011, 8:53 pm

Hello,

I am new to use playerIO, I am wondering how I can use sleep function in server side code. I tried to use some think like
Code: Select all
System.Threading.Thread.Sleep(5000);
but I got the following error:
- error: MyGame.GameCode.GotMessage(...) uses the non-allowed method: System.Void System.Threading.Thread::Sleep(System.Int32)


My goal of using this function is do something after some seconds, for example staring a game in 5 secs.

any idea will be appreciated,
Thanks
radmahdi
 
Posts: 16
Joined: July 1st, 2011, 11:27 pm

Re: Timer in server

Postby FulaFisken » September 6th, 2011, 9:45 pm

I think you can use ScheduleCallback.
Fula Fisken
website blog twitter
Play Game
Astroflux
User avatar
FulaFisken
Paid Member
 
Posts: 139
Joined: March 2nd, 2011, 10:15 am

Re: Timer in server

Postby radmahdi » September 6th, 2011, 10:21 pm

FulaFisken wrote:I think you can use ScheduleCallback.


Thanks for your response, but can you explain a little more or give me a example?
radmahdi
 
Posts: 16
Joined: July 1st, 2011, 11:27 pm


Re: Timer in server

Postby radmahdi » September 6th, 2011, 11:24 pm

radmahdi
 
Posts: 16
Joined: July 1st, 2011, 11:27 pm

Re: Timer in server

Postby khanahmed_95@hotmail.com » March 13th, 2012, 7:26 pm

How do i stop the timer after it has started??
khanahmed_95@hotmail.com
 
Posts: 9
Joined: November 21st, 2011, 3:07 am

Re: Timer in server

Postby Henrik » March 19th, 2012, 5:09 pm

khanahmed_95@hotmail.com wrote:How do i stop the timer after it has started??

ScheduleCallback only executes once, Timer executes until you call stop:

http://playerio.com/documentation/refer ... timer#Stop
Henrik
.IO
 
Posts: 1880
Joined: January 4th, 2010, 1:53 pm

Re: Timer in server

Postby khanahmed_95@hotmail.com » March 20th, 2012, 2:53 am

kk thanx
khanahmed_95@hotmail.com
 
Posts: 9
Joined: November 21st, 2011, 3:07 am


Return to C#