Esempio n. 1
0
        public GTA5Wasted()
        {
            PlayerConnected += delegate(Entity player)
            {
                HudElem hud = HudElem.CreateFontString(player, "hudbig", 2.3f);
                hud.SetPoint("center", "center", 0, -20);
                hud.SetText("Wasted");
                hud.Color     = new Vector3(255f, 0f, 0f);
                hud.GlowColor = new Vector3(0.2f, 0.2f, 0.2f);
                hud.GlowAlpha = 0.8f;
                hud.Alpha     = 0f;

                HudElem overlay = HudElem.CreateIcon(player, "combathigh_overlay", 640, 480);
                overlay.X         = 0f;
                overlay.Y         = 0f;
                overlay.AlignX    = "left";
                overlay.AlignY    = "top";
                overlay.HorzAlign = "fullscreen";
                overlay.VertAlign = "fullscreen";
                overlay.Color     = new Vector3(0.2f, 0.2f, 0.2f);
                overlay.Alpha     = 0f;

                player.SetField("gta5_hud", new Parameter(hud));
                player.SetField("gta5_overlay", new Parameter(overlay));
                player.SetField("gta5_dead", 0);

                player.SpawnedPlayer += delegate
                {
                    hud.Alpha     = 0f;
                    overlay.Alpha = 0f;

                    player.SetField("gta5_dead", 0);
                };
            };
        }
Esempio n. 2
0
        public static Dictionary <string, HudElem> CreateBar(this Entity self, byte width = 120, byte height = 9)
        {
            HudElem backGround = HudElem.CreateIcon(self, "black", width, height);

            backGround.SetPoint("center left", "center", -61, 0);
            backGround.Sort  = -3;
            backGround.Alpha = 0;

            HudElem whiteProgres = HudElem.CreateIcon(self, "progress_bar_bg", 1, height - 3);

            whiteProgres.SetPoint("center left", "center", -60, 0);
            whiteProgres.Sort  = -2;
            whiteProgres.Color = new Vector3(1, 1, 1);
            whiteProgres.Alpha = 0;

            HudElem textCapturing = HudElem.CreateFontString(self, "HudSmall", 0.8f);

            textCapturing.SetPoint("center", "center", 0, -12);
            textCapturing.SetText("Capturing...");
            textCapturing.Sort  = -1;
            textCapturing.Color = new Vector3(1, 1, 1);
            textCapturing.Alpha = 0;

            return(new Dictionary <string, HudElem>()
            {
                { "BackGround", backGround },
                { "Progress", whiteProgres },
                { "Text", textCapturing }
            });
        }
        private void CreatePerkHUD(Entity player)
        {
            var icons = new HudElem[3];

            new[] { -300, -250, -200 }.ToList().ForEach(y =>
            {
                var i = (y + 300) / 50;

                var elem = HudElem.CreateIcon(player, "specialty_quickdraw_upgrade", 40, 40);
                elem.SetPoint("bottom right", "bottom right", -120, y);
                elem.Alpha          = 0;
                elem.HideWhenInMenu = true;
                elem.Foreground     = true;

                icons[i] = elem;
            });

            player.SetField("shrp_perkIcons", new Parameter(icons));

            var names = new HudElem[3];

            new[] { -275, -225, -175 }.ToList().ForEach(y =>
            {
                var i = (y + 275) / 50;

                var elem       = HudElem.NewClientHudElem(player);
                elem.X         = 40;
                elem.Y         = y;
                elem.AlignX    = "right";
                elem.AlignY    = "bottom";
                elem.HorzAlign = "right";
                elem.VertAlign = "bottom";
                elem.FontScale = 1.5f;
                elem.SetText("Quickdraw");
                elem.Alpha          = 0;
                elem.HideWhenInMenu = true;
                elem.Foreground     = true;

                names[i] = elem;
            });

            player.SetField("shrp_perkNames", new Parameter(names));
        }
