public virtual void Draw()
        {
            if (button == null || text == null)
            {
                return;
            }

            button.Draw();
            text.Draw();
        }
        /// <summary>
        /// Draw entity heads up display.
        /// </summary>
        /// <param name="location"></param>
        /// <param name="color"></param>
        /// <param name="subText"></param>
        /// <param name="sizeMultiplier"></param>
        /// <param name="withText"></param>
        /// <param name="drawRect"></param>
        private static void DrawSquare(Point location, Color color, string subText, float sizeMultiplier, bool withText, bool drawRect = true)
        {
            if (drawRect)
            {
                UIRectangle rect;
                rect       = new UIRectangle(new Point((int)((location.X - 25) * sizeMultiplier), (int)(location.Y * sizeMultiplier)), new Size((int)(4 * sizeMultiplier), (int)(54 * sizeMultiplier)));
                rect.Color = color;
                rect.Draw();
                rect       = new UIRectangle(new Point((int)((location.X + 25) * sizeMultiplier), (int)(location.Y * sizeMultiplier)), new Size((int)(4 * sizeMultiplier), (int)(54 * sizeMultiplier)));
                rect.Color = color;
                rect.Draw();
                rect       = new UIRectangle(new Point((int)((location.X - 25) * sizeMultiplier), (int)((location.Y + 54) * sizeMultiplier)), new Size((int)(52 * sizeMultiplier), (int)(4 * sizeMultiplier)));
                rect.Color = color;
                rect.Draw();
                rect       = new UIRectangle(new Point((int)((location.X - 25) * sizeMultiplier), (int)(location.Y * sizeMultiplier)), new Size((int)(52 * sizeMultiplier), (int)(4 * sizeMultiplier)));
                rect.Color = color;
                rect.Draw();
            }

            if (withText)
            {
                var text = new UIText(subText, new Point((int)((location.X - 5) * sizeMultiplier), (int)((location.Y + 60) * sizeMultiplier)), 0.3f, Color.White, GTA.Font.ChaletComprimeCologne, false);
                text.Draw();
            }
        }
Exemple #3
0
        /// <summary>
        /// Draws the complete information of a ped. That includes name and health.
        /// </summary>
        /// <param name="Character">The ped to get the information.</param>
        /// <param name="Position">The position on the screen.</param>
        /// <param name="TotalSize">The full size of the information field.</param>
        public static void PedInfo(Configuration Config, Ped Character, Point Position)
        {
            // First, draw the black background
            UIRectangle Background = new UIRectangle(Position, Config.SquadInfoSize, CBackground);

            Background.Draw();

            // Then, calculate the health bar: (Percentage / 100) * DefaultWidth
            float Width = (Character.HealthPercentage() / 100) * Config.SquadHealthSize.Width;
            // Create a Size with the required size
            Size NewHealthSize = new Size(Convert.ToInt32(Width), Config.SquadHealthSize.Height);

            // For the dividers, get the distance between each one of them
            int HealthSep = Config.SquadHealthSize.Width / 4;

            // Prior to drawing the health bar we need the separators
            for (int Count = 0; Count < 5; Count++)
            {
                // Calculate the position of the separator
                Point Pos = (Position + Config.SquadHealthPos) + new Size(HealthSep * Count, 0) + Config.DividerPosition;
                // And draw it on screen
                UIRectangle Divider = new UIRectangle(Pos, Config.DividerSize, CDivider);
                Divider.Draw();
            }

            // After the separators are there, draw the health bar on the top
            UIRectangle HealthBar = new UIRectangle(Position + Config.SquadHealthPos, NewHealthSize, Character.HealthColor());

            HealthBar.Draw();

            // And finally, draw the ped name
            UIText Name = new UIText(Character.Name(Config), Position + Config.NamePosition, 0.3f);

            Name.Draw();
        }
        public virtual void Draw()
        {
            if (button == null || text == null)
            {
                return;
            }

            button.Draw();
            text.Draw();

            if (UnderlinedAbove && underlineAbove != null)
            {
                underlineAbove.Draw();
            }

            if (UnderlinedBelow && underlineBelow != null)
            {
                underlineBelow.Draw();
            }
        }
 public override void DrawUI()
 {
     if (!Loaded)
     {
         return;
     }
     FpsCounter.Draw();
     UIRect.Position = new Vector2(350, 200);
     UIRect.Draw();
     base.DrawUI();
 }
Exemple #6
0
        /// <summary>
        /// Draws an icon with it's respective background.
        /// </summary>
        public static void Icon(Configuration Config, string ImageFile, Point Position)
        {
            // Draw the rectangle on the background
            UIRectangle Rect = new UIRectangle(Position, Config.IconBackgroundSize, CBackground);

            Rect.Draw();

            // Calculate the position of the image
            Point ImagePos = Position + Config.IconPosition;

            // And finally, add the image on top
            UI.DrawTexture(ImageFile, 0, 0, 200, ImagePos, Config.IconImageSize);
        }
        public static void DrawHUD(Point location, Color color)
        {
            var rect = new UIRectangle(new Point(location.X - 30, location.Y), new Size(7, 67));

            rect.Color = color;
            rect.Draw();
            rect       = new UIRectangle(new Point(location.X + 30, location.Y), new Size(7, 67));
            rect.Color = color;
            rect.Draw();
            rect       = new UIRectangle(new Point(location.X - 30, location.Y + 60), new Size(67, 7));
            rect.Color = color;
            rect.Draw();
            rect       = new UIRectangle(new Point(location.X - 30, location.Y), new Size(67, 7));
            rect.Color = color;
            rect.Draw();
        }
 private static void DrawSquare(Point location, Color color, string subText)
 {
     rect       = new UIRectangle(new Point(location.X - 25, location.Y), new Size(4, 52));
     rect.Color = color;
     rect.Draw();
     rect       = new UIRectangle(new Point(location.X + 25, location.Y), new Size(4, 52));
     rect.Color = color;
     rect.Draw();
     rect       = new UIRectangle(new Point(location.X - 25, location.Y + 50), new Size(52, 4));
     rect.Color = color;
     rect.Draw();
     rect       = new UIRectangle(new Point(location.X - 25, location.Y), new Size(52, 4));
     rect.Color = color;
     rect.Draw();
     entityText = new UIText(subText, new Point(location.X - 5, location.Y + 70), 0.3f, Color.White, Font.ChaletComprimeCologne, false);
     entityText.Draw();
     //   entityText = new UIText(subText1, new Point(location.X - 30, location.Y + 70), 0.22f);
     //    entityText.Draw();
 }
        public override void Draw(Size offset)
        {
            if (rectHeader == null || textHeader == null || (HasFooter && (rectFooter == null || textFooter == null)))
            {
                return;
            }

            if (HasFooter)
            {
                rectFooter.Draw(offset);
                textFooter.Draw(offset);
            }
            rectHeader.Draw(offset);
            textHeader.Draw(offset);
            for (int i = 0; i < ItemDrawCount; i++)
            {
                Items[i + CurrentScrollOffset].Draw(offset);
            }
            //DrawScrollArrows(CurrentScrollOffset > 0, CurrentScrollOffset < MaxScrollOffset, offset);
        }
Exemple #10
0
    void OnTick(object sender, EventArgs e)
    {
        //this._debug.Text = ;
        //this._debug.Draw();
        BigMessage.OnTick();
        Ped player = Game.Player.Character;

        if (_onMission)
        {
            Game.Player.WantedLevel = 0;
            if (_tick >= 60)
            {
                if (!_spotted)
                {
                    _seconds--;
                    _tick = 0;
                }
            }
            else
            {
                _tick++;
            }
            //FUTURE
            _headsup.Caption = "Level: ~b~" + _level;
            if (!_spotted)
            {
                _headsup.Caption += "~w~\nStart Chase: ~b~" + ParseTime(_seconds);
            }
            _headsup.Caption += "~w~\nKills: ~b~" + _kills;

            _headsup.Draw();
            _headsupRectangle.Draw();
            if (_seconds < 0)
            {
                UI.Notify("You ran out of time!\nThe ~r~criminals~w~ have escaped.");
                StopMissions();
            }
            else
            {
                for (int i = 0; i < _criminals.Count; i++)
                {
                    if (_criminals[i].IsDead)
                    {
                        _kills++;
                        SpookCriminal();
                        AddCash(20 * _level);
                        _criminals[i].MarkAsNoLongerNeeded();
                        _criminals.RemoveAt(i);
                        _criminalBlips[i].Remove();
                        _criminalBlips.RemoveAt(i);
                        if (_criminals.Count == 0)
                        {
                            _level++;
                            SpookCriminal();
                            //int secsadded = _rndGet.Next(60, 200);
                            //BigMessage.ShowMessage("~b~" + secsadded + " ~w~seconds added", 200, Color.White, 1.0f);
                            _seconds = 180;
                            UI.Notify("Good job officer! You've completed this level.");
                            StartMissions();
                        }
                    }
                    else
                    {
                        if (_criminals[i].IsInVehicle())
                        {
                            if (player.IsInVehicle())
                            {
                                if ((player.Position - _criminals[i].Position).Length() < 40.0f && (player.CurrentVehicle.SirenActive || _criminals[i].IsInCombat) && !_spotted)
                                {
                                    SpookCriminal(i);
                                }
                            }

                            if ((player.Position - _criminals[i].Position).Length() < 50.0f && _criminals[i].CurrentVehicle.Speed < 1.0f && _spotted)
                            {
                                if (!_fighting)
                                {
                                    _fighting = true;
                                    TaskSequence tasks = new TaskSequence();
                                    tasks.AddTask.LeaveVehicle();
                                    tasks.AddTask.FightAgainst(player, 100000);
                                    tasks.Close();
                                    _criminals[i].Task.PerformSequence(tasks);
                                }
                            }
                            else if (_fighting)
                            {
                                //this.Criminals[i].Task.ClearAll();
                                if (_criminals[i].IsInVehicle())
                                {
                                    _criminals[i].Task.CruiseWithVehicle(_criminals[i].CurrentVehicle, 60.0f, 6);
                                }
                                _fighting = false;
                            }
                        }
                        else
                        {
                            if ((player.Position - _criminals[i].Position).Length() < 60.0f)
                            {
                                if (!_fighting)
                                {
                                    _fighting = true;
                                    _criminals[i].Task.FightAgainst(player, 100000);
                                }
                            }
                            else
                            {
                                if (_fighting)
                                {
                                    TaskSequence tasks = new TaskSequence();
                                    tasks.AddTask.EnterVehicle();
                                    //tasks.AddTask.CruiseWithVehicle(this.Criminals[i].CurrentVehicle, 60.0f, 6);
                                    tasks.Close();
                                    _criminals[i].Task.PerformSequence(tasks);
                                    //this.Fighting = false;
                                }
                            }
                        }
                    }
                }
                if (player.IsDead)
                {
                    StopMissions();
                }
            }
        }
    }
