public void Spawn()
        {
            Player player = Game.Player;
            Ped    ped    = Game.Player.Character;

            if (!Main.configData.Auto_Save_When_Wanted)
            {
                Game.Player.WantedLevel = 0;
            }

            World.Weather = GameWeather;
            DateTimeManager.SetDate(GameDate);
            DateTimeManager.SetTime(GameTime);

            Function.Call(GTA.Native.Hash.SET_FOLLOW_PED_CAM_VIEW_MODE, OnFootCameraMode);
            Function.Call(GTA.Native.Hash.SET_FOLLOW_VEHICLE_CAM_VIEW_MODE, InVehicleCameraMode);

            player.Money       = Money;
            ped.Money          = Money;
            ped.HealthFloat    = Health;
            ped.MaxHealthFloat = MaxHealth;
            ped.ArmorFloat     = Armor;

            InitPlayer setupPlayer = Script.InstantiateScript <InitPlayer>();

            setupPlayer.Start(this);

            Debug.Log("Init player started!");
        }
Пример #2
0
        private void ClockScripts_Tick(object sender, EventArgs e)
        {
            if (Game.IsPaused || Game.IsLoading)
            {
                return;
            }

            bool   keyIsDown = Game.IsEnabledControlPressed(Control.CharacterWheel);
            string time      = DateTimeManager.GetTimeString();

            if (keyIsDown)
            {
                if (Main.configSettings.Show_Radar_OnKeyDown)
                {
                    Hud.IsRadarVisible = true;
                }
                _clockScroll += 1 * Game.LastFrameTime;
                if (_clockScroll > 0.02f)
                {
                    _clockScroll = 0.02f;
                }
            }
            else
            {
                _clockScroll -= 1 * Game.LastFrameTime;
                if (_clockScroll < -0.2f)
                {
                    _clockScroll = -0.2f;
                    if (Main.configSettings.Show_Radar_OnKeyDown)
                    {
                        Hud.IsRadarVisible = false;
                    }
                }
            }

            if (Main.configClock.Enable_Top_Clock)
            {
                Helpers.DrawText(new Vector2(0.5f, _clockScroll), time, true, true, 1.068f, 0, 0, 0, 200, Font.ChaletComprimeCologne);
                Helpers.DrawText(new Vector2(0.5f, _clockScroll), time, true, true, 1.066f, 240, 240, 240, 255, Font.ChaletComprimeCologne);
            }

            // Sync with machine
            if (DateTimeManager.CurrentClockMode == ClockMode.Sync)
            {
                DateTimeManager.Freeze(true);
                DateTimeManager.SetDate(DateTime.Now);
                DateTimeManager.SetTime(DateTime.Now.TimeOfDay);
            }
            // Vanilla game time
            else if (DateTimeManager.CurrentClockMode == ClockMode.Vanilla)
            {
                DateTimeManager.Freeze(false);
            }
            // Virtual game time
            else
            {
                DateTimeManager.Freeze(true);

                if (Game.GameTime > _timer)
                {
                    _timer = Game.GameTime + (int)Math.Round(1000 * DateTimeManager.CurrentTimerate);
                    DateTimeManager.AddSeconds(1);
                }
            }

            // Update Clock
            DateTimeManager.UpdateGameClock();
        }