public virtual void SetOriginAndSize(Point origin, Size size)
        {
            text = new UIText(
                Caption,
                Parent.ItemTextCentered ? new Point(origin.X + size.Width / 2 + Parent.TextOffset.X, origin.Y + Parent.TextOffset.Y) : new Point(origin.X + Parent.TextOffset.X, origin.Y + Parent.TextOffset.Y),
                Parent.ItemTextScale,
                Parent.UnselectedTextColor,
                Parent.ItemFont,
                Parent.ItemTextCentered);
            button = new UIRectangle(
                origin,
                size,
                Parent.UnselectedItemColor);

            if (UnderlinedAbove)
            {
                underlineAbove = new UIRectangle(
                    new Point(origin.X, origin.Y),
                    new Size(size.Width, UnderlineHeight),
                    UnderlineColor);
            }
            if (UnderlinedBelow)
            {
                underlineBelow = new UIRectangle(
                    new Point(origin.X, origin.Y + size.Height - UnderlineHeight),
                    new Size(size.Width, 2),
                    UnderlineColor);
            }
        }
        private void CreateUiContainer()
        {
            _uiContainer = new UIContainer(new Point(0, 0), new Size(40, 40), Color.FromArgb(0, 0, 0, 0));
            var color      = Color.FromArgb(220, 255, 50, 50);
            var crosshair1 = new UIRectangle(new Point(0, 0), new Size(5, 2), color);

            _uiContainer.Items.Add(crosshair1);
            var crosshair2 = new UIRectangle(new Point(0, 38), new Size(5, 2), color);

            _uiContainer.Items.Add(crosshair2);
            var crosshair3 = new UIRectangle(new Point(0, 2), new Size(2, 3), color);

            _uiContainer.Items.Add(crosshair3);
            var crosshair4 = new UIRectangle(new Point(38, 2), new Size(2, 3), color);

            _uiContainer.Items.Add(crosshair4);

            var crosshair5 = new UIRectangle(new Point(35, 0), new Size(5, 2), color);

            _uiContainer.Items.Add(crosshair5);
            var crosshair6 = new UIRectangle(new Point(35, 38), new Size(5, 2), color);

            _uiContainer.Items.Add(crosshair6);
            var crosshair7 = new UIRectangle(new Point(0, 35), new Size(2, 3), color);

            _uiContainer.Items.Add(crosshair7);
            var crosshair8 = new UIRectangle(new Point(38, 35), new Size(2, 3), color);

            _uiContainer.Items.Add(crosshair8);
        }
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();
        }
        /// <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();
            }
        }
        private void SetupScoreboard(int numSlots)
        {
            if (numSlots > numAvailableSlots)
            {
                infoContainer = new UIContainer(new Point((int)0.00115f * Game.ScreenResolution.Width + 960, UI.HEIGHT / 6 - 20),
                                                new Size(180, numSlots * 31), Color.FromArgb(180, Color.Black));

                UIRectangle[] containerItems = new UIRectangle[numSlots << 1];

                for (int i = 0; i < numSlots; i++)
                {
                    var color = (TeamColor)i;

                    containerItems[i] = new UIRectangle(new Point(), new Size(0, 11), Color.FromArgb(180, Color.Orange));

                    containerItems[i + numSlots] = new UIRectangle(new Point(22, (30 * i) + 12), new Size(21, 13), Color.FromArgb(180, color.ToSystemColor()));
                }

                infoContainer.Items.AddRange(containerItems);

                Array.Resize(ref entries, numSlots);

                numAvailableSlots = numSlots;
            }
        }
    private void Update()
    {
        UIRect = new UIRectangle(drawButton.Position, drawButton.Texture.width * drawButton.Scale, drawButton.Texture.height * drawButton.Scale);

        if (!UsingButtons)
            return;
        Check_Touch_Position_Within_ButtonRect();
    }
 /// <summary>
 /// Create the border around the console
 /// </summary>
 /// <param name="position"></param>
 /// <param name="size"></param>
 /// <param name="color"></param>
 /// <param name="width"></param>
 private void CreateFrame(Point position, Size size, Color color, int width)
 {
     color    = Color.FromArgb(color.A + 80, color.R + 80, color.G + 80, color.B + 80);
     edges[0] = new UIRectangle(position, new Size(size.Width, width), color);
     edges[1] = new UIRectangle(position, new Size(width, size.Height), color);
     edges[2] = new UIRectangle(new Point(position.X + size.Width - width, position.Y), new Size(width, size.Height), color);
     edges[3] = new UIRectangle(new Point(position.X, position.Y + size.Height - width), new Size(size.Width, width), color);
 }
 public GazeVisualization()
 {
     _uiContainerGaze = new UIContainer(new Point(0, 0), new Size(4, 4), Color.FromArgb(0, 0, 0, 0));
     var crosshair1 = new UIRectangle(new Point(0, 0), new Size(4, 4), Color.FromArgb(220, 255, 0, 0));
     _uiContainerGaze.Items.Add(crosshair1);
     var crosshair2 = new UIRectangle(new Point(1, 1), new Size(2, 2), Color.FromArgb(220, 0, 255, 255));
     _uiContainerGaze.Items.Add(crosshair2);
 }
Exemple #9
0
        private void CreateUiContainer(Color outerColor, Color innerColor)
        {
            _uiContainer = new UIContainer(new Point(0, 0), new Size(4, 4), Color.FromArgb(0, 0, 0, 0));
            var crosshair1 = new UIRectangle(new Point(0, 0), new Size(4, 4), outerColor);

            _uiContainer.Items.Add(crosshair1);
            var crosshair2 = new UIRectangle(new Point(1, 1), new Size(2, 2), innerColor);

            _uiContainer.Items.Add(crosshair2);
        }
        public GazeVisualization()
        {
            _uiContainerGaze = new UIContainer(new Point(0, 0), new Size(4, 4), Color.FromArgb(0, 0, 0, 0));
            var crosshair1 = new UIRectangle(new Point(0, 0), new Size(4, 4), Color.FromArgb(220, 255, 0, 0));

            _uiContainerGaze.Items.Add(crosshair1);
            var crosshair2 = new UIRectangle(new Point(1, 1), new Size(2, 2), Color.FromArgb(220, 0, 255, 255));

            _uiContainerGaze.Items.Add(crosshair2);
        }
Exemple #11
0
        private void CreateCrosshair()
        {
            _uiContainerCrosshair = new UIContainer(new Point(0, 0), new Size(4, 4), Color.FromArgb(0, 0, 0, 0));
            var crosshair1 = new UIRectangle(new Point(0, 0), new Size(4, 4), Color.FromArgb(220, 0, 0, 0));

            _uiContainerCrosshair.Items.Add(crosshair1);
            var crosshair2 = new UIRectangle(new Point(1, 1), new Size(2, 2), Color.FromArgb(220, 255, 255, 255));

            _uiContainerCrosshair.Items.Add(crosshair2);
        }
    private void DrawChildren(TreeMapNode r, Transform parent, Vector2 anchorMin, Vector2 anchorMax, int level)
    {
        UIRectangle rc = parent.GetComponent <UIRectangle>();

        Vector2 newAnchorMin = anchorMin;

        Vector2 newAnchorMax = anchorMax;

        if (Invert)
        {
            // Invert the anchors

            newAnchorMin = new Vector2(anchorMin.x, 1 - anchorMax.y);

            newAnchorMax = new Vector2(anchorMax.x, 1 - anchorMin.y);
        }


        PickableRect rect = new PickableRect()
        {
            rect = new CustomRect {
                anchorMin = newAnchorMin, anchorMax = newAnchorMax
            },

            color = controller.LookUp(r.Data.ColorByWeight),

            rowID = r.Data.rowID
        };

        parent.GetComponent <TreeMapCellSelectionHandler>().Rects.Add(rect);

        rc.AddCellToDraw(rect);

        cellRects.Add(r.Data.rowID, new RectWithParentTransform()
        {
            rect = rect.rect,

            parent = parent as RectTransform
        });


        if (RejectNode(parent, anchorMin, anchorMax))
        {
            SkippedDraw.Add(r.ID);

            ++Rejected;
        }
        else
        {
            ++Drawn;
        }
    }
