public void Update()
        {
            if (MainCamera.IsActive)
            {
                if (_renderSceneTimer.Enabled && Game.GameTime > _renderSceneTimer.Waiter)
                {
                    Function.Call(Hash._0x0923DBF87DFF735E, _mainCamera.Position.X, _mainCamera.Position.Y, _mainCamera.Position.Z);
                    _renderSceneTimer.Reset();
                }

                Function.Call(Hash.DISABLE_CONTROL_ACTION, 2, (int)Control.VehicleCinCam, true);
                Function.Call(Hash.DISABLE_CONTROL_ACTION, 2, (int)Control.MultiplayerInfo, true);
                Function.Call(Hash.DISABLE_CONTROL_ACTION, 2, (int)Control.MeleeAttackLight, true);
                Function.Call(Hash.DISABLE_CONTROL_ACTION, 2, (int)Control.MeleeAttackAlternate, true);
                Function.Call(Hash.DISABLE_CONTROL_ACTION, 2, (int)Control.MeleeAttack2, true);
                Function.Call(Hash.DISABLE_CONTROL_ACTION, 2, (int)Control.Phone, true);
                Function.Call(Hash.DISABLE_CONTROL_ACTION, 2, (int)Control.VehicleLookBehind, true);
                Function.Call(Hash.DISABLE_CONTROL_ACTION, 2, (int)Control.FrontendRs, true);
                Function.Call(Hash.DISABLE_CONTROL_ACTION, 2, (int)Control.FrontendLs, true);
                Function.Call(Hash.DISABLE_CONTROL_ACTION, 2, (int)Control.FrontendX, true);
                Function.Call(Hash.DISABLE_CONTROL_ACTION, 2, (int)Control.ReplayShowhotkey, true);
                Function.Call(Hash.DISABLE_CONTROL_ACTION, 2, (int)Control.ReplayTools, true);
                Function.Call(Hash.DISABLE_CONTROL_ACTION, 2, (int)Control.ScriptPadDown, true);
                Function.Call(Hash.DISABLE_CONTROL_ACTION, 2, (int)Control.FrontendDown, true);
                Function.Call(Hash.DISABLE_CONTROL_ACTION, 2, (int)Control.PhoneDown, true);
                Function.Call(Hash.DISABLE_CONTROL_ACTION, 2, (int)Control.HUDSpecial, true);
                Function.Call(Hash.DISABLE_CONTROL_ACTION, 2, (int)Control.SniperZoomOutSecondary, true);
                Function.Call(Hash.DISABLE_CONTROL_ACTION, 2, (int)Control.CharacterWheel, true);
                Function.Call(Hash.DISABLE_CONTROL_ACTION, 2, (int)Control.ReplayNewmarker, true);
                Function.Call(Hash.DISABLE_CONTROL_ACTION, 2, (int)Control.ReplayStartStopRecording, true);
                Function.Call(Hash.DISABLE_CONTROL_ACTION, 2, (int)Control.ReplayStartStopRecordingSecondary, true);
                Function.Call(Hash.DISABLE_CONTROL_ACTION, 2, (int)Control.ReplayPause, true);
                Function.Call(Hash.DISABLE_CONTROL_ACTION, 2, (int)Control.MoveUpDown, true);
                Function.Call(Hash.DISABLE_CONTROL_ACTION, 2, (int)Control.MoveLeftRight, true);
                Function.Call(Hash.DISABLE_CONTROL_ACTION, 2, (int)Control.MoveLeftOnly, true);
                Function.Call(Hash.DISABLE_CONTROL_ACTION, 2, (int)Control.MoveRightOnly, true);
                Function.Call(Hash.DISABLE_CONTROL_ACTION, 2, (int)Control.MoveUpOnly, true);
                Function.Call(Hash.DISABLE_CONTROL_ACTION, 2, (int)Control.MoveDownOnly, true);

                Function.Call(Hash.HIDE_HUD_AND_RADAR_THIS_FRAME);
                Function.Call(Hash.HIDE_HUD_COMPONENT_THIS_FRAME, 18);

                //render local scene

                var lastPos = Vector3.Subtract(_mainCamera.Position, _previousPos);
                Function.Call(Hash._SET_FOCUS_AREA, _mainCamera.Position.X, _mainCamera.Position.Y, _mainCamera.Position.Z, lastPos.X, lastPos.Y, lastPos.Z);

                _previousPos = _mainCamera.Position;

                RenderEntityPosition();

                GamepadHandler.Update();
                RenderIntructionalButtons();

                if (_currentLerpTime > 0)
                {
                    _currentLerpTime -= 0.01f;
                }
            }
        }
        public void Update()
        {
            gamepadHandler.Update();


            UI.ShowSubtitle(Rotation.ToString());

            Function.Call(Hash.REQUEST_COLLISION_AT_COORD, Position.X, Position.Y, Position.Z);


            if (Function.Call <bool>(Hash.HAS_ENTITY_COLLIDED_WITH_ANYTHING, this))/*World.Raycast(Position, Position + target * 0.2f, IntersectOptions.Everything).DitHitAnything*/
            {
                if (IsInWater)
                {
                    Function.Call(Hash.START_PARTICLE_FX_NON_LOOPED_AT_COORD, "scr_ojdg4_water_exp", Position.X, Position.Y, Position.Z, 0.0, 0.0, 0.0, 4.0, 0, 0, 0);
                }
                else
                {
                    Function.Call(Hash.START_PARTICLE_FX_NON_LOOPED_AT_COORD, "scr_drug_grd_train_exp", Position.X, Position.Y, Position.Z, 0.0, 0.0, 0.0, 4.0, 0, 0, 0);
                }

                World.AddExplosion(Position, ExplosionType.Train, 1.0f, 1.0f);
                Script.Wait(20);
                World.AddExplosion(Position + Position.LeftVector(Vector3.WorldUp) * 3, (ExplosionType)17, 30f, 1.5f);
                Script.Wait(20);
                World.AddExplosion(Position + Position.RightVector(Vector3.WorldUp) * 3, (ExplosionType)26, 30f, 1.5f);
                Script.Wait(20);
                World.AddExplosion(Position + ForwardVector * 3, (ExplosionType)17, 30f, 1.5f);
                Script.Wait(20);
                World.AddExplosion(Position - ForwardVector * 3, (ExplosionType)26, 30f, 1.5f);

                StopRoutine();

                OnExploded(this, new EventArgs());

                if (nightVision)
                {
                    Function.Call(Hash.SET_NIGHTVISION, false);
                }
                return;
            }

            //   CheckControlState();

            target = Position + Utils.RotationToDirection(Rotation);

            moveDist += 0.8f * aliveTime;

            if (moveDist >= 100.0f)
            {
                moveDist = 50.0f;
            }

            ApplyForce(ForwardVector * moveDist);

            Rotation = Vector3.Lerp(Rotation, newRotation, Game.LastFrameTime * 10.0F);

            mainCamera.Rotation = Rotation;

            if (targetOverlay)
            {
                this.targetEntities = World.GetNearbyEntities(Position, 1000f)
                                      .Where(x => Function.Call <int>(Hash.GET_PED_TYPE, x.Handle) != 28 &&
                                             x.Handle != Game.Player.Character.Handle).ToList();

                for (int i = 0; i < (targetEntities.Count < 30 ? targetEntities.Count : 30); i++)
                {
                    if ((Function.Call <bool>(Hash.IS_ENTITY_A_VEHICLE, targetEntities[i].Handle) &&
                         !new Vehicle(targetEntities[i].Handle).EngineRunning) ||
                        targetEntities[i].Handle == 0 ||
                        !targetEntities[i].IsAlive)
                    {
                        continue;
                    }

                    var pos = targetEntities[i].Position;
                    Function.Call(Hash.SET_DRAW_ORIGIN, pos.X, pos.Y, pos.Z, 0);
                    DrawHUD(new Point(), Color.Red);
                    Function.Call(Hash.CLEAR_DRAW_ORIGIN);
                }
            }

            if (hud)
            {
                DrawHUD(Color.White);
            }

            if (boost)
            {
                moveDist = 4.0f;
            }

            aliveTime = Game.GameTime - spawnTime;
        }