Beispiel #1
0
        private static async Task Min5Timer()
        {
            await Delay(1000 * 60 * 5);

            Vehicle.SpawnVehiclePriority.Clear();

            var plList = new PlayerList();

            foreach (var player in plList)
            {
                if (Server.Sync.Data.Has(User.GetServerId(player), "id"))
                {
                    Save.UserAccount(player);
                }
            }

            Debug.WriteLine("Saved time and user accounts");
            Main.UpdateDiscordStatus();

            Debug.WriteLine("Saved all stock");
            for (int i = 0; i <= Business.Count + 1; i++)
            {
                Save.Business(i);
            }
            Debug.WriteLine("Saved all businnes");

            /*Timer grab*/

            for (int i = 0; i < 100; i++)
            {
                if (Server.Sync.Data.Has(1000000, "TimerGrab" + i))
                {
                    if ((int)Server.Sync.Data.Get(1000000, "TimerGrab" + i) < 0)
                    {
                        Server.Sync.Data.Reset(1000000, "TimerGrab" + i);
                        Server.Sync.Data.Reset(1000000, "Grab" + i);
                        continue;
                    }

                    Server.Sync.Data.Set(1000000, "TimerGrab" + i, Convert.ToInt32(Server.Sync.Data.Get(1000000, "TimerGrab" + i)) - 1);
                }

                if (Server.Sync.Data.Has(1100000, "TimerGrabShop" + i))
                {
                    if ((int)Server.Sync.Data.Get(1100000, "TimerGrabShop" + i) < 0)
                    {
                        Server.Sync.Data.Reset(1100000, "TimerGrabShop" + i);
                        Server.Sync.Data.Reset(1100000, "GrabShop" + i);
                        continue;
                    }

                    Server.Sync.Data.Set(1100000, "TimerGrabShop" + i, Convert.ToInt32(Server.Sync.Data.Get(1000000, "TimerGrabShop" + i)) - 1);
                }
            }
        }