Exemple #13
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 virtual void SetOriginAndSize(Point origin, Size size)
 {
     text = new UIText(
         Caption,
         Parent.ItemTextCentered ? new Point(origin.X + size.Width / 2 + Parent.TextOffset.X, origin.Y + Parent.TextOffset.Y) : new Point(origin.X + Parent.TextOffset.X, origin.Y + Parent.TextOffset.Y),
         Parent.ItemTextScale,
         Parent.UnselectedTextColor,
         Parent.ItemFont,
         Parent.ItemTextCentered);
     button = new UIRectangle(
         origin,
         size,
         Parent.UnselectedItemColor);
 }
    /*
     * private void LogToFile(string text)
     * {
     *  using (StreamWriter w = File.AppendText("log.txt"))
     *  {
     *      w.Write(text + "\n");
     *  }
     * }*/

    private void StartAmbulanceMissions()
    {
        Ped player = Game.Player.Character;

        _onAmbulanceMission    = true;
        _missionState          = 1;
        _critical              = false;
        _cprAppliedThisMission = false;
        _cprBeingApplied       = false;
        _reanimationFailed     = false;

        _headsup          = new UIText("Level: ~b~" + _level, new Point(2, 320), 0.7f, Color.WhiteSmoke, GTA.Font.HouseScript, false);
        _headsupRectangle = new UIRectangle(new Point(0, 320), new Size(215, 65), Color.FromArgb(100, 0, 0, 0));

        /*Function.Call(Hash._0xB87A37EEB7FAA67D, "STRING");
         * Function.Call(Hash._ADD_TEXT_COMPONENT_STRING, "Pick up the ~g~patient~w~.");
         * Function.Call(Hash._0x9D77056A530643F6, 0.5f, 1);*/
        UI.ShowSubtitle("Pick up the ~g~patient~w~.", 9999999);

        Vector3 pedSpawnPoint = GetRandomVictim();

        _victimPed = Function.Call <Ped>(Hash.CREATE_RANDOM_PED, pedSpawnPoint.X, pedSpawnPoint.Y, pedSpawnPoint.Z);

        _victimPed.IsPersistent          = true;
        _victimPed.AlwaysDiesOnLowHealth = false;


        //this.victimPed.IsPersistent = true;
        //this.victimPed.AlwaysDiesOnLowHealth = false;
        _victimPed.Health  = _level >= 14 ? 30 : _difficultyScale[_level - 1];
        player.IsEnemy     = false;
        _victimPed.IsEnemy = false;

        Function.Call(Hash.SET_PED_MOVEMENT_CLIPSET, _victimPed.Handle,
                      _victimPed.Gender == Gender.Male ? "move_m@injured" : "move_f@injured");

        if (_blip != null)
        {
            if (_blip.Exists())
            {
                _blip.Remove();
            }
        }

        _blip = _victimPed.AddBlip();
        Function.Call(Hash.SET_BLIP_AS_FRIENDLY, _blip.Handle, true);
        _blip.Color     = BlipColor.Green;
        _blip.ShowRoute = true;
    }
        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 bool _tmpWorkaround; //OH GOD SOMEONE SHOOTME

    #endregion Fields

    #region Constructors

    public Vigilante()
    {
        KeyDown += OnKeyDown;
        Tick += OnTick;

        //this._debug = new UIText("debug goes here", new Point(10, 10), 0.5f, Color.White, 0, false);

        //CriminalGroup = World.AddRelationShipGroup("CRIMINALS_MOD"); //Wont work
        //OutputArgument outArg = new OutputArgument();
        //Function.Call(Hash.ADD_RELATIONSHIP_GROUP, "CRIMINALS_MOD", outArg);
        //CriminalGroup = outArg.GetResult<int>();

        _headsup = new UIText("Level: ~b~" + _level, new Point(2, 325), 0.7f, Color.WhiteSmoke, 1, false);
        _headsupRectangle = new UIRectangle(new Point(0, 320), new Size(200, 110), Color.FromArgb(100, 0, 0, 0));

        //World.SetRelationshipBetweenGroups(Relationship.Hate, CriminalGroup, PlayerGroup);
    }
Exemple #18
0
    public Vigilante()
    {
        KeyDown += OnKeyDown;
        Tick    += OnTick;

        //this._debug = new UIText("debug goes here", new Point(10, 10), 0.5f, Color.White, 0, false);

        //CriminalGroup = World.AddRelationShipGroup("CRIMINALS_MOD"); //Wont work
        //OutputArgument outArg = new OutputArgument();
        //Function.Call(Hash.ADD_RELATIONSHIP_GROUP, "CRIMINALS_MOD", outArg);
        //CriminalGroup = outArg.GetResult<int>();

        _headsup          = new UIText("Level: ~b~" + _level, new Point(2, 325), 0.7f, Color.WhiteSmoke, 1, false);
        _headsupRectangle = new UIRectangle(new Point(0, 320), new Size(200, 110), Color.FromArgb(100, 0, 0, 0));

        //World.SetRelationshipBetweenGroups(Relationship.Hate, CriminalGroup, PlayerGroup);
    }
        /*void DrawScrollArrows(bool up, bool down, Size offset)
         * {
         *      if (!up && !down)
         *      {
         *              return;
         *      }
         *
         *      if (Function.Call<bool>(Hash.HAS_STREAMED_TEXTURE_DICT_LOADED, "CommonMenu"))
         *      {
         *              Vector2 Resolution = Function.Call<Vector2>(Hash.GET_TEXTURE_RESOLUTION, "CommonMenu", "arrowright");
         *              if (up)
         *              {
         *                      float xscale = Resolution.X / WIDTH;
         *                      float yscale = Resolution.Y / HEIGHT;
         *                      float xpos = (Width + offset.Width) / WIDTH - xscale * 0.5f;
         *                      float ypos = (HeaderHeight + offset.Height + ItemHeight / 2) / HEIGHT;
         *                      Function.Call(Hash.DRAW_SPRITE, "CommonMenu", "arrowright", xpos, ypos, xscale, yscale, -90.0f, 255, 255, 255, 255);
         *              }
         *              if (down)
         *              {
         *                      float xscale = Resolution.X / WIDTH;
         *                      float yscale = Resolution.Y / HEIGHT;
         *                      float xpos = (Width + offset.Width) / WIDTH - xscale * 0.5f;
         *                      float ypos = (HeaderHeight + offset.Height + ItemHeight * ItemDrawCount - ItemHeight / 2) / HEIGHT;
         *                      Function.Call(Hash.DRAW_SPRITE, "CommonMenu", "arrowright", xpos, ypos, xscale, yscale, 90.0f, 255, 255, 255, 255);
         *              }
         *      }
         *      else
         *      {
         *              Function.Call(Hash.REQUEST_STREAMED_TEXTURE_DICT, "CommonMenu", 0);
         *      }
         * }*/

        public override void Initialize()
        {
            int currentY = HeaderHeight;
            var itemSize = new Size(Width, ItemHeight);

            for (int i = 0; i < ItemDrawCount; i++)
            {
                Items[i + CurrentScrollOffset].SetOriginAndSize(new Point(0, currentY), itemSize);
                currentY += ItemHeight;
            }

            selectedIndex     = 0;
            footerDescription = Items[selectedIndex].Description;
            Items[selectedIndex].Select();

            int itemsHeight = ItemDrawCount * ItemHeight;

            rectHeader = new UIRectangle(default, new Size(Width, HeaderHeight), HeaderColor);
Exemple #20
0
        public override IEnumerable <UIRenderData> ConstructVertexData( )
        {
            string textureDomain = "btn_" + (Clicked ? "p" : "i");
            float  w             = EDGE_WIDTH_HEIGHT_RATIO * Layout.Size.Y;

            yield return(new UIRenderData(UIRectangle.GetVerticies(Layout.GlobalPosition.X, Layout.GlobalPosition.Y, w, Layout.Size.Y), textureDomain + "l", Color, Depth));

            yield return(new UIRenderData(UIRectangle.GetVerticies(Layout.GlobalPosition.X + w, Layout.GlobalPosition.Y, Layout.Size.X - 2 * w, Layout.Size.Y), textureDomain + "c", Color, Depth));

            yield return(new UIRenderData(UIRectangle.GetVerticies(Layout.GlobalPosition.X + Layout.Size.X - w, Layout.GlobalPosition.Y, w, Layout.Size.Y), textureDomain + "r", Color, Depth));

            Vector2 textPosition = new Vector2(Layout.GlobalPosition.X + Layout.Size.X * 0.5f, Layout.GlobalPosition.Y - (Layout.Size.Y - lines.Length * charSize) * 0.5f);

            foreach (UIRenderData d in UILabel.GetVertexData(new string[] { Text }, UILabel.TextAlignment.Center, textPosition, charSize, Depth, Color.White))
            {
                yield return(d);
            }
        }
    //--------------------------------------------------    Unity Standard Functions
    private void Start()
    {
        drawButton = GetComponent<DrawButton>();

        switch (PlayerPrefs.GetInt("Controller_Type"))
        {
            case 0:
                UsingButtons = false;
                break;
            case 1:
            case 2:
            case 3:
                UsingButtons = true;
                break;
        }

        UIRect = new UIRectangle(drawButton.Position, drawButton.Texture.width * drawButton.Scale, drawButton.Texture.height * drawButton.Scale);
    }
Exemple #22
0
 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();
 }