Esempio n. 4
0
        private void startUI(Entity player)
        {
            HudElem title = HudElem.CreateFontString(player, HudElem.Fonts.HudBig, 1);

            title.SetPoint("CENTER", "CENTER");
            title.HideWhenInMenu = true;
            title.Foreground     = true;
            title.SetText("Select Specialist ([{+actionslot 5}] & [{vote no}]):\n" + getSpecialistName(player.GetField <int>("currentSelection")));
            player.SetField("nameUI", title);

            HudElem ring = HudElem.CreateIcon(player, "compassping_portable_radar_sweep", 64, 64);

            ring.SetPoint("BOTTOMRIGHT", "BOTTOMRIGHT", -50, -50);
            ring.Color          = new Vector3(1, 1, 1);
            ring.Foreground     = true;
            ring.Alpha          = .9f;
            ring.Archived       = true;
            ring.HideWhenInMenu = true;
            player.SetField("hud_timerRing", ring);
        }
Esempio n. 5
0
        private static void thrusterHUD(Entity player)
        {
            HudElem thrusterBarBG = HudElem.CreateIcon(player, "white", 105, 5);

            thrusterBarBG.Alpha = 0;
            thrusterBarBG.SetPoint("center", "center", 0, 50);
            thrusterBarBG.HideWhenInMenu = true;
            thrusterBarBG.Archived       = true;
            thrusterBarBG.Foreground     = false;
            HudElem thrusterBar = HudElem.CreateIcon(player, "line_horizontal", 100, 3);

            thrusterBar.Alpha = 0;
            //thrusterBar.AlignX = "center";
            //thrusterBar.AlignY = "center";
            thrusterBar.SetPoint("center", "center", 0, 50);
            thrusterBar.HideWhenInMenu = true;
            thrusterBar.Archived       = true;
            thrusterBar.Foreground     = true;
            thrusterBar.Parent         = thrusterBarBG;
            player.SetField("hud_thrusterBar", new Parameter(thrusterBar));
        }
Esempio n. 6
0
        public static void CreateStreakHUD(this Entity self)
        {
            if (self.HasField("streaknameHUD") ||
                self.HasField("streakiconHUD") ||
                self.HasField("pointstreakHUD"))
            {
                return;
            }

            HudElem StreakIcon = HudElem.CreateIcon(self, "", 40, 40);

            StreakIcon.SetPoint("center top", "center top", 0, 40);
            StreakIcon.HideWhenInMenu = false;
            StreakIcon.Archived       = false;
            StreakIcon.Alpha          = 0;

            HudElem StreakName = HudElem.CreateFontString(self, "HudBig", 0.7f);

            StreakName.SetPoint("center top", "center top", 0, 85);
            StreakName.HideWhenInMenu = false;
            StreakName.GlowAlpha      = 1;
            StreakName.Archived       = false;
            StreakName.GlowColor      = new Vector3(0, 1, 0);
            StreakName.Alpha          = 0;

            HudElem PointStreak = HudElem.CreateFontString(self, "HudSmall", 1.2f);

            PointStreak.SetPoint("center top", "center top", 0, 105);
            PointStreak.HideWhenInMenu = false;
            PointStreak.GlowAlpha      = 1;
            PointStreak.Archived       = false;
            PointStreak.GlowColor      = new Vector3(0, 0, 0);
            PointStreak.Alpha          = 0;


            self.SetField("streaknameHUD", new Parameter(StreakName));
            self.SetField("streakiconHUD", new Parameter(StreakIcon));
            self.SetField("pointstreakHUD", new Parameter(PointStreak));
        }
Esempio n. 7
0
        private void GivePerkHud(Entity player, string name, string perk, string color)
        {
            HudElem perkicon = HudElem.CreateIcon(player, perk, 90, 90);

            perkicon.Parent = HudElem.UIParent;
            perkicon.SetPoint("TOPCENTER", "TOPCENTER", 0, 60);
            perkicon.SetShader(perk, 90, 90);
            perkicon.Foreground     = true;
            perkicon.HideWhenInMenu = true;
            AfterDelay(1400, () => { perkicon.Destroy(); });

            HudElem perkname = HudElem.CreateFontString(player, HudElem.Fonts.HudBig, 1f);

            perkname.SetPoint("TOPCENTER", "TOPCENTER", 0, 165);
            perkname.SetText(name);
            perkname.GlowAlpha = 1f;
            perkname.SetPulseFX(100, 1000, 600);

            switch (color)
            {
            case "green":
                perkname.GlowColor = (new Vector3(0f, 1f, 0f));
                break;

            case "blue":
                perkname.GlowColor = (new Vector3(0f, 0f, 1f));
                break;

            case "red":
                perkname.GlowColor = (new Vector3(1f, 0f, 0f));
                break;

            default:
                perkname.GlowColor = (new Vector3(245f, 208f, 051f));
                break;
            }
        }
