PK Tourney Timer Problem

09/29/2010 21:02 peterpiper99#1
Alright, I have a problem. I made a Timer, to start the PK Tournament. But it keeps doing it over and over for that one minute. I only want it to do it once in that one minute. Here is what I got.

Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace NewestCOServer.Features
{
    class PKTourneyTimer
    {
        public static void PKTTimer()
        {
            if (DateTime.Now.Minute == 30)
            {
                if (NewestCOServer.Features.PKTournament.Stage == NewestCOServer.Features.PKTournamentStage.None)
                {
                    NewestCOServer.Features.PKTournament.StartTournament();
                }
            }
        }
    }
}
Code:
try
            {
                Features.PKTourneyTimer.PKTTimer();
            }
            catch { }
Help will be appreciated.
09/29/2010 21:27 Fish*#2
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace NewestCOServer.Features
{
    class PKTourneyTimer
    {
        public static bool PKStarted = false;
        public static void PKTTimer()
        {
            if (DateTime.Now.Minute == 30 && PKStarted == false)
            {
                PKStarted = true;
                if (NewestCOServer.Features.PKTournament.Stage == NewestCOServer.Features.PKTournamentStage.None)
                {
                    NewestCOServer.Features.PKTournament.StartTournament();
                }
            }
        }
    }
}
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace NewestCOServer.Features
{
    class PKTourneyTimer
    {
        public static void PKTTimer()
        {
            if (DateTime.Now.Minute == 30 && DateTime.Now.Second == 01)
            {
                if (NewestCOServer.Features.PKTournament.Stage == NewestCOServer.Features.PKTournamentStage.None)
                {
                    NewestCOServer.Features.PKTournament.StartTournament();
                }
            }
        }
    }
}
now make sure u make it false when tourny ends.
You simply just use a bool.

You could do DateTime.Now.Minute == 30 && DateTime.Now.Second == 01
also.