Exemple #23
0
        protected override void Setup()
        {
            var screenResolution = NativeFunctions.GetScreenResolution();

            ScreenHeight = (int)screenResolution.Y;
            ScreenWidth  = (int)screenResolution.X;

            _mContainer = new UIContainer(
                new Point(0, 0), new Size(ScreenWidth, ScreenHeight));

            OnDrawingTickAsObservable
            .Subscribe(_ => _mContainer.Draw());

            var harlThinned = CreateTickAsObservable(TimeSpan.FromMilliseconds(50));

            harlThinned
            .Where(_ => PlayerPed.IsSafeExist() && PlayerPed.Health < alertHelthValue && PlayerPed.IsAlive)
            .Subscribe(_ =>
            {
                //体力が減ったら画面を点滅させる
                time     += 1;
                var alpha = offset + amplitude * Math.Abs(Math.Sin(omega * time));

                _mContainer.Items.Clear();
                var rect = new UIRectangle(new Point(0, 0), new Size(ScreenWidth, ScreenHeight),
                                           Color.FromArgb((int)alpha, 255, 0, 0));
                _mContainer.Items.Add(rect);
            });

            harlThinned
            .Select(_ => PlayerPed.IsSafeExist() && PlayerPed.Health < alertHelthValue)
            .DistinctUntilChanged()
            .Where(x => !x)
            .Subscribe(_ =>
            {
                time = 0;
                _mContainer.Items.Clear();
            });
        }
    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 #25
0
 public UIForm(string caption, string desc, int x, int y, int width, int height)
 {
     mBackRectangle   = new UIRectangle(new Point(x, y), new Size(width, height), Color.Black);
     mCaptionText     = new UIText(caption, new Point(x, y), 0.50f, Color.White, 1, false);
     mDescriptionText = new UIText(desc, new Point(x, y + 20), 0.35f, Color.White, 4, false);
 }
    void Onkeyup(object sender, KeyEventArgs e)
    {
        if (e.KeyCode == Keys.F12 && Game.Player.WantedLevel > 1)
        {

            hours = 10 + Game.Player.WantedLevel *10;
            Game.Player.WantedLevel = 0;
            intial1();

        }
          /*  if (e.KeyCode == Keys.F11)
        {
            Ped[] test = World.GetNearbyPeds(Game.Player.Character, 100f);
            int player_group = Function.Call<int>(Hash.GET_PED_RELATIONSHIP_GROUP_HASH, test[0]);
            GTA.UI.ShowSubtitle(player_group + " ");
        }
        */

        if (e.KeyCode == Keys.E && arrested)
        {
            if (Game.Player.Character.Position.DistanceTo(new Vector3(1691.709f, 2565.036f, 45.56487f))<2f)
            {
                // bail
                if (Game.Player.Money > 5000000)
                {
                    bail.Remove();
                    roit.Remove();
                    Game.Player.Character.Position = new Vector3(1849.555f, 2586.085f, 45.67202f);
                    Game.Player.Character.Heading = 258.4564f;
                    Game.Player.Money -= 5000000;
                    Function.Call(Hash.SET_MAX_WANTED_LEVEL, 5);

                    Function.Call(Hash.SET_PED_DEFAULT_COMPONENT_VARIATION, Game.Player.Character);
                    arrested = false;

                    _headsup = null;
                    _headsupRectangle = null;
                }
                else
                {

                }

            }

            if (Game.Player.Character.Position.DistanceTo(new Vector3(1625.474f, 2491.485f, 45.62026f)) < 4f && !escape)
            {

                Function.Call(Hash.TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME, "respawn_controller");
                Function.Call(Hash.TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME, "re_prison");
                bail.Remove();
                roit.Remove();
                Game.Player.Money -= 5000000;
                Function.Call(Hash.TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME, "respawn_controller");
                Function.Call(Hash.TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME, "re_prison");
                // 182.3307f , -885.7198f , 31.11671f :=> 51.15437f

                Function.Call(Hash.TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME, "respawn_controller");
                Function.Call(Hash.TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME, "re_prison");
                //  -1083,942 : -2915,736 : 13,23366 :=> 285,5021
                if (help_veh == null)
                    help_veh = World.CreateVehicle(VehicleHash.Maverick, new Vector3(1649.463f, 2619.634f, 45.56486f));
                else
                {
                    help_veh.Delete();
                    help_veh = World.CreateVehicle(VehicleHash.Maverick, new Vector3(1649.463f, 2619.634f, 45.56486f));
                }
                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.SET_ENTITY_AS_MISSION_ENTITY, help_veh, true, true);
                help_veh.Heading = 10.83339f;

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

                bail = World.CreateBlip(help_veh.Position);
                bail.Color = BlipColor.Blue;

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

                GiveAllWeapons(Game.Player.Character);

                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.PAUSE_CLOCK, false);

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

                arrested = false;
                _headsup = null;
                _headsupRectangle = null;

                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.SET_CLOCK_TIME, 13, 00, 0);
                Function.Call(Hash.SET_MAX_WANTED_LEVEL, 5);
                Game.Player.WantedLevel = 4;

                escape = true;
            }

        }
        if (e.KeyCode == Keys.Y && arrested)
        {
            //  prisoner groupe   2124571506
            //  garde    groupe   -183807561
            if (Game.Player.Character.Position.DistanceTo(escape_Ped.Position) < 4f  )
            {
                for (int i = 0; i < prisoner.Count; i++)
                {
                    GiveAllWeapons1(prisoner[i]);
                    prisoner[i].CanSwitchWeapons = true;
                }

                for (int i = 0; i < garde.Count; i++)
                {
                    GiveAllWeapons2(garde[i]);
                    garde[i].CanSwitchWeapons = true;
                }

                GiveAllWeapons1(Game.Player.Character);
                Game.Player.Money -= 5000000;

                Function.Call(Hash.SET_RELATIONSHIP_BETWEEN_GROUPS, (int)Relationship.Hate, 2124571506, -183807561);
                Function.Call(Hash.SET_RELATIONSHIP_BETWEEN_GROUPS, (int)Relationship.Hate, -183807561, 2124571506);
            }
        }
        if (e.KeyCode == Keys.U)
        {

            Function.Call(Hash.ENABLE_ALL_CONTROL_ACTIONS, 1);
            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);
        }
        if(e.KeyCode == Keys.Y)
            Function.Call(Hash.SET_MAX_WANTED_LEVEL, 5);
        if (e.KeyCode == Keys.F6)
        {
            // PBUS
            // VehicleHash.PBus
            // 1971.267f , 2635.439f , 46.17389f :=> 120.792f
            // 1608.376f , 2685.54f , 45.32081f :=> 143.341f
            testt = true;
            if (test_veh == null)
            {
                test_veh = World.CreateVehicle(VehicleHash.PBus, new Vector3(1971.267f, 2635.439f, 46.17389f));
                test_veh.Heading = 120.792f;
            }
            else
            {
                test_veh.Delete();
                test_veh = World.CreateVehicle(VehicleHash.PBus, new Vector3(1971.267f, 2635.439f, 46.17389f));
                test_veh.Heading = 120.792f;
            }

            if (driver == null)
            {
                driver = World.CreatePed(PedHash.Prisguard01SMM, new Vector3(1971.267f, 2635.439f, 46.17389f));
                driver.Heading = 120.792f;
            }
            else
            {
                driver.Delete();
                driver = World.CreatePed(PedHash.Prisguard01SMM, new Vector3(1971.267f, 2635.439f, 46.17389f).Around(5f));
                driver.Heading = 120.792f;
            }
            driver.Task.WarpIntoVehicle(test_veh, VehicleSeat.Driver);

          //  Game.Player.CanControlCharacter = false;
            Game.Player.Character.Position = new Vector3(1971.267f, 2635.439f, 46.17389f).Around(10f);

           // Function.Call(Hash.DISABLE_ALL_CONTROL_ACTIONS, 1);

            Game.Player.Character.Task.WarpIntoVehicle(test_veh, VehicleSeat.Passenger);

            Function.Call(Hash.SET_PED_AS_GROUP_MEMBER, driver, -1533126372);
            Function.Call(Hash.SET_PED_AS_COP, driver, true);

            // 1   1858,746 : 2609,113 : 45,29342
            // 2   1831,064 : 2607,884 : 45,20006
            // 3   1754,864 : 2605,129 : 45,18484
            while (!Game.Player.Character.IsInVehicle(test_veh))
                Script.Wait(0);

            TaskSequence task = new TaskSequence();
           //     task.AddTask.DriveTo(test_veh, new Vector3(1900.457f, 2609.054f, 46.00166f), 3f, 10f, (int)DrivingStyle.Normal);
           //     task.AddTask.StandStill(5000);
            task.AddTask.DriveTo(test_veh, new Vector3(1855.855f, 2606.756f, 45.9304f), 3f, 10f, (int)DrivingStyle.Normal);
            task.AddTask.StandStill(5000);
            task.AddTask.DriveTo(test_veh, new Vector3(1831.152f, 2606.738f, 45.83254f), 3f, 10f, (int)DrivingStyle.Normal);
            task.AddTask.StandStill(5000);
            task.AddTask.DriveTo(test_veh, new Vector3(1754.018f, 2604.271f, 45.82404f), 3f, 10f, (int)DrivingStyle.Normal);
            task.AddTask.StandStill(50000);
            driver.Task.PerformSequence(task);
            task.Close();

            // new Vector3(1858.746f, 2609.113f, 45.29342f)
            // new Vector3(1831.064f, 2607.884f, 45.20006f)
            // new Vector3(1754.864f, 2605.129f, 45.18484f)

           //     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);
           //     Function.Call(Hash._0x9B12F9A24FABEDB0, t, 1819.27f, 2608.53f, 44.61f, 0, 0.0f, 50.0f, 0f);

        }
        if (e.KeyCode == Keys.O)
        {
            Function.Call(Hash.IGNORE_NEXT_RESTART, true);
        }
         /*  if (e.KeyCode == Keys.O)
        {
            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);
            Function.Call(Hash._0x9B12F9A24FABEDB0, t, 1819.27f, 2608.53f, 44.61f, 0, 0.0f, 50.0f, 0f);
        }

        if (e.KeyCode == Keys.P)
        {
            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);
            Function.Call(Hash._0x9B12F9A24FABEDB0, t, 1819.27f, 2608.53f, 44.61f, 1, 0.0f, 50.0f, 0f);
        }
          */
    }