Exemple #11
0
        /// <summary>
        /// This will fire at the targeted ped and will handle changing targets
        /// </summary>
        /// <param name="firstButton">The first (aiming) button which needs to pressed before handling this update</param>
        /// <param name="secondButton">The second (firing) button which needs to pressed before the actual shooting</param>
        private void UpdateCombat(Func <bool> firstButton, Func <bool> secondButton)
        {
            if (Input.isPressed(DeviceButton.DPadLeft))
            {
                foreach (WeaponHash projectile in throwables)
                {
                    Function.Call(Hash.EXPLODE_PROJECTILES, Ped, new InputArgument(projectile), true);
                }
            }
            if (firstButton.Invoke())
            {
                if (!secondButton.Invoke())
                {
                    Targets = GetTargets();
                }
                if (CanDoAction(PlayerPedAction.SelectTarget, 500))
                {
                    Direction dir = Input.GetDirection(DeviceButton.RightStick);
                    if (Input.IsDirectionLeft(dir))
                    {
                        TargetIndex--;
                        UpdateLastAction(PlayerPedAction.SelectTarget);
                    }
                    if (Input.IsDirectionRight(dir))
                    {
                        TargetIndex++;
                        UpdateLastAction(PlayerPedAction.SelectTarget);
                    }
                }

                Ped target = Targets.ElementAtOrDefault(TargetIndex);

                if (target == null)
                {
                    return;
                }

                if (!target.IsAlive)
                {
                    Targets = GetTargets();
                }

                if (target != null)
                {
                    World.DrawMarker(MarkerType.UpsideDownCone, target.GetBoneCoord(Bone.SKEL_Head) + new Vector3(0, 0, 1), GameplayCamera.Direction, GameplayCamera.Rotation, new Vector3(1, 1, 1), Color.OrangeRed);

                    if (secondButton.Invoke())
                    {
                        SelectWeapon(Ped, weapons[WeaponIndex]);

                        if (IsThrowable(weapons[WeaponIndex]))
                        {
                            if (CanDoAction(PlayerPedAction.ThrowTrowable, 1500))
                            {
                                Function.Call(Hash.TASK_THROW_PROJECTILE, Ped, target.Position.X, target.Position.Y, target.Position.Z);
                                UpdateLastAction(PlayerPedAction.ThrowTrowable);
                            }
                        }
                        else if (CanDoAction(PlayerPedAction.Shoot, 750))
                        {
                            if (Ped.IsInVehicle())
                            {
                                Function.Call(Hash.TASK_DRIVE_BY, Ped, target, 0, 0, 0, 0, 50.0f, 100, 1, (uint)FiringPattern.FullAuto);
                            }
                            else if (IsMelee(weapons[WeaponIndex]))
                            {
                                // Ped.Task.ShootAt(target, 750, FiringPattern.FullAuto);
                                // UI.ShowSubtitle("Melee weapons are not supported yet.");
                                Ped.Task.FightAgainst(target, -1);
                            }
                            else
                            {
                                Ped.Task.ShootAt(target, 750, FiringPattern.FullAuto);
                            }

                            UpdateLastAction(PlayerPedAction.Shoot);
                        }
                    }
                    else
                    {
                        Ped.Task.AimAt(target, 100);
                    }
                }

                if (Ped.IsOnScreen)
                {
                    Vector3 headPos = Ped.GetBoneCoord(Bone.SKEL_Head);
                    headPos.Z += 0.3f;
                    headPos.X += 0.1f;

                    UIRectangle rect = new UIRectangle(UI.WorldToScreen(headPos), new Size(MaxHealth / 2, 5), Color.LimeGreen);
                    rect.Draw();
                    rect.Size  = new Size(Ped.Health / 2, 5);
                    rect.Color = Color.IndianRed;
                    rect.Draw();
                }
            }
            else
            {
                TargetIndex = 0;
            }
        }
        public static void DrawHUD(Color color)
        {
            var location = new Point(UI.WIDTH / 3, UI.HEIGHT - UI.HEIGHT / 4);
            var rect     = new UIRectangle(new Point(location.X - 30, location.Y), new Size(5, 65));

            rect.Color = color;
            rect.Draw();
            rect       = new UIRectangle(new Point(location.X - 30, location.Y + 60), new Size(65, 5));
            rect.Color = color;
            rect.Draw();
            location   = new Point(UI.WIDTH / 3, UI.HEIGHT / 4);
            rect       = new UIRectangle(new Point(location.X - 30, location.Y), new Size(5, 67));
            rect.Color = color;
            rect.Draw();
            rect       = new UIRectangle(new Point(location.X - 30, location.Y), new Size(65, 5));
            rect.Color = color;
            rect.Draw();
            location   = new Point(UI.WIDTH - UI.WIDTH / 3, UI.HEIGHT / 4);
            rect       = new UIRectangle(new Point(location.X + 30, location.Y), new Size(5, 65));
            rect.Color = color;
            rect.Draw();
            rect       = new UIRectangle(new Point(location.X - 30, location.Y), new Size(65, 5));
            rect.Color = color;
            rect.Draw();
            location   = new Point(UI.WIDTH - UI.WIDTH / 3, UI.HEIGHT - UI.HEIGHT / 4);
            rect       = new UIRectangle(new Point(location.X + 30, location.Y), new Size(5, 65));
            rect.Color = color;
            rect.Draw();
            rect       = new UIRectangle(new Point(location.X - 30, location.Y + 60), new Size(65, 5));
            rect.Color = color;
            rect.Draw();
            location   = new Point(UI.WIDTH / 2, UI.HEIGHT / 2);
            rect       = new UIRectangle(new Point(location.X - 40, location.Y), new Size(5, 65));
            rect.Color = color;
            rect.Draw();
            rect       = new UIRectangle(new Point(location.X - 40, location.Y), new Size(80, 5));
            rect.Color = color;
            rect.Draw();
            rect       = new UIRectangle(new Point(location.X + 40, location.Y), new Size(5, 65));
            rect.Color = color;
            rect.Draw();
            rect       = new UIRectangle(new Point(location.X - 40, location.Y + 60), new Size(80, 5));
            rect.Color = color;
            rect.Draw();
            rect       = new UIRectangle(new Point(location.X - 120, location.Y + 30), new Size(80, 2));
            rect.Color = color;
            rect.Draw();
            rect       = new UIRectangle(new Point(location.X - 120, location.Y + 30), new Size(80, 2));
            rect.Color = color;
            rect.Draw();
            rect       = new UIRectangle(new Point(location.X + 45, location.Y + 30), new Size(80, 2));
            rect.Color = color;
            rect.Draw();
            rect       = new UIRectangle(new Point(location.X + 45, location.Y + 30), new Size(80, 2));
            rect.Color = color;
            rect.Draw();
            rect       = new UIRectangle(new Point(location.X, location.Y + 60), new Size(2, 80));
            rect.Color = color;
            rect.Draw();
            rect       = new UIRectangle(new Point(location.X, location.Y - 75), new Size(2, 80));
            rect.Color = color;
            rect.Draw();
        }
    void Ontick(object sender, EventArgs e)
    {
        //  prisoner groupe   2124571506
        //  garde    groupe   -183807561
        //  police   groupe   -1533126372



        // SOLARITe  1651,726 : 2568,254 : 51,51672 :=> 348,7881

        // 1   1858,746 : 2609,113 : 45,29342
        // 2   1831,064 : 2607,884 : 45,20006
        // 3   1754,864 : 2605,129 : 45,18484

        if (Function.Call <bool>(Hash.IS_PLAYER_BEING_ARRESTED, Game.Player, true))
        {
            hours = 20;
            intial1();
        }



        #region escape
        if (escape)
        {
            roit.Remove();
            Function.Call(Hash.TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME, "respawn_controller");
            Function.Call(Hash.TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME, "re_prison");

            if (Game.Player.Character.IsInVehicle())
            {
                if (Game.Player.Character.CurrentVehicle == help_veh)
                {
                    bail.Remove();

                    if (Game.Player.WantedLevel == 0)
                    {
                        GTA.UI.ShowSubtitle("you have escape", 1000);
                        escape = false;
                        escape_Ped.MarkAsNoLongerNeeded();
                        help_veh.MarkAsNoLongerNeeded();
                        arrested = false;
                    }
                    else
                    {
                        GTA.UI.ShowSubtitle("escape the police", 10);
                    }
                }
                else
                {
                    GTA.UI.ShowSubtitle("get to the ~b~ MAVERICK", 10);
                    bail.Remove();
                    bail           = World.CreateBlip(help_veh.Position);
                    bail.Color     = BlipColor.Blue;
                    bail.ShowRoute = true;
                }
            }
            else
            {
                GTA.UI.ShowSubtitle("get to the ~b~ MAVERICK", 10);
                bail.Remove();
                bail           = World.CreateBlip(help_veh.Position);
                bail.Color     = BlipColor.Blue;
                bail.ShowRoute = true;
            }

            if (Game.Player.IsDead)
            {
                escape   = false;
                arrested = false;
                bail.Remove();
                help_veh.MarkAsNoLongerNeeded();
            }
        }
        #endregion
        //=================================================================================================================================================

        if (arrested)
        {
            Function.Call(Hash.TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME, "respawn_controller");
            Function.Call(Hash.TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME, "re_prison");
        }
        if (inprison)
        {
            Function.Call(Hash.TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME, "respawn_controller");
            Function.Call(Hash.TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME, "re_prison");
            if (Game.Player.Character.Position.DistanceTo(new Vector3(1752.894f, 2592.242f, 45.56502f)) < 1f)
            {
                arrested = true;
                escape   = false;
                Function.Call(Hash.ENABLE_ALL_CONTROL_ACTIONS, 1);
                Game.FadeScreenOut(2500);
                Game.Player.Character.Position = new Vector3(1617.643f, 2523.981f, 45.56489f);
                clothes_changer();
                Game.Player.CanControlCharacter = true;
                Function.Call(Hash.SET_ENABLE_HANDCUFFS, Game.Player.Character, false);
                Function.Call(Hash.SET_ENABLE_BOUND_ANKLES, Game.Player.Character, false);
                Game.FadeScreenIn(2500);


                int group        = 2124571506;
                int player_group = Function.Call <int>(Hash.GET_PED_RELATIONSHIP_GROUP_HASH, Game.Player.Character);


                Function.Call(Hash.CLEAR_RELATIONSHIP_BETWEEN_GROUPS, (int)Relationship.Pedestrians, group, player_group);
                Function.Call(Hash.CLEAR_RELATIONSHIP_BETWEEN_GROUPS, (int)Relationship.Pedestrians, player_group, group);

                Function.Call(Hash.SET_RELATIONSHIP_BETWEEN_GROUPS, 1, group, player_group);


                bail       = World.CreateBlip(new Vector3(1691.709f, 2565.036f, 45.56487f));
                bail.Color = BlipColor.White;
                Function.Call(Hash.SET_CLOCK_TIME, 13, 00, 0);

                roit        = World.CreateBlip(escape_Ped.Position);
                roit.Sprite = BlipSprite.DollarSign;


                _headsup = new UIText("Time: ~b~" + hours + ":" + minit, new Point(2, 520), 0.7f, Color.WhiteSmoke, GTA.Font.HouseScript, false);

                _headsupRectangle = new UIRectangle(new Point(0, 520), new Size(215, 65), Color.FromArgb(100, 0, 0, 0));

                inprison = false;
            }



            if (Game.Player.Character.Position.DistanceTo(new Vector3(1754.864f, 2605.129f, 45.18484f)) < 5f)
            {
                Game.Player.Character.Task.GoTo(new Vector3(1752.894f, 2592.242f, 45.56502f));
            }
        }
        if (testt)
        {
            Function.Call(Hash.DISABLE_ALL_CONTROL_ACTIONS, 1);
            if (open1)
            {
                int t = Function.Call <int>(Hash.GET_HASH_KEY, "prop_gate_prison_01");
                Function.Call(Hash._0x9B12F9A24FABEDB0, t, 1845.0f, 2605.0f, 45.0f, 0, 0.0f, 50.0f, 0f);
            }
            else
            {
                int t = Function.Call <int>(Hash.GET_HASH_KEY, "prop_gate_prison_01");
                Function.Call(Hash._0x9B12F9A24FABEDB0, t, 1845.0f, 2605.0f, 45.0f, 1, 0.0f, 50.0f, 0f);
            }
            if (open2)
            {
                int t = Function.Call <int>(Hash.GET_HASH_KEY, "prop_gate_prison_01");
                Function.Call(Hash._0x9B12F9A24FABEDB0, t, 1819.27f, 2608.53f, 44.61f, 0, 0.0f, 50.0f, 0f);
            }
            else
            {
                int t = Function.Call <int>(Hash.GET_HASH_KEY, "prop_gate_prison_01");
                Function.Call(Hash._0x9B12F9A24FABEDB0, t, 1819.27f, 2608.53f, 44.61f, 1, 0.0f, 50.0f, 0f);
            }



            if (Game.Player.Character.Position.DistanceTo(new Vector3(1855.855f, 2606.756f, 45.9304f)) < 4f)
            {
                open1 = true;
                open2 = false;
            }

            if (Game.Player.Character.Position.DistanceTo(new Vector3(1831.152f, 2606.738f, 45.83254f)) < 3f && open1)
            {
                open1 = false;
                open2 = true;
                Game.Player.WantedLevel = 0;
                Function.Call(Hash.SET_MAX_WANTED_LEVEL, 0);
            }
            if (Game.Player.Character.Position.DistanceTo(new Vector3(1754.018f, 2604.271f, 45.82404f)) < 4f && open2)
            {
                open1 = false;
                open2 = false;
                testt = false;
                Game.Player.WantedLevel = 0;
                Function.Call(Hash.SET_MAX_WANTED_LEVEL, 0);
                inprison = true;
            }

            Function.Call(Hash.TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME, "respawn_controller");
            Function.Call(Hash.TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME, "re_prison");
        }


        if (arrested)
        {
            if (Game.Player.Character.IsDead)
            {
                Function.Call(Hash.SET_MAX_WANTED_LEVEL, 5);
            }

            Function.Call(Hash.SET_MAX_WANTED_LEVEL, 0);

            Function.Call(Hash.TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME, "respawn_controller");
            Function.Call(Hash.TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME, "re_prison");
            Function.Call(Hash.STOP_ALARM, "PRISON_ALARMS", 0);
            Function.Call(Hash.CLEAR_AMBIENT_ZONE_STATE, "AZ_COUNTRYSIDE_PRISON_01_ANNOUNCER_GENERAL", 0);
            Function.Call(Hash.CLEAR_AMBIENT_ZONE_STATE, "AZ_COUNTRYSIDE_PRISON_01_ANNOUNCER_WARNING", 0);



            int hh = Function.Call <int>(Hash.GET_CLOCK_HOURS);
            int mm = Function.Call <int>(Hash.GET_CLOCK_MINUTES);

            if (hh == 14 && mm == 0)
            {
                Function.Call(Hash.SET_CLOCK_TIME, 13, 00, 0);
            }
            if (mm == 0 && !hhh)
            {
                minit  = 00;
                hours -= 1;
                hhh    = true;
            }
            else if (mm > 0)
            {
                minit = 60 - mm;
                hhh   = false;
            }

            test = World.GetNearbyPeds(Game.Player.Character, 150f);
            Function.Call(Hash.TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME, "respawn_controller");
            Function.Call(Hash.TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME, "re_prison");

            for (int i = 0; i < test.Length; i++)
            {
                Function.Call(Hash.TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME, "respawn_controller");
                Function.Call(Hash.TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME, "re_prison");

                if (Function.Call <int>(Hash.GET_PED_RELATIONSHIP_GROUP_HASH, test[i]) == 2124571506 || Function.Call <int>(Hash.GET_PED_RELATIONSHIP_GROUP_HASH, test[i]) == -86095805)
                {
                    bool trouve = false;
                    for (int m = 0; m < prisoner.Count; m++)
                    {
                        if (prisoner[m] == test[i])
                        {
                            trouve = true;
                            break;
                        }
                    }

                    if (!trouve)
                    {
                        prisoner.Add(test[i]);
                    }
                }
                else if (Function.Call <int>(Hash.GET_PED_RELATIONSHIP_GROUP_HASH, test[i]) == -183807561)
                {
                    bool trouve = false;
                    for (int m = 0; m < garde.Count; m++)
                    {
                        if (garde[m] == test[i])
                        {
                            trouve = true;
                            break;
                        }
                    }
                    if (!trouve)
                    {
                        garde.Add(test[i]);
                    }
                }
                Ped[] test2 = World.GetNearbyPeds(test[i], 150f);

                for (int j = 0; j < test2.Length; j++)
                {
                    Function.Call(Hash.TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME, "respawn_controller");
                    Function.Call(Hash.TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME, "re_prison");

                    if (Function.Call <int>(Hash.GET_PED_RELATIONSHIP_GROUP_HASH, test2[j]) == 2124571506 || Function.Call <int>(Hash.GET_PED_RELATIONSHIP_GROUP_HASH, test2[j]) == -86095805)
                    {
                        bool trouve = false;
                        for (int m = 0; m < prisoner.Count; m++)
                        {
                            if (prisoner[m] == test2[j])
                            {
                                trouve = true;
                                break;
                            }
                        }

                        if (!trouve)
                        {
                            prisoner.Add(test2[j]);
                        }
                    }
                    else if (Function.Call <int>(Hash.GET_PED_RELATIONSHIP_GROUP_HASH, test2[j]) == -183807561)
                    {
                        bool trouve = false;
                        for (int m = 0; m < garde.Count; m++)
                        {
                            if (garde[m] == test2[j])
                            {
                                trouve = true;
                                break;
                            }
                        }
                        if (!trouve)
                        {
                            garde.Add(test2[j]);
                        }
                    }
                }
            }
            //===================================================================================================



            Function.Call(Hash.TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME, "respawn_controller");
            Function.Call(Hash.TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME, "re_prison");


            _headsup = new UIText("Time: ~b~" + hours + ":" + minit, new Point(2, 520), 0.7f, Color.WhiteSmoke, GTA.Font.ChaletComprimeCologne, false);

            _headsupRectangle = new UIRectangle(new Point(0, 520), new Size(215, 65), Color.FromArgb(100, 0, 0, 0));

            _headsup.Draw();
            _headsupRectangle.Draw();

            if (Game.Player.Character.Position.DistanceTo(new Vector3(1691.709f, 2565.036f, 45.56487f)) < 2f)
            {
                GTA.UI.Notify("press [E] to bail : ~g~ " + 5000000 + "~w~$");
            }
            else if (Game.Player.Character.Position.DistanceTo(new Vector3(1625.474f, 2491.485f, 45.62026f)) < 4f)
            {
                GTA.UI.Notify("press [E] to escape for : ~g~ " + 5000000 + "~w~$");

                GTA.UI.Notify("press [Y] to make roit for : ~g~ " + 5000000 + "~w~$");
            }


            if (hours == 0 && minit == 0)
            {
                bail.Remove();
                Game.Player.Character.Position = new Vector3(1849.555f, 2586.085f, 45.67202f);
                Game.Player.Character.Heading  = 258.4564f;

                Function.Call(Hash.SET_MAX_WANTED_LEVEL, 5);

                Function.Call(Hash.PAUSE_CLOCK, false);
                arrested          = false;
                _headsup          = null;
                _headsupRectangle = null;
            }
        }
    }
    void Ontick(object sender, EventArgs e)
    {
        //  prisoner groupe   2124571506
        //  garde    groupe   -183807561
        //  police   groupe   -1533126372

        // SOLARITe  1651,726 : 2568,254 : 51,51672 :=> 348,7881

        // 1   1858,746 : 2609,113 : 45,29342
        // 2   1831,064 : 2607,884 : 45,20006
        // 3   1754,864 : 2605,129 : 45,18484

        if (Function.Call<bool>(Hash.IS_PLAYER_BEING_ARRESTED, Game.Player, true))
        {
            hours = 20;
            intial1();
        }

        #region escape
        if (escape)
        {
            roit.Remove();
                Function.Call(Hash.TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME, "respawn_controller");
                Function.Call(Hash.TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME, "re_prison");

                if (Game.Player.Character.IsInVehicle())
                {
                    if (Game.Player.Character.CurrentVehicle == help_veh)
                    {
                        bail.Remove();

                        if (Game.Player.WantedLevel == 0)
                        {
                            GTA.UI.ShowSubtitle("you have escape", 1000);
                            escape = false;
                            escape_Ped.MarkAsNoLongerNeeded();
                            help_veh.MarkAsNoLongerNeeded();
                            arrested = false;
                        }
                        else
                            GTA.UI.ShowSubtitle("escape the police", 10);
                    }
                    else
                    {
                        GTA.UI.ShowSubtitle("get to the ~b~ MAVERICK", 10);
                        bail.Remove();
                        bail = World.CreateBlip(help_veh.Position);
                        bail.Color = BlipColor.Blue;
                        bail.ShowRoute = true;
                    }
                }
                else
                {
                    GTA.UI.ShowSubtitle("get to the ~b~ MAVERICK", 10);
                    bail.Remove();
                    bail = World.CreateBlip(help_veh.Position);
                    bail.Color = BlipColor.Blue;
                    bail.ShowRoute = true;
                }

            if (Game.Player.IsDead)
            {
                escape = false;
                arrested = false;
                bail.Remove();
                help_veh.MarkAsNoLongerNeeded();
            }
        }
        #endregion
        //=================================================================================================================================================

        if (arrested)
        {
            Function.Call(Hash.TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME, "respawn_controller");
            Function.Call(Hash.TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME, "re_prison");
        }
        if (inprison)
        {

            Function.Call(Hash.TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME, "respawn_controller");
            Function.Call(Hash.TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME, "re_prison");
            if (Game.Player.Character.Position.DistanceTo(new Vector3(1752.894f, 2592.242f, 45.56502f)) < 1f)
            {
                arrested = true;
                escape = false;
                Function.Call(Hash.ENABLE_ALL_CONTROL_ACTIONS, 1);
                Game.FadeScreenOut(2500);
                Game.Player.Character.Position = new Vector3(1617.643f, 2523.981f, 45.56489f);
                clothes_changer();
                Game.Player.CanControlCharacter = true;
                Function.Call(Hash.SET_ENABLE_HANDCUFFS, Game.Player.Character, false);
                Function.Call(Hash.SET_ENABLE_BOUND_ANKLES, Game.Player.Character, false);
                Game.FadeScreenIn(2500);

                int group = 2124571506;
                int player_group = Function.Call<int>(Hash.GET_PED_RELATIONSHIP_GROUP_HASH, Game.Player.Character);

                Function.Call(Hash.CLEAR_RELATIONSHIP_BETWEEN_GROUPS, (int)Relationship.Pedestrians, group, player_group);
                Function.Call(Hash.CLEAR_RELATIONSHIP_BETWEEN_GROUPS, (int)Relationship.Pedestrians, player_group, group);

                Function.Call(Hash.SET_RELATIONSHIP_BETWEEN_GROUPS, 1, group, player_group);

                bail = World.CreateBlip(new Vector3(1691.709f, 2565.036f, 45.56487f));
                bail.Color = BlipColor.White;
                Function.Call(Hash.SET_CLOCK_TIME, 13, 00, 0);

                roit = World.CreateBlip(escape_Ped.Position);
                roit.Sprite = BlipSprite.DollarSign;

                _headsup = new UIText("Time: ~b~" + hours + ":" + minit, new Point(2, 520), 0.7f, Color.WhiteSmoke, GTA.Font.HouseScript, false);

                _headsupRectangle = new UIRectangle(new Point(0, 520), new Size(215, 65), Color.FromArgb(100, 0, 0, 0));

                inprison = false;
            }

            if (Game.Player.Character.Position.DistanceTo(new Vector3(1754.864f, 2605.129f, 45.18484f)) < 5f)
            {
                Game.Player.Character.Task.GoTo(new Vector3(1752.894f, 2592.242f, 45.56502f));
            }
        }
        if (testt)
        {
            Function.Call(Hash.DISABLE_ALL_CONTROL_ACTIONS, 1);
            if (open1)
            {
                int t = Function.Call<int>(Hash.GET_HASH_KEY, "prop_gate_prison_01");
                Function.Call(Hash._0x9B12F9A24FABEDB0, t, 1845.0f, 2605.0f, 45.0f, 0, 0.0f, 50.0f, 0f);
            }
            else
            {
                int t = Function.Call<int>(Hash.GET_HASH_KEY, "prop_gate_prison_01");
                Function.Call(Hash._0x9B12F9A24FABEDB0, t, 1845.0f, 2605.0f, 45.0f, 1, 0.0f, 50.0f, 0f);
            }
            if (open2)
            {
                int t = Function.Call<int>(Hash.GET_HASH_KEY, "prop_gate_prison_01");
                Function.Call(Hash._0x9B12F9A24FABEDB0, t, 1819.27f, 2608.53f, 44.61f, 0, 0.0f, 50.0f, 0f);
            }
            else
            {
                int t = Function.Call<int>(Hash.GET_HASH_KEY, "prop_gate_prison_01");
                Function.Call(Hash._0x9B12F9A24FABEDB0, t, 1819.27f, 2608.53f, 44.61f, 1, 0.0f, 50.0f, 0f);
            }

            if (Game.Player.Character.Position.DistanceTo(new Vector3(1855.855f, 2606.756f, 45.9304f)) < 4f)
            {
                open1 = true;
                open2 = false;
            }

            if (Game.Player.Character.Position.DistanceTo(new Vector3(1831.152f, 2606.738f, 45.83254f)) < 3f && open1)
            {
                open1 = false;
                open2 = true;
                Game.Player.WantedLevel = 0;
                Function.Call(Hash.SET_MAX_WANTED_LEVEL, 0);
            }
            if (Game.Player.Character.Position.DistanceTo(new Vector3(1754.018f, 2604.271f, 45.82404f)) < 4f  && open2)
            {
                open1 = false;
                open2 = false;
                testt = false;
                Game.Player.WantedLevel = 0;
                Function.Call(Hash.SET_MAX_WANTED_LEVEL, 0);
                inprison = true;

            }

            Function.Call(Hash.TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME, "respawn_controller");
            Function.Call(Hash.TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME, "re_prison");

        }

        if (arrested)
        {

            if (Game.Player.Character.IsDead)
                Function.Call(Hash.SET_MAX_WANTED_LEVEL, 5);

            Function.Call(Hash.SET_MAX_WANTED_LEVEL, 0);

            Function.Call(Hash.TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME, "respawn_controller");
            Function.Call(Hash.TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME, "re_prison");
            Function.Call(Hash.STOP_ALARM, "PRISON_ALARMS", 0);
            Function.Call(Hash.CLEAR_AMBIENT_ZONE_STATE, "AZ_COUNTRYSIDE_PRISON_01_ANNOUNCER_GENERAL", 0);
            Function.Call(Hash.CLEAR_AMBIENT_ZONE_STATE, "AZ_COUNTRYSIDE_PRISON_01_ANNOUNCER_WARNING", 0);

                int hh = Function.Call<int>(Hash.GET_CLOCK_HOURS);
                int mm = Function.Call<int>(Hash.GET_CLOCK_MINUTES);

                if (hh == 14 && mm == 0)
                {
                    Function.Call(Hash.SET_CLOCK_TIME, 13, 00, 0);
                }
                if (mm == 0 && !hhh )
                {
                    minit = 00;
                    hours -= 1;
                    hhh = true;
                }
                else if (mm>0)
                {
                    minit = 60 - mm;
                    hhh = false;
                }

                test = World.GetNearbyPeds(Game.Player.Character,150f);
                Function.Call(Hash.TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME, "respawn_controller");
                Function.Call(Hash.TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME, "re_prison");

                for (int i = 0; i < test.Length; i++)
                {

                    Function.Call(Hash.TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME, "respawn_controller");
                    Function.Call(Hash.TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME, "re_prison");

                    if (Function.Call<int>(Hash.GET_PED_RELATIONSHIP_GROUP_HASH, test[i]) == 2124571506 || Function.Call<int>(Hash.GET_PED_RELATIONSHIP_GROUP_HASH, test[i]) == -86095805)
                    {
                        bool trouve = false;
                        for (int m = 0; m < prisoner.Count; m++)
                            if (prisoner[m] == test[i])
                            {
                                trouve = true;
                                break;
                            }

                        if (!trouve)
                            prisoner.Add(test[i]);

                    }
                    else if (Function.Call<int>(Hash.GET_PED_RELATIONSHIP_GROUP_HASH, test[i]) == -183807561)
                    {

                        bool trouve = false;
                        for (int m = 0; m < garde.Count; m++)
                            if (garde[m] == test[i])
                            {
                                trouve = true;
                                break;
                            }
                        if (!trouve)
                            garde.Add(test[i]);

                    }
                    Ped[] test2 = World.GetNearbyPeds(test[i], 150f);

                    for (int j = 0 ;j<test2.Length;j++)
                    {
                        Function.Call(Hash.TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME, "respawn_controller");
                        Function.Call(Hash.TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME, "re_prison");

                        if (Function.Call<int>(Hash.GET_PED_RELATIONSHIP_GROUP_HASH, test2[j]) == 2124571506 || Function.Call<int>(Hash.GET_PED_RELATIONSHIP_GROUP_HASH, test2[j]) == -86095805)
                        {
                            bool trouve = false;
                            for (int m = 0; m < prisoner.Count; m++)
                                if (prisoner[m] == test2[j])
                                {
                                    trouve = true;
                                    break;
                                }

                            if (!trouve)
                                prisoner.Add(test2[j]);

                        }
                        else if (Function.Call<int>(Hash.GET_PED_RELATIONSHIP_GROUP_HASH, test2[j]) == -183807561)
                        {

                            bool trouve = false;
                            for (int m = 0; m < garde.Count; m++)
                                if (garde[m] == test2[j])
                                {
                                    trouve = true;
                                    break;
                                }
                            if (!trouve)
                                garde.Add(test2[j]);

                        }
                    }
                }
                //===================================================================================================

                Function.Call(Hash.TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME, "respawn_controller");
                Function.Call(Hash.TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME, "re_prison");

                _headsup = new UIText("Time: ~b~" + hours + ":" + minit, new Point(2, 520), 0.7f, Color.WhiteSmoke, GTA.Font.ChaletComprimeCologne, false);

                _headsupRectangle = new UIRectangle(new Point(0, 520), new Size(215, 65), Color.FromArgb(100, 0, 0, 0));

                _headsup.Draw();
                _headsupRectangle.Draw();

                if (Game.Player.Character.Position.DistanceTo(new Vector3(1691.709f, 2565.036f, 45.56487f)) < 2f)
                    {
                        GTA.UI.Notify("press [E] to bail : ~g~ " + 5000000 + "~w~$");
                    }
                else if (Game.Player.Character.Position.DistanceTo(new Vector3(1625.474f, 2491.485f, 45.62026f)) < 4f)
                {
                    GTA.UI.Notify("press [E] to escape for : ~g~ " + 5000000 + "~w~$");

                    GTA.UI.Notify("press [Y] to make roit for : ~g~ " + 5000000 + "~w~$");
                }

            if( hours == 0 && minit == 0)
            {
                bail.Remove();
                Game.Player.Character.Position = new Vector3(1849.555f, 2586.085f, 45.67202f);
                Game.Player.Character.Heading = 258.4564f;

                Function.Call(Hash.SET_MAX_WANTED_LEVEL, 5);

                Function.Call(Hash.PAUSE_CLOCK, false);
                arrested = false;
                _headsup = null;
                _headsupRectangle = null;
            }

        }
    }
    void intial()
    {
        Game.Player.WantedLevel = 0;
        Game.Player.Character.Weapons.RemoveAll();

        Function.Call(Hash.CLEAR_RELATIONSHIP_BETWEEN_GROUPS, (int)Relationship.Hate, 2124571506, -183807561);
        Function.Call(Hash.CLEAR_RELATIONSHIP_BETWEEN_GROUPS, (int)Relationship.Hate, -183807561, 2124571506);

        Function.Call(Hash.SET_RELATIONSHIP_BETWEEN_GROUPS, (int)Relationship.Pedestrians, 2124571506, -183807561);
        Function.Call(Hash.SET_RELATIONSHIP_BETWEEN_GROUPS, (int)Relationship.Pedestrians, -183807561, 2124571506);

        escape_Ped = World.CreatePed(PedHash.Prisoner01, new Vector3(1625.474f, 2491.485f, 45.62026f));
        escape_Ped.Task.StandStill(-1);
        escape_Ped.Heading = 320.5151f;

        Function.Call(Hash.SET_ENTITY_AS_MISSION_ENTITY, escape_Ped, true, true);

        Game.Player.WantedLevel = 0;
        Function.Call(Hash.SET_MAX_WANTED_LEVEL, 0);

        Game.Player.Character.Task.PlayAnimation("RANDOM@ARRESTS", "idle_2_hands_up", 2f, -1, false, 0);
        Script.Wait(500);
        Game.FadeScreenIn(2500);
        //   while (Function.Call<bool>(Hash.IS_ENTITY_PLAYING_ANIM, Game.Player.Character, "RANDOM@ARRESTS", "idle_2_hands_up", 3)) Script.Wait(0);
        while (!Function.Call<bool>(Hash.IS_SCREEN_FADED_OUT)) Script.Wait(0);

        Game.FadeScreenIn(0);

        int group = 2124571506;
        int player_group = Function.Call<int>(Hash.GET_PED_RELATIONSHIP_GROUP_HASH, Game.Player.Character);

        Function.Call(Hash.CLEAR_RELATIONSHIP_BETWEEN_GROUPS, (int)Relationship.Pedestrians, group, player_group);
        Function.Call(Hash.CLEAR_RELATIONSHIP_BETWEEN_GROUPS, (int)Relationship.Pedestrians, player_group, group);

        Function.Call(Hash.SET_RELATIONSHIP_BETWEEN_GROUPS, 1, group, player_group);
        //     Function.Call(Hash.SET_RELATIONSHIP_BETWEEN_GROUPS, 1, player_group, group);

        //   Function.Call(Hash.CLEAR_AREA_OF_PEDS, 1637.856f, 2608.986f, 45.56487f, 1000f, true);

        clothes_changer();

        bail = World.CreateBlip(new Vector3(1691.709f, 2565.036f, 45.56487f));
        bail.Color = BlipColor.White;
        Function.Call(Hash.SET_CLOCK_TIME, 13, 00, 0);

        roit = World.CreateBlip(escape_Ped.Position);
        roit.Sprite = BlipSprite.DollarSign;

        _headsup = new UIText("Time: ~b~" + hours + ":" + minit, new Point(2, 520), 0.7f, Color.WhiteSmoke, GTA.Font.HouseScript, false);

        _headsupRectangle = new UIRectangle(new Point(0, 520), new Size(215, 65), Color.FromArgb(100, 0, 0, 0));

        _headsup.Draw();
        _headsupRectangle.Draw();

        arrested = true;
        escape = false;
        Game.Player.Character.Position = new Vector3(1617.643f, 2523.981f, 45.56489f);
        Game.FadeScreenOut(1);
        Function.Call(Hash.TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME, "respawn_controller");
        Function.Call(Hash.TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME, "re_prison");
        Game.Player.Character.Heading = 264.718f;
        Game.FadeScreenOut(0);
        Function.Call(Hash.TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME, "respawn_controller");
        Function.Call(Hash.TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME, "re_prison");
        Game.FadeScreenIn(3000);
    }
    void OnTick(object sender, EventArgs e)
    {
        if (_ticks >= _timer)
        {
            _ticks       = 0;
            _showMessage = false;
        }
        if (_showMessage)
        {
            _bigmessage.Draw();
            _ticks += 1;
        }
        Ped player = Game.Player.Character;


        if (_victimPed != null && _onAmbulanceMission)
        {
            if (_victimPed.Health <= 20 && !_critical && !_victimPed.IsInVehicle() && !_cprBeingApplied)
            {
                _critical = true;
                UI.Notify("The ~g~patient~w~ is in critical condition! You will have to CPR him.");
                _victimPed.Task.PlayAnimation("mini@cpr@char_b@cpr_def", "cpr_pumpchest_idle", 8f, -1, true, 8f);
            }

            if (player.IsInRangeOf(_victimPed.Position, 2f) && _critical && !_cprBeingApplied)
            {
                _critical        = false;
                _cprBeingApplied = true;
                EngageCPR(player, _victimPed);
            }
            if (_cprBeingApplied)
            {
                int prog = _victimPed.TaskSequenceProgress;
                if (prog == 2)
                {
                    if (_reanimationFailed)
                    {
                        _cprBeingApplied       = false;
                        _victimPed.Health      = -1;
                        _cprAppliedThisMission = true;
                    }
                    else
                    {
                        _cprBeingApplied       = false;
                        _victimPed.Health      = 30;
                        _cprAppliedThisMission = true;
                    }
                }
            }
        }

        if (_victimPed != null && _onAmbulanceMission && player.IsInVehicle())
        {
            _headsup.Caption  = "Level: ~b~" + _level;
            _headsup.Caption += "~w~\nPatient Health: ~b~" + _victimPed.Health + "%~w~";
            _headsup.Draw();
            _headsupRectangle.Draw();
            if (_secondTicks >= 100)
            {
                _secondTicks = 0;
                if (_victimPed.IsInVehicle(player.CurrentVehicle))
                {
                    if (player.CurrentVehicle.Health < _baseDamage)
                    {
                        _victimPed.Health -= _rnd.Next(1, 6);
                        _baseDamage        = player.CurrentVehicle.Health;
                    }
                }
                else
                {
                    if (_rnd.Next(0, 101) <= 70 && !_cprBeingApplied && !_cprAppliedThisMission)
                    {
                        _victimPed.Health -= _rnd.Next(1, 3);
                    }
                }
            }
            if (_victimPed.Health <= 0)
            {
                _timer = 200;
                _bigmessage.Caption = "Patient dead";
                _bigmessage.Color   = Color.DarkRed;
                _showMessage        = true;
                _victimPed.Kill();
                StopAmbulanceMissions();
            }
            if ((_victimPed.Position - player.Position).Length() < 15.0f && player.IsInVehicle() && !_victimPed.IsInVehicle() && !_victimPed.IsGettingIntoAVehicle && _missionState <= 2 && !_critical && !_cprBeingApplied)
            {
                _victimPed.Task.EnterVehicle(player.CurrentVehicle, VehicleSeat.RightRear);
                UI.ShowSubtitle("");
                _baseDamage = player.CurrentVehicle.Health;
            }
            if (player.IsInVehicle() && _victimPed.IsInVehicle(player.CurrentVehicle) && _missionState == 1)
            {
                _missionState = 2;
                UI.ShowSubtitle("Go to the ~b~hospital~w~.", 9999999);
                Vector3 tmpCoords = GetClosestHospital();
                if (_blip.Exists())
                {
                    _blip.Remove();
                }

                _blip           = World.CreateBlip(tmpCoords);
                _blip.Color     = BlipColor.Blue;
                _blip.ShowRoute = true;

                if (_oldVictim != null)
                {
                    _oldVictim.MarkAsNoLongerNeeded();
                }
                //this.blip = GTA.Native.Function.Call<int>(GTA.Native.Hash.ADD_BLIP_FOR_COORD, tmpCoords.X, tmpCoords.Y, tmpCoords.Z);
                //GTA.Native.Function.Call(GTA.Native.Hash.SET_BLIP_COLOUR, this.blip, 3);
                //GTA.Native.Function.Call(GTA.Native.Hash.SET_BLIP_ROUTE, this.blip, true);
            }

            float threshold = (_airMission ? 5.0f : 10.0f);

            if (_missionState == 2 && (GetClosestHospital() - player.Position).Length() < threshold && _victimPed.IsInVehicle(player.CurrentVehicle))
            {
                _missionState = 3;
                _oldVictim    = _victimPed;
                _oldVictim.Task.LeaveVehicle();
                _oldVictim.Task.GoTo(GetClosestEntrance());

                _blip.ShowRoute = false;
                _blip.Remove();

                _bigmessage.Caption = "Rewarded ~b~" + ((_level * PayoutMultiplier) + (_level * _victimPed.Health)) + "~w~ Dollars";
                _timer            = 200;
                _bigmessage.Color = Color.WhiteSmoke;
                _bigmessage.Scale = 1.1f;
                _showMessage      = true;
                AddCash((_level * PayoutMultiplier) + (_level * _victimPed.Health));
                _level++;
                //this.victimPed.MarkAsNoLongerNeeded();

                StartAmbulanceMissions();
            }

            _secondTicks++;
        }
        else if (_victimPed != null && _onAmbulanceMission && !player.IsInVehicle())
        {
            _headsup.Caption  = "Level: ~b~" + _level;
            _headsup.Caption += "\n~w~Patient Health: ~b~" + _victimPed.Health + "%~w~";
            _headsup.Draw();
            _headsupRectangle.Draw();
            if (_secondTicks >= 50)
            {
                _secondTicks = 0;
                if (_victimPed.IsInVehicle())
                {
                    if (_victimPed.CurrentVehicle.Health < _baseDamage)
                    {
                        _victimPed.Health -= _rnd.Next(1, 6);
                        _baseDamage        = _victimPed.CurrentVehicle.Health;
                    }
                }
                else
                {
                    if (_rnd.Next(0, 101) <= 50 && !_cprBeingApplied && !_cprAppliedThisMission)
                    {
                        _victimPed.Health -= _rnd.Next(1, 3);
                    }
                }
            }
            if (_victimPed.Health <= 0)
            {
                _timer = 200;
                _bigmessage.Caption = "Patient dead";
                _bigmessage.Color   = Color.DarkRed;
                _showMessage        = true;

                StopAmbulanceMissions();
            }
            _secondTicks++;
        }
        if (player.Health <= 0)
        {
            StopAmbulanceMissions();
        }
    }