Esempio n. 8
0
        public static HudElem createPrimaryProgressBar(Entity player, int xOffset, int yOffset)
        {
            HudElem progressBar = HudElem.CreateIcon(player, "progress_bar_fill", 0, 9);//NewClientHudElem(player);

            progressBar.SetField("frac", 0);
            progressBar.Color  = new Vector3(1, 1, 1);
            progressBar.Sort   = -2;
            progressBar.Shader = "progress_bar_fill";
            progressBar.SetShader("progress_bar_fill", 1, 9);
            progressBar.Alpha = 1;
            progressBar.SetPoint("center", "", 0, -61);
            progressBar.AlignX = HudElem.XAlignments.Left;
            progressBar.X      = -60;

            HudElem progressBarBG = HudElem.CreateIcon(player, "progress_bar_bg", 124, 13);//NewClientHudElem(player);

            progressBarBG.SetPoint("center", "", 0, -61);
            progressBarBG.SetField("bar", progressBar);
            progressBarBG.Sort  = -3;
            progressBarBG.Color = new Vector3(0, 0, 0);
            progressBarBG.Alpha = .5f;

            return(progressBarBG);
        }
Esempio n. 9
0
        private static void createHUD(Entity player)
        {
            if (player.HasField("hud_created"))
            {
                return;
            }

            HudElem divider = HudElem.CreateIcon(player, "hud_iw5_divider", 200, 24);

            divider.SetPoint("BOTTOMRIGHT", "BOTTOMRIGHT", -67, -20);
            divider.HideWhenInMenu = true;
            divider.Alpha          = 1;
            divider.Archived       = true;
            player.SetField("hud_divider", divider);
            divider.Sort = 1;

            // ammo stuff
            HudElem ammoSlash = HudElem.CreateFontString(player, HudElem.Fonts.HudSmall, 1f);

            ammoSlash.SetPoint("bottom right", "bottom right", -150, -28);
            ammoSlash.HideWhenInMenu   = true;
            ammoSlash.Archived         = true;
            ammoSlash.LowResBackground = true;
            ammoSlash.AlignX           = HudElem.XAlignments.Left;
            ammoSlash.Alpha            = 1;
            ammoSlash.SetText("");
            ammoSlash.Sort = 0;

            HudElem ammoStock = HudElem.CreateFontString(player, HudElem.Fonts.HudSmall, 1f);

            ammoStock.Parent = ammoSlash;
            ammoStock.SetPoint("bottom left", "bottom left", 8, 0);
            ammoStock.HideWhenInMenu = true;
            ammoStock.Archived       = true;
            ammoStock.SetValue(0);
            ammoStock.Sort = 0;

            HudElem ammoClip = HudElem.CreateFontString(player, HudElem.Fonts.HudBig, 1f);

            ammoClip.Parent = ammoSlash;
            ammoClip.SetPoint("right", "right", -5, -4);
            ammoClip.HideWhenInMenu = true;
            ammoClip.Archived       = true;
            ammoClip.SetValue(0);
            ammoClip.Sort = 0;

            HudElem weaponName = HudElem.CreateFontString(player, HudElem.Fonts.HudSmall, 1f);

            weaponName.SetPoint("bottom right", "bottom right", -140, -8);
            weaponName.HideWhenInMenu = true;
            weaponName.Archived       = true;
            weaponName.Alpha          = 1;
            weaponName.SetText("Test");
            weaponName.Sort = 0;

            HudElem scoreArrow = HudElem.CreateIcon(player, "ui_arrow_right", 12, 12);

            scoreArrow.SetPoint("BOTTOMLEFT", "BOTTOMLEFT", 82, -38);//-24
            scoreArrow.HideWhenInMenu = true;
            scoreArrow.Alpha          = 0;
            scoreArrow.Archived       = true;
            scoreArrow.Color          = new Vector3(.3f, 1, .3f);
            scoreArrow.Sort           = 1;
            HudElem scoreArrowShadow = HudElem.CreateIcon(player, "ui_arrow_right", 16, 16);

            scoreArrowShadow.SetPoint("CENTER", "CENTER", -6, 0);
            scoreArrowShadow.HideWhenInMenu = true;
            scoreArrowShadow.Alpha          = 0;
            scoreArrowShadow.Archived       = true;
            scoreArrowShadow.Color          = new Vector3(0, 0, 0);
            scoreArrowShadow.Sort           = 0;
            scoreArrowShadow.Parent         = scoreArrow;
            player.SetField("scoreArrow", scoreArrow);

            updateHUDAmmo(player);

            player.SetField("hud_weaponName", new Parameter(weaponName));
            player.SetField("hud_ammoClip", new Parameter(ammoClip));
            player.SetField("hud_ammoStock", new Parameter(ammoStock));
            player.SetField("hud_ammoSlash", new Parameter(ammoSlash));

            player.SetField("hud_created", true);
        }