Exemple #27
0
 /// <summary>
 /// Initialize the class.
 /// </summary>
 public FrontendInput()
 {
     _backsplash = new UIContainer(new Point(630, 670), new Size(600, 30), Color.Empty);
     _backsplash.Items.Add(_cursor = new UIRectangle(new Point(14, 5), new Size(1, 15), Color.Empty));
     _backsplash.Items.Add(_uitext = new UIText("", new Point(14, 5), 0.3f));
 }
Exemple #28
0
        private UIElement GetRightElement(PropertyInfo info, UIElement element, ref int maxHeight)
        {
            object value = info.GetValue(element);

            if (info.PropertyType == typeof(bool))
            {
                var check = new UICheckBox()
                {
                    AnchorPoint = new Vector2(0, 0.5f),
                    Pivot       = new Vector2(0, 0.5f),
                    Value       = (bool)value,
                };
                check.OnCheckedChange += (e, s) => {
                    info.SetValue(element, e.Value);
                    Editor.NotifyElementPropertyChange(this);
                };
                return(check);
            }
            else if (info.PropertyType == typeof(string))
            {
                var changer = new UITextBox()
                {
                    AnchorPoint = new Vector2(0, 0.5f),
                    Pivot       = new Vector2(0, 0.5f),
                    SizeFactor  = new Vector2(1, 1),
                    Text        = value.ToString(),
                    Size        = new Vector2(-8, 0),
                };
                if (info.SetMethod == null)
                {
                    changer.Editable = false;
                }
                changer.OnTextChange += (e, s) => {
                    info.SetValue(element, e.NewString);
                    Editor.NotifyElementPropertyChange(this);
                };
                return(changer);
            }
            else if (info.PropertyType == typeof(Color))
            {
                var color = new UIColorIdentifier(info, element)
                {
                    AnchorPoint = new Vector2(0, 0.5f),
                    Pivot       = new Vector2(0, 0.5f),
                    SizeFactor  = new Vector2(1, 1),
                    Color       = (Color)value,
                    Size        = new Vector2(-8, 0),
                };
                color.OnClick += (e, s) => {
                    Editor.OpenColorChooser(info, element, color);
                };
                return(color);
            }
            else if (info.PropertyType == typeof(Vector2))
            {
                var vector2 = new UIVector2(element, info)
                {
                    AnchorPoint = new Vector2(0, 0.5f),
                    Pivot       = new Vector2(0, 0.5f),
                    SizeFactor  = new Vector2(1, 1),
                };
                if (info.SetMethod == null)
                {
                    vector2.Editable = false;
                }
                vector2.OnValueChanged += (e, s) => {
                    info.SetValue(element, vector2.Value);
                    Editor.NotifyElementPropertyChange(this);
                };
                return(vector2);
            }
            else if (info.PropertyType == typeof(Rectangle))
            {
                var rect = new UIRectangle(element, info)
                {
                    AnchorPoint = new Vector2(0, 0.5f),
                    Pivot       = new Vector2(0, 0.5f),
                    SizeFactor  = new Vector2(1, 1),
                };
                if (info.SetMethod == null)
                {
                    rect.Editable = false;
                }
                rect.OnValueChanged += (e, s) => {
                    info.SetValue(element, rect.Value);
                    Editor.NotifyElementPropertyChange(this);
                };
                maxHeight = 65;
                return(rect);
            }
            else if (info.PropertyType == typeof(float))
            {
                var textF = new UIValueTextBoxEx <float>(element, info)
                {
                    AnchorPoint = new Vector2(0, 0.5f),
                    Pivot       = new Vector2(0, 0.5f),
                    SizeFactor  = new Vector2(1, 1),
                    Size        = new Vector2(-8, 0),
                };
                if (info.SetMethod == null)
                {
                    textF.Editable = false;
                }
                textF.OnValueChanged += (e, s) => {
                    info.SetValue(element, textF.Value);
                    Editor.NotifyElementPropertyChange(this);
                };
                return(textF);
            }
            else if (info.PropertyType.IsEnum)
            {
                var instance = new UIEnumSelector(element, info)
                {
                    AnchorPoint = new Vector2(0, 0.5f),
                    Pivot       = new Vector2(0, 0.5f),
                    SizeFactor  = new Vector2(1, 1),
                    Size        = new Vector2(-8, 0),
                };
                instance.HangElement    = this;
                instance.OnValueChange += (e, s) => {
                    info.SetValue(element, instance.Value);
                    Editor.NotifyElementPropertyChange(this);
                };
                return(instance);
            }
            var text = new UILabel()
            {
                AnchorPoint = new Vector2(0, 0.5f),
                Pivot       = new Vector2(0, 0.5f),
                Text        = (value == null) ? "null" : value.ToString(),
            };

            return(text);
        }
    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;
            }

        }
    }
Exemple #30
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;
                }
            }
        }