Exemple #17
0
 public void Draw()
 {
     mBackRectangle.Draw();
     mCaptionText.Draw();
     mDescriptionText.Draw();
 }
    void intial()
    {
        Game.Player.WantedLevel = 0;
        Game.Player.Character.Weapons.RemoveAll();

        Function.Call(Hash.CLEAR_RELATIONSHIP_BETWEEN_GROUPS, (int)Relationship.Hate, 2124571506, -183807561);
        Function.Call(Hash.CLEAR_RELATIONSHIP_BETWEEN_GROUPS, (int)Relationship.Hate, -183807561, 2124571506);

        Function.Call(Hash.SET_RELATIONSHIP_BETWEEN_GROUPS, (int)Relationship.Pedestrians, 2124571506, -183807561);
        Function.Call(Hash.SET_RELATIONSHIP_BETWEEN_GROUPS, (int)Relationship.Pedestrians, -183807561, 2124571506);

        escape_Ped = World.CreatePed(PedHash.Prisoner01, new Vector3(1625.474f, 2491.485f, 45.62026f));
        escape_Ped.Task.StandStill(-1);
        escape_Ped.Heading = 320.5151f;



        Function.Call(Hash.SET_ENTITY_AS_MISSION_ENTITY, escape_Ped, true, true);

        Game.Player.WantedLevel = 0;
        Function.Call(Hash.SET_MAX_WANTED_LEVEL, 0);

        Game.Player.Character.Task.PlayAnimation("RANDOM@ARRESTS", "idle_2_hands_up", 2f, -1, false, 0);
        Script.Wait(500);
        Game.FadeScreenIn(2500);
        //   while (Function.Call<bool>(Hash.IS_ENTITY_PLAYING_ANIM, Game.Player.Character, "RANDOM@ARRESTS", "idle_2_hands_up", 3)) Script.Wait(0);
        while (!Function.Call <bool>(Hash.IS_SCREEN_FADED_OUT))
        {
            Script.Wait(0);
        }

        Game.FadeScreenIn(0);

        int group        = 2124571506;
        int player_group = Function.Call <int>(Hash.GET_PED_RELATIONSHIP_GROUP_HASH, Game.Player.Character);


        Function.Call(Hash.CLEAR_RELATIONSHIP_BETWEEN_GROUPS, (int)Relationship.Pedestrians, group, player_group);
        Function.Call(Hash.CLEAR_RELATIONSHIP_BETWEEN_GROUPS, (int)Relationship.Pedestrians, player_group, group);

        Function.Call(Hash.SET_RELATIONSHIP_BETWEEN_GROUPS, 1, group, player_group);
        //     Function.Call(Hash.SET_RELATIONSHIP_BETWEEN_GROUPS, 1, player_group, group);

        //   Function.Call(Hash.CLEAR_AREA_OF_PEDS, 1637.856f, 2608.986f, 45.56487f, 1000f, true);

        clothes_changer();

        bail       = World.CreateBlip(new Vector3(1691.709f, 2565.036f, 45.56487f));
        bail.Color = BlipColor.White;
        Function.Call(Hash.SET_CLOCK_TIME, 13, 00, 0);

        roit        = World.CreateBlip(escape_Ped.Position);
        roit.Sprite = BlipSprite.DollarSign;


        _headsup = new UIText("Time: ~b~" + hours + ":" + minit, new Point(2, 520), 0.7f, Color.WhiteSmoke, GTA.Font.HouseScript, false);

        _headsupRectangle = new UIRectangle(new Point(0, 520), new Size(215, 65), Color.FromArgb(100, 0, 0, 0));

        _headsup.Draw();
        _headsupRectangle.Draw();

        arrested = true;
        escape   = false;
        Game.Player.Character.Position = new Vector3(1617.643f, 2523.981f, 45.56489f);
        Game.FadeScreenOut(1);
        Function.Call(Hash.TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME, "respawn_controller");
        Function.Call(Hash.TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME, "re_prison");
        Game.Player.Character.Heading = 264.718f;
        Game.FadeScreenOut(0);
        Function.Call(Hash.TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME, "respawn_controller");
        Function.Call(Hash.TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME, "re_prison");
        Game.FadeScreenIn(3000);
    }