Esempio n. 10
0
        private void CreateHUD(Entity player)
        {
            if (player.HasField("bohud_created"))
            {
                return;
            }

            // background bars, left side
            var bars = new HudElem[2];

            new[] { new { X = -20, Y = 15, i = 0 }, new { X = -20, Y = -4, i = 1 } }.ToList().ForEach(coord =>
            {
                var bar       = HudElem.NewClientHudElem(player);
                bar.X         = coord.X;
                bar.Y         = coord.Y;
                bar.AlignX    = "left";
                bar.AlignY    = "bottom";
                bar.HorzAlign = "left";
                bar.VertAlign = "bottom";
                bar.SetShader("white", 190, 15);
                bar.Alpha          = 0.3f;
                bar.HideWhenInMenu = true;
                bar.Foreground     = false;

                bars[coord.i] = bar;
            });

            player.SetField("bohud_bars", new Parameter(bars));

            // ranking background
            var circle = HudElem.CreateIcon(player, "cardicon_radiation", 60, 60);

            circle.SetPoint("bottom left", "bottom left", 15, -15);
            circle.HideWhenInMenu = true;
            circle.Foreground     = true;
            circle.Alpha          = 1;

            player.SetField("bohud_circle", new Parameter(circle));

            // rank text/shadow
            var rankX = -26;

            player.SetField("bohud_rankX", rankX);

            var rankText = new HudElem[3];

            new[] {
                new { X = rankX - 1, Sort = 3 },
                new { X = rankX + 1, Sort = 4 },
                new { X = rankX, Sort = 5 }
            }.ToList().ForEach(entry =>
            {
                var text            = HudElem.NewClientHudElem(player);
                text.X              = entry.X;
                text.Y              = 18;
                text.AlignX         = "left";
                text.AlignY         = "bottom";
                text.HorzAlign      = "left";
                text.VertAlign      = "bottom";
                text.FontScale      = 5;
                text.Sort           = entry.Sort;
                text.HideWhenInMenu = true;
                text.SetText((entry.Sort == 5) ? "1" : "^01");

                rankText[entry.Sort - 3] = text;
            });

            player.SetField("bohud_rankText", new Parameter(rankText));

            // message texts
            var messageText = new HudElem[2];

            new[] {
                new { X = 30, Y = 16, Text = "", i = 0 },
                new { X = 30, Y = -3, Text = "0", i = 1 },
            }.ToList().ForEach(entry =>
            {
                var text            = HudElem.NewClientHudElem(player);
                text.X              = entry.X;
                text.Y              = entry.Y;
                text.AlignX         = "left";
                text.AlignY         = "bottom";
                text.HorzAlign      = "left";
                text.VertAlign      = "bottom";
                text.FontScale      = 1.5f;
                text.Alpha          = 0.5f;
                text.HideWhenInMenu = true;
                text.Sort           = 5;
                text.SetText(entry.Text);

                messageText[entry.i] = text;
            });

            player.SetField("bohud_messageText", new Parameter(messageText));

            // ammo stuff
            var ammoSlash = HudElem.CreateFontString(player, "default", 1.25f);

            ammoSlash.SetPoint("bottom right", "bottom right", -85, -35);
            ammoSlash.GlowAlpha      = 0;
            ammoSlash.HideWhenInMenu = true;
            ammoSlash.Archived       = false;
            ammoSlash.SetText("/");

            player.SetField("bohud_ammoSlash", new Parameter(ammoSlash));

            var ammoStock = HudElem.CreateFontString(player, "default", 1.25f);

            ammoStock.Parent = ammoSlash;
            ammoStock.SetPoint("bottom left", "bottom left", 3, 0);
            ammoStock.GlowAlpha      = 0;
            ammoStock.HideWhenInMenu = true;
            ammoStock.Archived       = false;
            ammoStock.SetText("48");

            player.SetField("bohud_ammoStock", new Parameter(ammoStock));

            var ammoClip = HudElem.CreateFontString(player, "default", 1.95f);

            ammoClip.Parent = ammoSlash;
            ammoClip.SetPoint("right", "right", -7, -4);
            ammoClip.GlowAlpha      = 0;
            ammoClip.HideWhenInMenu = true;
            ammoClip.Archived       = false;
            ammoClip.SetText("12");

            player.SetField("bohud_ammoClip", new Parameter(ammoClip));

            player.SetField("bohud_created", true);
        }