Exemple #31
0
        void Onkeyup(object sender, KeyEventArgs e)
        {
            if ((e.KeyCode == Keys.F12) && (Game.Player.WantedLevel > 1))
            {
                hours = 10 + (Game.Player.WantedLevel * 10);
                Game.Player.WantedLevel = 0;
                intial1();
            }
            if ((e.KeyCode == Keys.E) && arrested)
            {
                if ((Game.Player.Character.Position.DistanceTo(new Vector3(1691.709f, 2565.036f, 45.56487f)) < 2f) && (Game.Player.Money > 0x4c4b40))
                {
                    bail.Remove();
                    roit.Remove();
                    Game.Player.Character.Position = new Vector3(1849.555f, 2586.085f, 45.67202f);
                    Game.Player.Character.Heading  = 258.4564f;
                    Player player = Game.Player;
                    player.Money -= 0x4c4b40;
                    Function.Call(Hash.SET_MAX_WANTED_LEVEL, 5);
                    Function.Call(Hash.SET_PED_DEFAULT_COMPONENT_VARIATION, Game.Player.Character);
                    arrested          = false;
                    _headsup          = null;
                    _headsupRectangle = null;
                }
                if ((Game.Player.Character.Position.DistanceTo(new Vector3(1625.474f, 2491.485f, 45.62026f)) < 4f) && !escape)
                {
                    stop_scripts();
                    bail.Remove();
                    roit.Remove();
                    Player player2 = Game.Player;
                    player2.Money -= 0x4c4b40;
                    stop_scripts();
                    arrested          = false;
                    _headsup          = null;
                    _headsupRectangle = null;

                    Model mod = new Model(VehicleHash.Valkyrie);
                    mod.Request();
                    while (!mod.IsLoaded)
                    {
                        stop_scripts();
                        Script.Wait(0);
                    }
                    escape_veh3              = World.CreateVehicle(mod, new Vector3(-1179.25f, -2845.386f, 13.5665f));
                    escape_veh3.Heading      = 325.6199f;
                    escape_veh3.IsPersistent = true;
                    mod.MarkAsNoLongerNeeded();
                    //============================================================================================================
                    mod = new Model(VehicleHash.Comet2);
                    mod.Request();
                    while (!mod.IsLoaded)
                    {
                        stop_scripts();
                        Script.Wait(0);
                    }
                    escape_veh1              = World.CreateVehicle(mod, new Vector3(-1729.416f, -1109.523f, 12.7468f));
                    escape_veh1.Heading      = 321.1888f;
                    escape_veh1.IsPersistent = true;
                    mod.MarkAsNoLongerNeeded();
                    //===========================================================================================================
                    mod = new Model(VehicleHash.Insurgent2);
                    mod.Request();
                    while (!mod.IsLoaded)
                    {
                        stop_scripts();
                        Script.Wait(0);
                    }
                    escape_veh2              = World.CreateVehicle(mod, new Vector3(1373.179f, -2077.577f, 51.6181f));
                    escape_veh2.Heading      = 332.3142f;
                    escape_veh2.IsPersistent = true;
                    mod.MarkAsNoLongerNeeded();

                    int hash = Function.Call <int>(Hash.GET_ENTITY_MODEL, new InputArgument[] { Game.Player.Character });
                    if (hash == Function.Call <int>(Hash.GET_HASH_KEY, new InputArgument[] { "player_zero" })) //m
                    {
                        mod = new Model(PedHash.Franklin);
                        mod.Request();
                        while (!mod.IsLoaded)
                        {
                            stop_scripts();
                            Script.Wait(0);
                        }
                        escape_ped1              = World.CreatePed(mod, new Vector3(-1726.644f, -1112.538f, 13.2474f));
                        escape_ped1.Heading      = 42.1536f;
                        escape_ped1.IsPersistent = true;
                        mod.MarkAsNoLongerNeeded();

                        mod = new Model(PedHash.Trevor);
                        mod.Request();
                        while (!mod.IsLoaded)
                        {
                            stop_scripts();
                            Script.Wait(0);
                        }
                        escape_ped2              = World.CreatePed(mod, new Vector3(1376.8f, -2076.873f, 51.9985f));
                        escape_ped2.Heading      = 47.19263f;
                        escape_ped2.IsPersistent = true;
                        mod.MarkAsNoLongerNeeded();
                    }
                    else if (hash == Function.Call <int>(Hash.GET_HASH_KEY, new InputArgument[] { "player_one" })) //f
                    {
                        mod = new Model(PedHash.Michael);
                        mod.Request();
                        while (!mod.IsLoaded)
                        {
                            stop_scripts();
                            Script.Wait(0);
                        }
                        escape_ped1              = World.CreatePed(mod, new Vector3(-1726.644f, -1112.538f, 13.2474f));
                        escape_ped1.Heading      = 42.1536f;
                        escape_ped1.IsPersistent = true;
                        mod.MarkAsNoLongerNeeded();

                        mod = new Model(PedHash.Trevor);
                        mod.Request();
                        while (!mod.IsLoaded)
                        {
                            stop_scripts();
                            Script.Wait(0);
                        }
                        escape_ped2              = World.CreatePed(mod, new Vector3(1376.8f, -2076.873f, 51.9985f));
                        escape_ped2.Heading      = 47.19263f;
                        escape_ped2.IsPersistent = true;
                        mod.MarkAsNoLongerNeeded();
                    }
                    else if (hash == Function.Call <int>(Hash.GET_HASH_KEY, new InputArgument[] { "player_two" }))//tr
                    {
                        mod = new Model(PedHash.Michael);
                        mod.Request();
                        while (!mod.IsLoaded)
                        {
                            stop_scripts();
                            Script.Wait(0);
                        }
                        escape_ped1              = World.CreatePed(mod, new Vector3(-1726.644f, -1112.538f, 13.2474f));
                        escape_ped1.Heading      = 42.1536f;
                        escape_ped1.IsPersistent = true;
                        mod.MarkAsNoLongerNeeded();

                        mod = new Model(PedHash.Franklin);
                        mod.Request();
                        while (!mod.IsLoaded)
                        {
                            stop_scripts();
                            Script.Wait(0);
                        }
                        escape_ped2              = World.CreatePed(mod, new Vector3(1376.8f, -2076.873f, 51.9985f));
                        escape_ped2.Heading      = 47.19263f;
                        escape_ped2.IsPersistent = true;
                        mod.MarkAsNoLongerNeeded();
                    }
                    original_ped = Game.Player.Character;

                    Game.FadeScreenOut(3000);
                    while (!Function.Call <bool>(Hash.IS_SCREEN_FADED_OUT))
                    {
                        Script.Wait(0);
                    }
                    Function.Call(Hash.CHANGE_PLAYER_PED, Game.Player, escape_ped1, 1, 0);
                    Game.FadeScreenIn(3000);
                    while (!Function.Call <bool>(Hash.IS_SCREEN_FADED_IN))
                    {
                        Script.Wait(0);
                    }
                    current_ped = 1;
                    vehb        = escape_veh1.AddBlip();
                    vehb.Color  = BlipColor.Blue;
                    UI.ShowSubtitle("Get in the ~b~ Vehicle", 3000);
                    steps = 0;

                    player_status = status.In_escape;
                    Function.Call(Hash.SET_MAX_WANTED_LEVEL, 5);

                    escape = true;
                }
            }
            if (e.KeyCode == Keys.E && steps == 5)
            {
                if (current_ped == 1)
                {
                    Function.Call(Hash.CHANGE_PLAYER_PED, Game.Player, escape_ped2, 1, 0);
                    //drive task

                    current_ped = 2;
                }
                else
                {
                    Function.Call(Hash.CHANGE_PLAYER_PED, Game.Player, escape_ped1, 1, 0);
                    //shot task
                    escape_ped2.Task.FightAgainstHatedTargets(150f);
                    escape_ped2.AlwaysKeepTask = true;
                    current_ped = 1;
                }
            }
            if (((e.KeyCode == Keys.Y) && arrested) && (Game.Player.Character.Position.DistanceTo(escape_Ped.Position) < 4f))
            {
                time = Game.GameTime;
                int i;
                for (i = 0; i < prisoner.Count; i++)
                {
                    GiveWeapons_prisoner(prisoner[i]);
                    prisoner[i].CanSwitchWeapons = true;
                }
                for (i = 0; i < garde.Count; i++)
                {
                    GiveWeapons_Garde(garde[i]);
                    garde[i].CanSwitchWeapons = true;
                    //Function.Call(Hash.SET_BLOCKING_OF_NON_TEMPORARY_EVENTS, garde[i], true);
                }
                GiveWeapons_prisoner(Game.Player.Character);
                Player player3 = Game.Player;
                player3.Money -= 0x4c4b40;
                Function.Call(Hash.SET_RELATIONSHIP_BETWEEN_GROUPS, new InputArgument[] { 5, 0x7ea26372, -183807561 });
                Function.Call(Hash.SET_RELATIONSHIP_BETWEEN_GROUPS, new InputArgument[] { 5, -183807561, 0x7ea26372 });
            }


            if (((e.KeyCode == Keys.E) && (player_status == status.In_road)) && !sciped)
            {
                try
                {
                    Game.FadeScreenOut(3000);
                    while (!Function.Call <bool>(Hash.IS_SCREEN_FADED_OUT))
                    {
                        Script.Wait(0);
                    }

                    policecar.Position = new Vector3(2124.503f, 2760.919f, 49.1893f);
                    policecar.Heading  = 130.5902f;

                    Game.FadeScreenIn(3000);
                    sciped = true;
                }
                catch (Exception ex)
                {
                    SimpleLog.Error(ex);
                    throw;
                }
            }
        }
    void Onkeyup(object sender, KeyEventArgs e)
    {
        if (e.KeyCode == Keys.F12 && Game.Player.WantedLevel > 1)
        {
            hours = 10 + Game.Player.WantedLevel * 10;
            Game.Player.WantedLevel = 0;
            intial1();
        }

        /*  if (e.KeyCode == Keys.F11)
         * {
         *    Ped[] test = World.GetNearbyPeds(Game.Player.Character, 100f);
         *    int player_group = Function.Call<int>(Hash.GET_PED_RELATIONSHIP_GROUP_HASH, test[0]);
         *    GTA.UI.ShowSubtitle(player_group + " ");
         * }
         */

        if (e.KeyCode == Keys.E && arrested)
        {
            if (Game.Player.Character.Position.DistanceTo(new Vector3(1691.709f, 2565.036f, 45.56487f)) < 2f)
            {
                // bail
                if (Game.Player.Money > 5000000)
                {
                    bail.Remove();
                    roit.Remove();
                    Game.Player.Character.Position = new Vector3(1849.555f, 2586.085f, 45.67202f);
                    Game.Player.Character.Heading  = 258.4564f;
                    Game.Player.Money -= 5000000;
                    Function.Call(Hash.SET_MAX_WANTED_LEVEL, 5);

                    Function.Call(Hash.SET_PED_DEFAULT_COMPONENT_VARIATION, Game.Player.Character);
                    arrested = false;

                    _headsup          = null;
                    _headsupRectangle = null;
                }
                else
                {
                }
            }

            if (Game.Player.Character.Position.DistanceTo(new Vector3(1625.474f, 2491.485f, 45.62026f)) < 4f && !escape)
            {
                Function.Call(Hash.TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME, "respawn_controller");
                Function.Call(Hash.TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME, "re_prison");
                bail.Remove();
                roit.Remove();
                Game.Player.Money -= 5000000;
                Function.Call(Hash.TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME, "respawn_controller");
                Function.Call(Hash.TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME, "re_prison");
                // 182.3307f , -885.7198f , 31.11671f :=> 51.15437f


                Function.Call(Hash.TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME, "respawn_controller");
                Function.Call(Hash.TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME, "re_prison");
                //  -1083,942 : -2915,736 : 13,23366 :=> 285,5021
                if (help_veh == null)
                {
                    help_veh = World.CreateVehicle(VehicleHash.Maverick, new Vector3(1649.463f, 2619.634f, 45.56486f));
                }
                else
                {
                    help_veh.Delete();
                    help_veh = World.CreateVehicle(VehicleHash.Maverick, new Vector3(1649.463f, 2619.634f, 45.56486f));
                }
                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.SET_ENTITY_AS_MISSION_ENTITY, help_veh, true, true);
                help_veh.Heading = 10.83339f;


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

                bail       = World.CreateBlip(help_veh.Position);
                bail.Color = BlipColor.Blue;

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


                GiveAllWeapons(Game.Player.Character);

                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.PAUSE_CLOCK, false);

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

                arrested          = false;
                _headsup          = null;
                _headsupRectangle = null;

                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.SET_CLOCK_TIME, 13, 00, 0);
                Function.Call(Hash.SET_MAX_WANTED_LEVEL, 5);
                Game.Player.WantedLevel = 4;



                escape = true;
            }
        }
        if (e.KeyCode == Keys.Y && arrested)
        {
            //  prisoner groupe   2124571506
            //  garde    groupe   -183807561
            if (Game.Player.Character.Position.DistanceTo(escape_Ped.Position) < 4f)
            {
                for (int i = 0; i < prisoner.Count; i++)
                {
                    GiveAllWeapons1(prisoner[i]);
                    prisoner[i].CanSwitchWeapons = true;
                }

                for (int i = 0; i < garde.Count; i++)
                {
                    GiveAllWeapons2(garde[i]);
                    garde[i].CanSwitchWeapons = true;
                }


                GiveAllWeapons1(Game.Player.Character);
                Game.Player.Money -= 5000000;

                Function.Call(Hash.SET_RELATIONSHIP_BETWEEN_GROUPS, (int)Relationship.Hate, 2124571506, -183807561);
                Function.Call(Hash.SET_RELATIONSHIP_BETWEEN_GROUPS, (int)Relationship.Hate, -183807561, 2124571506);
            }
        }
        if (e.KeyCode == Keys.U)
        {
            Function.Call(Hash.ENABLE_ALL_CONTROL_ACTIONS, 1);
            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);
        }
        if (e.KeyCode == Keys.Y)
        {
            Function.Call(Hash.SET_MAX_WANTED_LEVEL, 5);
        }
        if (e.KeyCode == Keys.F6)
        {
            // PBUS
            // VehicleHash.PBus
            // 1971.267f , 2635.439f , 46.17389f :=> 120.792f
            // 1608.376f , 2685.54f , 45.32081f :=> 143.341f
            testt = true;
            if (test_veh == null)
            {
                test_veh         = World.CreateVehicle(VehicleHash.PBus, new Vector3(1971.267f, 2635.439f, 46.17389f));
                test_veh.Heading = 120.792f;
            }
            else
            {
                test_veh.Delete();
                test_veh         = World.CreateVehicle(VehicleHash.PBus, new Vector3(1971.267f, 2635.439f, 46.17389f));
                test_veh.Heading = 120.792f;
            }

            if (driver == null)
            {
                driver         = World.CreatePed(PedHash.Prisguard01SMM, new Vector3(1971.267f, 2635.439f, 46.17389f));
                driver.Heading = 120.792f;
            }
            else
            {
                driver.Delete();
                driver         = World.CreatePed(PedHash.Prisguard01SMM, new Vector3(1971.267f, 2635.439f, 46.17389f).Around(5f));
                driver.Heading = 120.792f;
            }
            driver.Task.WarpIntoVehicle(test_veh, VehicleSeat.Driver);

            //  Game.Player.CanControlCharacter = false;
            Game.Player.Character.Position = new Vector3(1971.267f, 2635.439f, 46.17389f).Around(10f);

            // Function.Call(Hash.DISABLE_ALL_CONTROL_ACTIONS, 1);


            Game.Player.Character.Task.WarpIntoVehicle(test_veh, VehicleSeat.Passenger);

            Function.Call(Hash.SET_PED_AS_GROUP_MEMBER, driver, -1533126372);
            Function.Call(Hash.SET_PED_AS_COP, driver, true);

            // 1   1858,746 : 2609,113 : 45,29342
            // 2   1831,064 : 2607,884 : 45,20006
            // 3   1754,864 : 2605,129 : 45,18484
            while (!Game.Player.Character.IsInVehicle(test_veh))
            {
                Script.Wait(0);
            }

            TaskSequence task = new TaskSequence();
            //     task.AddTask.DriveTo(test_veh, new Vector3(1900.457f, 2609.054f, 46.00166f), 3f, 10f, (int)DrivingStyle.Normal);
            //     task.AddTask.StandStill(5000);
            task.AddTask.DriveTo(test_veh, new Vector3(1855.855f, 2606.756f, 45.9304f), 3f, 10f, (int)DrivingStyle.Normal);
            task.AddTask.StandStill(5000);
            task.AddTask.DriveTo(test_veh, new Vector3(1831.152f, 2606.738f, 45.83254f), 3f, 10f, (int)DrivingStyle.Normal);
            task.AddTask.StandStill(5000);
            task.AddTask.DriveTo(test_veh, new Vector3(1754.018f, 2604.271f, 45.82404f), 3f, 10f, (int)DrivingStyle.Normal);
            task.AddTask.StandStill(50000);
            driver.Task.PerformSequence(task);
            task.Close();

            // new Vector3(1858.746f, 2609.113f, 45.29342f)
            // new Vector3(1831.064f, 2607.884f, 45.20006f)
            // new Vector3(1754.864f, 2605.129f, 45.18484f)


            //     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);
            //     Function.Call(Hash._0x9B12F9A24FABEDB0, t, 1819.27f, 2608.53f, 44.61f, 0, 0.0f, 50.0f, 0f);
        }
        if (e.KeyCode == Keys.O)
        {
            Function.Call(Hash.IGNORE_NEXT_RESTART, true);
        }

        /*  if (e.KeyCode == Keys.O)
         * {
         *     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);
         *     Function.Call(Hash._0x9B12F9A24FABEDB0, t, 1819.27f, 2608.53f, 44.61f, 0, 0.0f, 50.0f, 0f);
         * }
         *
         * if (e.KeyCode == Keys.P)
         * {
         *     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);
         *     Function.Call(Hash._0x9B12F9A24FABEDB0, t, 1819.27f, 2608.53f, 44.61f, 1, 0.0f, 50.0f, 0f);
         * }
         */
    }