Exemple #19
0
        public void prison_controle_Tick()
        {
            if (arrested)
            {
                stop_scripts();
            }
            if (inprison)
            {
                stop_scripts();
                if (Game.Player.Character.Position.DistanceTo(new Vector3(1752.894f, 2592.242f, 45.56502f)) < 1f)
                {
                    arrested = true;

                    escape = false;
                    Function.Call(Hash.ENABLE_ALL_CONTROL_ACTIONS, new InputArgument[] { 1 });
                    Game.FadeScreenOut(0x9c4);
                    Game.Player.Character.Weapons.RemoveAll();
                    while (!Function.Call <bool>(Hash.IS_SCREEN_FADED_OUT, new InputArgument[0]))
                    {
                        stop_scripts();
                        Script.Wait(0);
                    }
                    Game.Player.Character.Position = new Vector3(1617.643f, 2523.981f, 45.56489f);
                    Game.Player.Character.Heading  = 264.718f;
                    clothes_changer();
                    Game.FadeScreenIn(0x9c4);
                    Game.Player.CanControlCharacter = true;
                    Function.Call(Hash.SET_ENABLE_HANDCUFFS, new InputArgument[] { Game.Player.Character, 0 });
                    Function.Call(Hash.SET_ENABLE_BOUND_ANKLES, new InputArgument[] { Game.Player.Character, 0 });
                    int num  = 0x7ea26372;
                    int num2 = Function.Call <int>(Hash.GET_PED_RELATIONSHIP_GROUP_HASH, new InputArgument[] { Game.Player.Character });
                    Function.Call(Hash.CLEAR_RELATIONSHIP_BETWEEN_GROUPS, new InputArgument[] { 0xff, num, num2 });
                    Function.Call(Hash.CLEAR_RELATIONSHIP_BETWEEN_GROUPS, new InputArgument[] { 0xff, num2, num });
                    Function.Call(Hash.SET_RELATIONSHIP_BETWEEN_GROUPS, new InputArgument[] { 1, num, num2 });
                    bail       = World.CreateBlip(new Vector3(1691.709f, 2565.036f, 45.56487f));
                    bail.Color = BlipColor.White;
                    Function.Call(Hash.SET_CLOCK_TIME, new InputArgument[] { 13, 0, 0 });
                    roit              = World.CreateBlip(escape_Ped.Position);
                    roit.Sprite       = BlipSprite.DollarSign;
                    _headsup          = new UIText(string.Concat(new object[] { "Time: ~b~", hours, ":", minit }), new Point(2, 520), 0.7f, Color.WhiteSmoke, GTA.Font.HouseScript, false);
                    _headsupRectangle = new UIRectangle(new Point(0, 520), new Size(0xd7, 0x41), Color.FromArgb(100, 0, 0, 0));
                    if (police != null)
                    {
                        police.Delete();
                    }
                    if (policecar != null)
                    {
                        policecar.Delete();
                    }
                    inprison = false;
                }
                if ((Game.Player.Character.Position.DistanceTo(new Vector3(1764.323f, 2604.595f, 45.56498f)) < 5f) && (Game.Player.Character.CurrentVehicle == policecar))
                {
                    Game.Player.Character.Task.GoTo(new Vector3(1752.894f, 2592.242f, 45.56502f));
                }
            }
            if (arrested)
            {
                if (Game.Player.Character.IsDead)
                {
                    respawn.RespawnPlayer(new Vector3(1617.643f, 2523.981f, 45.56489f), 264.718f);
                }

                if (player_status == status.In_roit && Game.GameTime > time + 1000)
                {
                    Model mod = new Model(PedHash.Prisoner01);
                    mod.Request();
                    while (!mod.IsLoaded)
                    {
                        stop_scripts();
                        Script.Wait(0);
                    }
                    Ped[] allped = World.GetAllPeds(mod);
                    for (int i = 0; i < allped.Length; i++)
                    {
                        bool find = false;
                        for (int j = 0; j < prisoner.Count; j++)
                        {
                            if (prisoner[j] == allped[i])
                            {
                                find = true;
                            }
                        }



                        if (!find)
                        {
                            prisoner.Add(allped[i]);
                        }
                    }
                    mod.MarkAsNoLongerNeeded();
                    //===================================================
                    mod = new Model(PedHash.Prisoner01SMY);
                    mod.Request();
                    while (!mod.IsLoaded)
                    {
                        stop_scripts();
                        Script.Wait(0);
                    }
                    allped = World.GetAllPeds(mod);
                    for (int i = 0; i < allped.Length; i++)
                    {
                        bool find = false;
                        for (int j = 0; j < prisoner.Count; j++)
                        {
                            if (prisoner[j] == allped[i])
                            {
                                find = true;
                            }
                        }



                        if (!find)
                        {
                            prisoner.Add(allped[i]);
                        }
                    }
                    mod.MarkAsNoLongerNeeded();
                    //===================================================
                    mod = new Model(PedHash.Prisguard01SMM);
                    mod.Request();
                    while (!mod.IsLoaded)
                    {
                        stop_scripts();
                        Script.Wait(0);
                    }
                    allped = World.GetAllPeds(mod);
                    for (int i = 0; i < allped.Length; i++)
                    {
                        bool find = false;
                        for (int j = 0; j < garde.Count; j++)
                        {
                            if (garde[j] == allped[i])
                            {
                                find = true;
                            }
                        }



                        if (!find)
                        {
                            garde.Add(allped[i]);
                        }
                    }
                    mod.MarkAsNoLongerNeeded();


                    for (int j = 0; j < prisoner.Count; j++)
                    {
                        GiveWeapons_prisoner(prisoner[j]);
                        prisoner[j].CanSwitchWeapons = true;
                        //Function.Call(Hash.SET_BLOCKING_OF_NON_TEMPORARY_EVENTS, prisoner[j], true);
                    }
                    for (int j = 0; j < garde.Count; j++)
                    {
                        GiveWeapons_Garde(garde[j]);
                        garde[j].CanSwitchWeapons = true;
                        // Function.Call(Hash.SET_BLOCKING_OF_NON_TEMPORARY_EVENTS, garde[j], true);
                    }
                    time = Game.GameTime;
                }

                Function.Call(Hash.SET_MAX_WANTED_LEVEL, new InputArgument[] { 0 });
                stop_scripts();
                int hh = Function.Call <int>(Hash.GET_CLOCK_HOURS, new InputArgument[0]);
                int mm = Function.Call <int>(Hash.GET_CLOCK_MINUTES, new InputArgument[0]);
                if ((hh == 14) && (mm == 0))
                {
                    Function.Call(Hash.SET_CLOCK_TIME, new InputArgument[] { 13, 0, 0 });
                    time = Game.GameTime;
                }
                if (!((mm != 0) || hhh))
                {
                    minit = 0;
                    hours--;
                    hhh = true;
                }
                else if (mm > 0)
                {
                    minit = 60 - mm;
                    hhh   = false;
                }
                if ((mm == 0 || mm == 5 || mm == 10 || mm == 15 || mm == 20 || mm == 25 || mm == 30 || mm == 35 || mm == 40 || mm == 45 || mm == 50 || mm == 55 || mm == 60) && !doit)
                {
                    Model mod = new Model(PedHash.Prisoner01);
                    mod.Request();
                    while (!mod.IsLoaded)
                    {
                        stop_scripts();
                        Script.Wait(0);
                    }
                    Ped[] allped = World.GetAllPeds(mod);
                    for (int i = 0; i < allped.Length; i++)
                    {
                        bool find = false;
                        for (int j = 0; j < prisoner.Count; j++)
                        {
                            if (prisoner[j] == allped[i])
                            {
                                find = true;
                            }
                        }



                        if (!find)
                        {
                            prisoner.Add(allped[i]);
                        }
                    }
                    mod.MarkAsNoLongerNeeded();
                    //===================================================
                    mod = new Model(PedHash.Prisoner01SMY);
                    mod.Request();
                    while (!mod.IsLoaded)
                    {
                        stop_scripts();
                        Script.Wait(0);
                    }
                    allped = World.GetAllPeds(mod);
                    for (int i = 0; i < allped.Length; i++)
                    {
                        bool find = false;
                        for (int j = 0; j < prisoner.Count; j++)
                        {
                            if (prisoner[j] == allped[i])
                            {
                                find = true;
                            }
                        }



                        if (!find)
                        {
                            prisoner.Add(allped[i]);
                        }
                    }
                    mod.MarkAsNoLongerNeeded();
                    //===================================================
                    mod = new Model(PedHash.Prisguard01SMM);
                    mod.Request();
                    while (!mod.IsLoaded)
                    {
                        stop_scripts();
                        Script.Wait(0);
                    }
                    allped = World.GetAllPeds(mod);
                    for (int i = 0; i < allped.Length; i++)
                    {
                        bool find = false;
                        for (int j = 0; j < garde.Count; j++)
                        {
                            if (garde[j] == allped[i])
                            {
                                find = true;
                            }
                        }



                        if (!find)
                        {
                            garde.Add(allped[i]);
                        }
                    }
                    mod.MarkAsNoLongerNeeded();



                    doit = true;
                }
                else if ((mm != 0 && mm != 5 && mm != 10 && mm != 15 && mm != 20 && mm != 25 && mm != 30 && mm != 35 && mm != 40 && mm != 45 && mm != 50 && mm != 55 && mm != 60) && doit)
                {
                    doit = false;
                }


                stop_scripts();
                _headsup          = new UIText(string.Concat(new object[] { "Time: ~b~", hours, ":", minit }), new Point(2, 520), 0.7f, Color.WhiteSmoke, GTA.Font.ChaletComprimeCologne, false);
                _headsupRectangle = new UIRectangle(new Point(0, 520), new Size(0xd7, 0x41), Color.FromArgb(100, 0, 0, 0));
                _headsup.Draw();
                _headsupRectangle.Draw();
                if (Game.Player.Character.Position.DistanceTo(new Vector3(1691.709f, 2565.036f, 45.56487f)) < 2f)
                {
                    UI.Notify("press [E] to bail : ~g~ " + 0x4c4b40 + "~w~$");
                }
                else if (Game.Player.Character.Position.DistanceTo(new Vector3(1625.474f, 2491.485f, 45.62026f)) < 4f)
                {
                    UI.Notify("press [E] to escape for : ~g~ " + 0x4c4b40 + "~w~$");
                    UI.Notify("press [Y] to make roit for : ~g~ " + 0x4c4b40 + "~w~$");
                }
                if ((hours == 0) && (minit == 0))
                {
                    bail.Remove();
                    roit.Remove();
                    escape_Ped.MarkAsNoLongerNeeded();
                    Game.Player.Character.Position = new Vector3(1849.555f, 2586.085f, 45.67202f);
                    Game.Player.Character.Heading  = 258.4564f;
                    Function.Call(Hash.SET_MAX_WANTED_LEVEL, new InputArgument[] { 5 });
                    Function.Call(Hash.PAUSE_CLOCK, new InputArgument[] { 0 });
                    arrested          = false;
                    _headsup          = null;
                    _headsupRectangle = null;
                }
            }
        }
        public void prison_controle_Tick()
        {
            if (arrested)
            {
                stop_scripts();
            }
            if (inprison)
            {
                stop_scripts();
                if (Game.Player.Character.Position.DistanceTo(new Vector3(1752.894f, 2592.242f, 45.56502f)) < 1f)
                {
                    arrested = true;

                    escape = false;
                    Function.Call(Hash.ENABLE_ALL_CONTROL_ACTIONS, new InputArgument[] { 1 });
                    Game.FadeScreenOut(0x9c4);
                    Game.Player.Character.Weapons.RemoveAll();
                    while (!Function.Call<bool>(Hash.IS_SCREEN_FADED_OUT, new InputArgument[0]))
                    {
                        stop_scripts();
                        Script.Wait(0);
                    }
                    Game.Player.Character.Position = new Vector3(1617.643f, 2523.981f, 45.56489f);
                    Game.Player.Character.Heading = 264.718f;
                    clothes_changer();
                    Game.FadeScreenIn(0x9c4);
                    Game.Player.CanControlCharacter = true;
                    Function.Call(Hash.SET_ENABLE_HANDCUFFS, new InputArgument[] { Game.Player.Character, 0 });
                    Function.Call(Hash.SET_ENABLE_BOUND_ANKLES, new InputArgument[] { Game.Player.Character, 0 });
                    int num = 0x7ea26372;
                    int num2 = Function.Call<int>(Hash.GET_PED_RELATIONSHIP_GROUP_HASH, new InputArgument[] { Game.Player.Character });
                    Function.Call(Hash.CLEAR_RELATIONSHIP_BETWEEN_GROUPS, new InputArgument[] { 0xff, num, num2 });
                    Function.Call(Hash.CLEAR_RELATIONSHIP_BETWEEN_GROUPS, new InputArgument[] { 0xff, num2, num });
                    Function.Call(Hash.SET_RELATIONSHIP_BETWEEN_GROUPS, new InputArgument[] { 1, num, num2 });
                    bail = World.CreateBlip(new Vector3(1691.709f, 2565.036f, 45.56487f));
                    bail.Color = BlipColor.White;
                    Function.Call(Hash.SET_CLOCK_TIME, new InputArgument[] { 13, 0, 0 });
                    roit = World.CreateBlip(escape_Ped.Position);
                    roit.Sprite = BlipSprite.DollarSign;
                    _headsup = new UIText(string.Concat(new object[] { "Time: ~b~", hours, ":", minit }), new Point(2, 520), 0.7f, Color.WhiteSmoke, GTA.Font.HouseScript, false);
                    _headsupRectangle = new UIRectangle(new Point(0, 520), new Size(0xd7, 0x41), Color.FromArgb(100, 0, 0, 0));
                    if (police != null)
                    {
                        police.Delete();
                    }
                    if (policecar != null)
                    {
                        policecar.Delete();
                    }
                    inprison = false;
                }
                if ((Game.Player.Character.Position.DistanceTo(new Vector3(1764.323f, 2604.595f, 45.56498f)) < 5f) && (Game.Player.Character.CurrentVehicle == policecar))
                {
                    Game.Player.Character.Task.GoTo(new Vector3(1752.894f, 2592.242f, 45.56502f));
                }
            }
            if (arrested)
            {

                if (Game.Player.Character.IsDead)
                {
                    respawn.RespawnPlayer(new Vector3(1617.643f, 2523.981f, 45.56489f), 264.718f);
                }

                if (player_status == status.In_roit && Game.GameTime > time +1000)
                {
                    Model mod = new Model(PedHash.Prisoner01);
                    mod.Request();
                    while (!mod.IsLoaded)
                    {
                        stop_scripts();
                        Script.Wait(0);
                    }
                    Ped[] allped = World.GetAllPeds(mod);
                    for (int i = 0; i < allped.Length; i++)
                    {
                        bool find = false;
                        for (int j = 0; j < prisoner.Count; j++)
                            if (prisoner[j] == allped[i])
                                find = true;

                        if (!find)
                            prisoner.Add(allped[i]);
                    }
                    mod.MarkAsNoLongerNeeded();
                    //===================================================
                    mod = new Model(PedHash.Prisoner01SMY);
                    mod.Request();
                    while (!mod.IsLoaded)
                    {
                        stop_scripts();
                        Script.Wait(0);
                    }
                    allped = World.GetAllPeds(mod);
                    for (int i = 0; i < allped.Length; i++)
                    {
                        bool find = false;
                        for (int j = 0; j < prisoner.Count; j++)
                            if (prisoner[j] == allped[i])
                                find = true;

                        if (!find)
                            prisoner.Add(allped[i]);
                    }
                    mod.MarkAsNoLongerNeeded();
                    //===================================================
                    mod = new Model(PedHash.Prisguard01SMM);
                    mod.Request();
                    while (!mod.IsLoaded)
                    {
                        stop_scripts();
                        Script.Wait(0);
                    }
                    allped = World.GetAllPeds(mod);
                    for (int i = 0; i < allped.Length; i++)
                    {
                        bool find = false;
                        for (int j = 0; j < garde.Count; j++)
                            if (garde[j] == allped[i])
                                find = true;

                        if (!find)
                            garde.Add(allped[i]);
                    }
                    mod.MarkAsNoLongerNeeded();

                    for (int j = 0; j < prisoner.Count; j++)
                    {
                        GiveWeapons_prisoner(prisoner[j]);
                        prisoner[j].CanSwitchWeapons = true;
                        //Function.Call(Hash.SET_BLOCKING_OF_NON_TEMPORARY_EVENTS, prisoner[j], true);
                    }
                    for (int j = 0; j < garde.Count; j++)
                    {
                        GiveWeapons_Garde(garde[j]);
                        garde[j].CanSwitchWeapons = true;
                       // Function.Call(Hash.SET_BLOCKING_OF_NON_TEMPORARY_EVENTS, garde[j], true);
                    }
                    time = Game.GameTime;
                }

                Function.Call(Hash.SET_MAX_WANTED_LEVEL, new InputArgument[] { 0 });
                stop_scripts();
                int hh = Function.Call<int>(Hash.GET_CLOCK_HOURS, new InputArgument[0]);
                int mm = Function.Call<int>(Hash.GET_CLOCK_MINUTES, new InputArgument[0]);
                if ((hh == 14) && (mm == 0))
                {
                    Function.Call(Hash.SET_CLOCK_TIME, new InputArgument[] { 13, 0, 0 });
                    time = Game.GameTime;
                }
                if (!((mm != 0) || hhh))
                {
                    minit = 0;
                    hours--;
                    hhh = true;
                }
                else if (mm > 0)
                {
                    minit = 60 - mm;
                    hhh = false;
                }
                if ((mm == 0 || mm == 5 || mm == 10 || mm == 15 || mm == 20 || mm == 25 || mm == 30 || mm == 35 || mm == 40 || mm == 45 || mm == 50 || mm == 55 || mm == 60) && !doit)
                {
                    Model mod = new Model(PedHash.Prisoner01);
                    mod.Request();
                    while (!mod.IsLoaded)
                    {
                        stop_scripts();
                        Script.Wait(0);
                    }
                    Ped[] allped = World.GetAllPeds(mod);
                    for (int i = 0; i < allped.Length;i++ )
                    {
                        bool find = false;
                        for (int j = 0; j < prisoner.Count; j++)
                            if (prisoner[j] == allped[i])
                                find = true;

                        if (!find)
                            prisoner.Add(allped[i]);
                    }
                    mod.MarkAsNoLongerNeeded();
                    //===================================================
                     mod = new Model(PedHash.Prisoner01SMY);
                    mod.Request();
                    while (!mod.IsLoaded)
                    {
                        stop_scripts();
                        Script.Wait(0);
                    }
                     allped = World.GetAllPeds(mod);
                    for (int i = 0; i < allped.Length; i++)
                    {
                        bool find = false;
                        for (int j = 0; j < prisoner.Count; j++)
                            if (prisoner[j] == allped[i])
                                find = true;

                        if (!find)
                            prisoner.Add(allped[i]);
                    }
                    mod.MarkAsNoLongerNeeded();
                    //===================================================
                    mod = new Model(PedHash.Prisguard01SMM);
                    mod.Request();
                    while (!mod.IsLoaded)
                    {
                        stop_scripts();
                        Script.Wait(0);
                    }
                    allped = World.GetAllPeds(mod);
                    for (int i = 0; i < allped.Length; i++)
                    {
                        bool find = false;
                        for (int j = 0; j < garde.Count; j++)
                            if (garde[j] == allped[i])
                                find = true;

                        if (!find)
                            garde.Add(allped[i]);
                    }
                    mod.MarkAsNoLongerNeeded();

                        doit = true;
                }
                else if ((mm != 0 && mm != 5 && mm != 10 && mm != 15 && mm != 20 && mm != 25 && mm != 30 && mm != 35 && mm != 40 && mm != 45 && mm != 50 && mm != 55 && mm != 60) && doit)
                {
                    doit = false;
                }

                stop_scripts();
                _headsup = new UIText(string.Concat(new object[] { "Time: ~b~", hours, ":", minit }), new Point(2, 520), 0.7f, Color.WhiteSmoke, GTA.Font.ChaletComprimeCologne, false);
                _headsupRectangle = new UIRectangle(new Point(0, 520), new Size(0xd7, 0x41), Color.FromArgb(100, 0, 0, 0));
                _headsup.Draw();
                _headsupRectangle.Draw();
                if (Game.Player.Character.Position.DistanceTo(new Vector3(1691.709f, 2565.036f, 45.56487f)) < 2f)
                {
                    UI.Notify("press [E] to bail : ~g~ " + 0x4c4b40 + "~w~$");
                }
                else if (Game.Player.Character.Position.DistanceTo(new Vector3(1625.474f, 2491.485f, 45.62026f)) < 4f)
                {
                    UI.Notify("press [E] to escape for : ~g~ " + 0x4c4b40 + "~w~$");
                    UI.Notify("press [Y] to make roit for : ~g~ " + 0x4c4b40 + "~w~$");
                }
                if ((hours == 0) && (minit == 0))
                {
                    bail.Remove();
                    roit.Remove();
                    escape_Ped.MarkAsNoLongerNeeded();
                    Game.Player.Character.Position = new Vector3(1849.555f, 2586.085f, 45.67202f);
                    Game.Player.Character.Heading = 258.4564f;
                    Function.Call(Hash.SET_MAX_WANTED_LEVEL, new InputArgument[] { 5 });
                    Function.Call(Hash.PAUSE_CLOCK, new InputArgument[] { 0 });
                    arrested = false;
                    _headsup = null;
                    _headsupRectangle = null;
                }
            }
        }