Пример #1
0
 void AutoStartEvents()
 {
     if (autoEvents)
     {
         timerAutoEvents = timer.Repeat(timeAutoEvents * 60, 0, () => StartEvents());
     }
 }
Пример #2
0
 void StartEvents()
 {
     if (PlayerClient.All.Count < minimumPlayersEvent)
     {
         return;
     }
     if (randomEvents)
     {
         if (!autoLottery && !lotteryOfPlayers)
         {
             autoLottery      = true;
             lotteryOfPlayers = true;
         }
         else if (autoLottery && lotteryOfPlayers)
         {
             lotteryOfPlayers = false;
         }
         else if (autoLottery && !lotteryOfPlayers)
         {
             autoLottery = false;
         }
     }
     if (autoLottery)
     {
         EventLottery();
     }
     else if (autoMath)
     {
         var listQuestions  = questionsAnswersPrizes.ToList();
         int randomQuestion = random.Next(0, listQuestions.Count);
         var questionRandom = listQuestions[numberQuestion] as string[];
         if (questionRandom == null)
         {
             Puts("Questions Number: " + randomQuestion.ToString() + " is nuul! I advise you to delete the config MiniEvents.");
             return;
         }
         openMath       = true;
         numberQuestion = randomQuestion;
         rust.BroadcastChat(tagChat, string.Format(GetMessage("AutoStartGameMath"), questionRandom[0], timeCloseAnswersMath));
         timerAnswersMath = timer.Once(timeCloseAnswersMath * 60, () =>
         {
             openMath = false;
             rust.BroadcastChat(tagChat, GetMessage("AutoStartGameMath1"));
         });
     }
 }
Пример #3
0
 void InitiateTime(bool settime)
 {
     if (plugintimer != null)
     {
         plugintimer.Destroy();
     }
     env.daylength   = 999999999f;
     env.nightlength = 99999999f;
     if (settime)
     {
         EnvironmentControlCenter.Singleton.SetTime(Convert.ToSingle(startTime));
     }
     cachedDaytime   = Convert.ToSingle(dayTime);
     cachedNighttime = Convert.ToSingle(nightTime);
     if (cachedDaytime < 1f)
     {
         cachedDaytime = 1f;
     }
     if (cachedNighttime < 1f)
     {
         cachedNighttime = 1f;
     }
     plugintimer = timer.Repeat(1f, 0, () => CheckTime());
 }