Exemple #33
0
        void Onkeyup(object sender, KeyEventArgs e)
        {
            if ((e.KeyCode == Keys.F12) && (Game.Player.WantedLevel > 1))
            {
            hours = 10 + (Game.Player.WantedLevel * 10);
            Game.Player.WantedLevel = 0;
            intial1();
            }
            if ((e.KeyCode == Keys.E) && arrested)
            {
            if ((Game.Player.Character.Position.DistanceTo(new Vector3(1691.709f, 2565.036f, 45.56487f)) < 2f) && (Game.Player.Money > 0x4c4b40))
            {
                bail.Remove();
                roit.Remove();
                Game.Player.Character.Position = new Vector3(1849.555f, 2586.085f, 45.67202f);
                Game.Player.Character.Heading = 258.4564f;
                Player player = Game.Player;
                player.Money -= 0x4c4b40;
                Function.Call(Hash.SET_MAX_WANTED_LEVEL, 5 );
                Function.Call(Hash.SET_PED_DEFAULT_COMPONENT_VARIATION, Game.Player.Character);
                arrested = false;
                _headsup = null;
                _headsupRectangle = null;
            }
            if ((Game.Player.Character.Position.DistanceTo(new Vector3(1625.474f, 2491.485f, 45.62026f)) < 4f) && !escape)
            {
                stop_scripts();
                bail.Remove();
                roit.Remove();
                Player player2 = Game.Player;
                player2.Money -= 0x4c4b40;
                stop_scripts();
                arrested = false;
                _headsup = null;
                _headsupRectangle = null;

                Model mod = new Model(VehicleHash.Valkyrie);
                mod.Request();
                while (!mod.IsLoaded)
                {
                    stop_scripts();
                    Script.Wait(0);
                }
                escape_veh3 = World.CreateVehicle(mod, new Vector3(-1179.25f, -2845.386f, 13.5665f));
                escape_veh3.Heading = 325.6199f;
                escape_veh3.IsPersistent = true;
                mod.MarkAsNoLongerNeeded();
                //============================================================================================================
                mod = new Model(VehicleHash.Comet2);
                mod.Request();
                while (!mod.IsLoaded)
                {
                    stop_scripts();
                    Script.Wait(0);
                }
                escape_veh1 = World.CreateVehicle(mod, new Vector3(-1729.416f, -1109.523f, 12.7468f));
                escape_veh1.Heading = 321.1888f;
                escape_veh1.IsPersistent = true;
                mod.MarkAsNoLongerNeeded();
                //===========================================================================================================
                mod = new Model(VehicleHash.Insurgent2);
                mod.Request();
                while (!mod.IsLoaded)
                {
                    stop_scripts();
                    Script.Wait(0);
                }
                escape_veh2 = World.CreateVehicle(mod, new Vector3(1373.179f, -2077.577f, 51.6181f));
                escape_veh2.Heading = 332.3142f;
                escape_veh2.IsPersistent = true;
                mod.MarkAsNoLongerNeeded();

                int hash = Function.Call<int>(Hash.GET_ENTITY_MODEL, new InputArgument[] { Game.Player.Character });
                if (hash == Function.Call<int>(Hash.GET_HASH_KEY, new InputArgument[] { "player_zero" }))    //m
                {
                    mod = new Model(PedHash.Franklin);
                    mod.Request();
                    while (!mod.IsLoaded)
                    {
                        stop_scripts();
                        Script.Wait(0);
                    }
                    escape_ped1 = World.CreatePed(mod, new Vector3(-1726.644f, -1112.538f, 13.2474f));
                    escape_ped1.Heading = 42.1536f;
                    escape_ped1.IsPersistent = true;
                    mod.MarkAsNoLongerNeeded();

                    mod = new Model(PedHash.Trevor);
                    mod.Request();
                    while (!mod.IsLoaded)
                    {
                        stop_scripts();
                        Script.Wait(0);
                    }
                    escape_ped2 = World.CreatePed(mod, new Vector3(1376.8f, -2076.873f, 51.9985f));
                    escape_ped2.Heading = 47.19263f;
                    escape_ped2.IsPersistent = true;
                    mod.MarkAsNoLongerNeeded();

                }
                else if (hash == Function.Call<int>(Hash.GET_HASH_KEY, new InputArgument[] { "player_one" })) //f
                {
                    mod = new Model(PedHash.Michael);
                    mod.Request();
                    while (!mod.IsLoaded)
                    {
                        stop_scripts();
                        Script.Wait(0);
                    }
                    escape_ped1 = World.CreatePed(mod, new Vector3(-1726.644f, -1112.538f, 13.2474f));
                    escape_ped1.Heading = 42.1536f;
                    escape_ped1.IsPersistent = true;
                    mod.MarkAsNoLongerNeeded();

                    mod = new Model(PedHash.Trevor);
                    mod.Request();
                    while (!mod.IsLoaded)
                    {
                        stop_scripts();
                        Script.Wait(0);
                    }
                    escape_ped2 = World.CreatePed(mod, new Vector3(1376.8f, -2076.873f, 51.9985f));
                    escape_ped2.Heading = 47.19263f;
                    escape_ped2.IsPersistent = true;
                    mod.MarkAsNoLongerNeeded();
                }
                else if (hash == Function.Call<int>(Hash.GET_HASH_KEY, new InputArgument[] { "player_two" }))//tr
                {
                    mod = new Model(PedHash.Michael);
                    mod.Request();
                    while (!mod.IsLoaded)
                    {
                        stop_scripts();
                        Script.Wait(0);
                    }
                    escape_ped1 = World.CreatePed(mod, new Vector3(-1726.644f, -1112.538f, 13.2474f));
                    escape_ped1.Heading = 42.1536f;
                    escape_ped1.IsPersistent = true;
                    mod.MarkAsNoLongerNeeded();

                    mod = new Model(PedHash.Franklin);
                    mod.Request();
                    while (!mod.IsLoaded)
                    {
                        stop_scripts();
                        Script.Wait(0);
                    }
                    escape_ped2 = World.CreatePed(mod, new Vector3(1376.8f, -2076.873f, 51.9985f));
                    escape_ped2.Heading = 47.19263f;
                    escape_ped2.IsPersistent = true;
                    mod.MarkAsNoLongerNeeded();
                }
                original_ped = Game.Player.Character;

                Game.FadeScreenOut(3000);
                while (!Function.Call<bool>(Hash.IS_SCREEN_FADED_OUT))
                    Script.Wait(0);
                Function.Call(Hash.CHANGE_PLAYER_PED, Game.Player, escape_ped1, 1, 0);
                Game.FadeScreenIn(3000);
                while (!Function.Call<bool>(Hash.IS_SCREEN_FADED_IN))
                    Script.Wait(0);
                current_ped = 1;
                vehb = escape_veh1.AddBlip();
                vehb.Color = BlipColor.Blue;
                UI.ShowSubtitle("Get in the ~b~ Vehicle",3000);
                steps = 0;

                player_status = status.In_escape;
                Function.Call(Hash.SET_MAX_WANTED_LEVEL,  5);

                escape = true;
            }
            }
            if (e.KeyCode == Keys.E && steps == 5)
            {
            if (current_ped == 1)
            {
                Function.Call(Hash.CHANGE_PLAYER_PED, Game.Player, escape_ped2, 1, 0);
                //drive task

                current_ped = 2;
            }
            else
            {
                Function.Call(Hash.CHANGE_PLAYER_PED, Game.Player, escape_ped1, 1, 0);
                //shot task
                escape_ped2.Task.FightAgainstHatedTargets(150f);
                escape_ped2.AlwaysKeepTask = true;
                current_ped = 1;
            }
            }
            if (((e.KeyCode == Keys.Y) && arrested) && (Game.Player.Character.Position.DistanceTo(escape_Ped.Position) < 4f))
            {
            time = Game.GameTime;
            int i;
            for (i = 0; i < prisoner.Count; i++)
            {
                GiveWeapons_prisoner(prisoner[i]);
                prisoner[i].CanSwitchWeapons = true;

            }
            for (i = 0; i < garde.Count; i++)
            {
                GiveWeapons_Garde(garde[i]);
                garde[i].CanSwitchWeapons = true;
                //Function.Call(Hash.SET_BLOCKING_OF_NON_TEMPORARY_EVENTS, garde[i], true);

            }
            GiveWeapons_prisoner(Game.Player.Character);
            Player player3 = Game.Player;
            player3.Money -= 0x4c4b40;
            Function.Call(Hash.SET_RELATIONSHIP_BETWEEN_GROUPS, new InputArgument[] { 5, 0x7ea26372, -183807561 });
            Function.Call(Hash.SET_RELATIONSHIP_BETWEEN_GROUPS, new InputArgument[] { 5, -183807561, 0x7ea26372 });
            }

            if (((e.KeyCode == Keys.E) && (player_status == status.In_road)) && !sciped)
            {
            try
            {
                Game.FadeScreenOut(3000);
                while (!Function.Call<bool>(Hash.IS_SCREEN_FADED_OUT))
                {
                    Script.Wait(0);
                }

                policecar.Position = new Vector3(2124.503f, 2760.919f, 49.1893f);
                policecar.Heading = 130.5902f;

                Game.FadeScreenIn(3000);
                sciped = true;
            }
            catch (Exception ex)
            {
                SimpleLog.Error(ex);
                throw;
            }

            }
        }
        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;
                }
            }
        }