Esempio n. 11
0
    private static void createHud(Entity player)
    {
        if (player.HasField("cod4hud_created"))
        {
            return;
        }

        // ammo stuff
        var ammoSlash = HudElem.CreateFontString(player, HudElem.Fonts.Objective, 1.5f);

        ammoSlash.SetPoint("bottom right", "bottom right", -85, -15);
        ammoSlash.GlowAlpha      = 0;
        ammoSlash.HideWhenInMenu = true;
        ammoSlash.Archived       = true;
        ammoSlash.SetText("/");

        player.SetField("hud_ammoSlash", new Parameter(ammoSlash));

        var ammoStock = HudElem.CreateFontString(player, HudElem.Fonts.Objective, 1.5f);

        ammoStock.Parent = ammoSlash;
        ammoStock.SetPoint("bottom left", "bottom left", 3, 0);
        ammoStock.GlowAlpha      = 0;
        ammoStock.HideWhenInMenu = true;
        ammoStock.Archived       = true;
        ammoStock.SetValue(48);

        player.SetField("hud_ammoStock", new Parameter(ammoStock));

        var ammoClip = HudElem.CreateFontString(player, HudElem.Fonts.Objective, 2f);

        ammoClip.Parent = ammoSlash;
        ammoClip.SetPoint("right", "right", -7, -0);
        ammoClip.GlowAlpha      = 0;
        ammoClip.HideWhenInMenu = true;
        ammoClip.Archived       = true;
        ammoClip.SetValue(12);

        var weaponName = HudElem.CreateFontString(player, HudElem.Fonts.Objective, 1.5f);

        weaponName.SetPoint("bottom right", "bottom right", -110, -35);
        weaponName.GlowAlpha      = 0;
        weaponName.HideWhenInMenu = true;
        weaponName.Archived       = true;
        weaponName.SetText("");

        var flash = HudElem.CreateFontString(player, HudElem.Fonts.Objective, 1.4f);

        flash.SetPoint("bottom right", "bottom right", -80, -32);
        flash.GlowAlpha      = 0;
        flash.HideWhenInMenu = true;
        flash.Archived       = true;
        flash.SetValue(0);
        flash.Color = new Vector3(1, 0, 0);

        var grenade = HudElem.CreateFontString(player, HudElem.Fonts.Objective, 1.4f);

        grenade.SetPoint("bottom right", "bottom right", -50, -32);
        grenade.GlowAlpha      = 0;
        grenade.HideWhenInMenu = true;
        grenade.Archived       = true;
        grenade.SetValue(0);
        grenade.Color = new Vector3(1, 0, 0);

        HudElem grenadeIcon = HudElem.CreateIcon(player, "hud_grenadeicon", 15, 15);

        grenadeIcon.SetPoint("BOTTOMRIGHT", "BOTTOMRIGHT", -60, -35);
        grenadeIcon.HideWhenInMenu = true;
        grenadeIcon.Foreground     = true;
        grenadeIcon.Archived       = true;
        //grenadeIcon.SetShader("hud_grenadeicon", 15, 15);
        grenadeIcon.Alpha = 0.7f;

        HudElem flashIcon = HudElem.CreateIcon(player, "hud_flashbangicon", 15, 15);

        flashIcon.SetPoint("BOTTOMRIGHT", "BOTTOMRIGHT", -85, -35);
        flashIcon.HideWhenInMenu = true;
        flashIcon.Foreground     = true;
        flashIcon.Archived       = true;
        //flashIcon.SetShader("hud_flashbangicon", 15, 15);
        flashIcon.Alpha = 1;

        HudElem nvIcon = HudElem.CreateIcon(player, "iw5_cardicon_elite_14", 20, 20);

        nvIcon.SetPoint("BOTTOM", "BOTTOM", 0, -15);
        nvIcon.HideWhenInMenu = true;
        nvIcon.Foreground     = true;
        nvIcon.Archived       = true;
        //nvIcon.SetShader("iw5_cardicon_elite_14", 20, 20);
        nvIcon.Alpha = 1;

        var nvHint = HudElem.CreateFontString(player, HudElem.Fonts.Objective, 1f);

        nvHint.SetPoint("bottom", "bottom", 0, -5);
        nvHint.GlowAlpha      = 0;
        nvHint.HideWhenInMenu = true;
        nvHint.Archived       = true;
        nvHint.SetText("[[{+actionslot 3}]]");

        /*
         * player.NotifyOnPlayerCommand("nightvision", "+actionslot 4");
         * player.SetField("isNight", 0);
         * player.OnNotify("nightvision", (ent) =>
         * {
         *  if (player.GetField<int>("isNight") == 0)
         *  {
         *(int*)nvOffsets[player.EntRef] = 64;
         *      player.PlayLocalSound("item_nightvision_on");
         *      player.SetField("isNight", 1);
         *  }
         *  else
         *  {
         *(int*)nvOffsets[player.EntRef] = 0;
         *      player.PlayLocalSound("item_nightvision_off");
         *      player.SetField("isNight", 0);
         *  }
         * });
         */

        HudElem equipIcon = HudElem.CreateIcon(player, "", 20, 20);

        equipIcon.SetPoint("BOTTOM", "BOTTOM", -80, -15);
        equipIcon.HideWhenInMenu = true;
        equipIcon.Foreground     = true;
        equipIcon.Archived       = true;
        equipIcon.Alpha          = 0.5f;

        var equipHint = HudElem.CreateFontString(player, HudElem.Fonts.Objective, 1f);

        equipHint.SetPoint("bottom", "bottom", -80, -5);
        equipHint.GlowAlpha      = 0;
        equipHint.HideWhenInMenu = true;
        equipHint.Archived       = true;

        var equipAmmo = HudElem.CreateFontString(player, HudElem.Fonts.Objective, 1.2f);

        equipAmmo.SetPoint("bottom", "bottom", -70, -23);
        equipAmmo.GlowAlpha      = 0;
        equipAmmo.HideWhenInMenu = true;
        equipAmmo.Archived       = true;
        equipAmmo.SetText("");

        player.NotifyOnPlayerCommand("equipUse", "vote yes");

        player.SetField("hud_weaponName", new Parameter(weaponName));

        player.SetField("hud_ammoClip", new Parameter(ammoClip));

        player.SetField("hud_slash", new Parameter(ammoSlash));

        player.SetField("hud_flash", new Parameter(flash));

        player.SetField("hud_grenade", new Parameter(grenade));

        player.SetField("hud_equip", new Parameter(equipIcon));

        player.SetField("hud_equipTXT", new Parameter(equipHint));

        player.SetField("hud_equipAmmo", new Parameter(equipAmmo));

        player.SetField("cod4hud_created", true);

        updateHUDAmmo(player);
    }