Exemple #35
0
        // on start create ui
        protected override void Start()
        {
            // set cursor stylesheet
            UI.SetCursor("ui/cursor.ini");

            // create ui root
            _uiroot = UI.CreateRoot();

            // create button and list window
            var buttonAndListWindow = UI.CreateWindow("ui/window.ini", _uiroot, "Button, DropDown & List");

            buttonAndListWindow.AutoArrangeChildren = true;
            buttonAndListWindow.Offset = new PointI(40, 30);
            buttonAndListWindow.Grow(0, 50);

            // add into text and button
            UI.CreateText("ui/small_text.ini", buttonAndListWindow, "This demo shows UI elements. \nFor example, here's a button:");
            var button      = UI.CreateButton("ui/button.ini", buttonAndListWindow, "Click Me!");
            int clickCounts = 1;

            button.OnMouseReleased((UIElement elem) =>
            {
                button.Caption.Text = "Thanks! Clicks: " + clickCounts++;
            });

            // add a dropdown
            var dropdownTitle = UI.CreateText("ui/small_text.ini", buttonAndListWindow, "Here's a DropDown:");
            var dropdown      = UI.CreateDropDown("ui/dropdown.ini", buttonAndListWindow);

            dropdown.PlaceholderText = "Click to show options.";
            for (var i = 1; i <= 15; ++i)
            {
                dropdown.AddItem("Item #" + i);
            }

            // add a list
            var listTitle = UI.CreateText("ui/small_text.ini", buttonAndListWindow, "And here's a List:");
            var list      = UI.CreateList("ui/list.ini", buttonAndListWindow);

            for (var i = 1; i <= 15; ++i)
            {
                list.AddItem("Item #" + i);
            }

            // add text to show selected
            var listSelected = UI.CreateText("ui/small_text.ini", buttonAndListWindow, "Selected: ");

            list.OnValueChange((UIElement element) =>
            {
                listSelected.Text = "Selected: " + list.SelectedItem;
            });

            // create another window for checkboxes and slider
            var checkboxSliderWindow = UI.CreateWindow("ui/window.ini", _uiroot, "Checkbox, Radio & Slider");

            checkboxSliderWindow.Offset = new PointI(140, 60);
            checkboxSliderWindow.AutoArrangeChildren = true;

            // some checkboxes
            UI.CreateText("ui/small_text.ini", checkboxSliderWindow, "Checkboxes: ");
            var checkbox1 = UI.CreateCheckBox("ui/checkbox.ini", checkboxSliderWindow, "This is a checkbox");

            _debugDrawCheckbox = UI.CreateCheckBox("ui/checkbox.ini", checkboxSliderWindow, "Debug draw UI");

            // some radio buttons
            var radioIntro = UI.CreateText("ui/small_text.ini", checkboxSliderWindow, "Radio buttons: ");

            for (var i = 1; i <= 3; ++i)
            {
                var radio = UI.CreateRadioButton("ui/radiobutton.ini", checkboxSliderWindow, "Radio Button #" + i);
            }

            // add slider
            var sliderText = UI.CreateText("ui/small_text.ini", checkboxSliderWindow, "Slider Input [value=0]:");
            var slider     = UI.CreateSlider("ui/slider.ini", checkboxSliderWindow);

            slider.OnValueChange((UIElement element) =>
            {
                sliderText.Text = "Slider Input [value=" + slider.Value + "]:";
            });

            // create another window for text inputs
            var textInputsWindow = UI.CreateWindow("ui/window.ini", _uiroot, "Text Inputs");

            textInputsWindow.Offset = new PointI(240, 90);
            textInputsWindow.AutoArrangeChildren = true;

            // add text input
            UITextInput textInput = UI.CreateTextInput("ui/textinput.ini", textInputsWindow, "", "Free text input..");

            textInput.MaxLength = 16;

            // add numbers input
            UITextInput numbersInput = UI.CreateTextInput("ui/textinput.ini", textInputsWindow, "", "Numbers input..");

            numbersInput.InputMode = UITextInputMode.NumbersOnly;
            numbersInput.MaxLength = 16;

            // add characters input
            UITextInput alphaInput = UI.CreateTextInput("ui/textinput.ini", textInputsWindow, "", "Alpha input..");

            alphaInput.InputMode = UITextInputMode.AlphaOnly;
            alphaInput.MaxLength = 16;

            // add numbers and alpha input
            UITextInput numbersAlphaInput = UI.CreateTextInput("ui/textinput.ini", textInputsWindow, "", "Numbers & alpha input..");

            numbersAlphaInput.InputMode = UITextInputMode.NumbersOnly | UITextInputMode.AlphaOnly;
            numbersAlphaInput.MaxLength = 16;

            // add upper input
            UITextInput upperInput = UI.CreateTextInput("ui/textinput.ini", textInputsWindow, "", "UPPERCASE INPUT..");

            upperInput.InputMode = UITextInputMode.Uppercase;
            upperInput.MaxLength = 16;

            // add lower input
            UITextInput lowerInput = UI.CreateTextInput("ui/textinput.ini", textInputsWindow, "", "lowercase input..");

            lowerInput.InputMode = UITextInputMode.Lowercase;
            lowerInput.MaxLength = 16;

            // add upper alpha input
            UITextInput upperAlphaInput = UI.CreateTextInput("ui/textinput.ini", textInputsWindow, "", "UPPERCASE ALPHA INPUT..");

            upperAlphaInput.InputMode = UITextInputMode.Uppercase | UITextInputMode.AlphaOnly;
            upperAlphaInput.MaxLength = 16;

            // create additional window for columns
            UIWindow columnsWindow = UI.CreateWindow("ui/window.ini", _uiroot, "Columns");

            columnsWindow.AutoArrangeChildren = true;
            columnsWindow.SizePixels          = new PointI(400, 450);
            columnsWindow.Offset = new PointI(340, 120);

            // create some test columns
            {
                UIElement   column = columnsWindow.CreateColumn(null, 80);
                UIRectangle rect   = UI.CreateRectangle(null, column);
                rect.SetSizeToMax();
                rect.Color  = Color.Red;
                rect.Filled = false;
            }
            {
                UIElement   column = columnsWindow.CreateColumn(null, 70);
                UIRectangle rect   = UI.CreateRectangle(null, column);
                rect.SetSizeToMax();
                rect.Color  = Color.Orange;
                rect.Filled = false;
            }
            {
                UIElement   column = columnsWindow.CreateColumn(null, 80, alignment: UIAlignment.Right);
                UIRectangle rect   = UI.CreateRectangle(null, column);
                rect.SetSizeToMax();
                rect.Color  = Color.Blue;
                rect.Filled = false;
            }
            {
                UIElement   column = columnsWindow.CreateColumn(null, 70, alignment: UIAlignment.Right);
                UIRectangle rect   = UI.CreateRectangle(null, column);
                rect.SetSizeToMax();
                rect.Color  = Color.Teal;
                rect.Filled = false;
            }
            {
                UIElement   column = columnsWindow.CreateColumn(null, 50, alignment: UIAlignment.Center);
                UIRectangle rect   = UI.CreateRectangle(null, column);
                rect.SetSizeToMax();
                rect.Color  = Color.Black;
                rect.Filled = false;
            }
            UI.CreateText("ui/small_text.ini", columnsWindow,
                          "Columns allow you to divide containers into sections. Its useful when you need to place elements side by side.");

            // order windows
            textInputsWindow.MoveToFront();
            checkboxSliderWindow.MoveToFront();
            buttonAndListWindow.MoveToFront();
        }
Exemple #36
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;
            }
        }
    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)
    {
        //  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;
            }
        }
    }
Exemple #39
0
 private void CreateCrosshair()
 {
     _uiContainerCrosshair = new UIContainer(new Point(0, 0), new Size(4, 4), Color.FromArgb(0, 0, 0, 0));
     var crosshair1 = new UIRectangle(new Point(0, 0), new Size(4, 4), Color.FromArgb(220, 0, 0, 0));
     _uiContainerCrosshair.Items.Add(crosshair1);
     var crosshair2 = new UIRectangle(new Point(1, 1), new Size(2, 2), Color.FromArgb(220, 255, 255, 255));
     _uiContainerCrosshair.Items.Add(crosshair2);
 }
Exemple #40
0
 public void PushUIRectangle(UIRectangle rectangle)
 {
     rectangle.AlignVertically();
     rectangle.AlignHorizontally();
     _drawingObjects.Add(rectangle);
 }