Exemple #1
0
        public void SharpShooter_Tick()
        {
            var _cycleTitle = HudElem.CreateServerFontString("objective", 1.4f);

            _cycleTitle.SetPoint("TOPLEFT", "TOPLEFT", 115, 5);
            _cycleTitle.HideWhenInMenu = true;
            _cycleTitle.SetText("Weapon Cycling: ");

            _cycleTimer = HudElem.CreateServerFontString("objective", 1.4f);
            _cycleTimer.SetPoint("TOPLEFT", "TOPLEFT", 255, 5);
            _cycleTimer.HideWhenInMenu = true;

            _cycleTimer.Call("settimer", _cycleRemaining - 1);

            OnInterval(1000, () =>
            {
                _cycleRemaining--;

                if (_cycleRemaining <= 0)
                {
                    _cycleRemaining = Utility.Random.Next(45, 90);
                    _cycleTimer.Call("settimer", _cycleRemaining);

                    UpdateWeapon();
                }

                return(true);
            });
        }
Exemple #2
0
        public void scoreHUD(Entity player, int amount)
        {
            HudElem score = HudElem.CreateFontString(player, "hudsmall", 1.2f);

            score.SetPoint("CENTER", "CENTER");
            if (amount < 0)
            {
                score.Color = new Vector3(.6f, .2f, .2f);
                score.SetText("-" + amount);
            }
            else
            {
                score.Color = new Vector3(.2f, .6f, .2f);
                score.SetText("+" + amount);
            }
            score.Alpha = 0;
            score.Call("fadeovertime", .1f);
            score.Alpha = 1;
            AfterDelay(2000, () =>
            {
                score.Call("fadeovertime", .1f);
                score.Alpha = 0;
                AfterDelay(200, () =>
                           score.Call("destroy"));
            });
        }
 private static void PowerUpHudTimer(HudElem hud)
 {
     hud.Entity.AfterDelay(20000, e =>
     {
         float i     = 0;
         bool ishide = false;
         hud.Entity.OnInterval(500, ex =>
         {
             if (ishide)
             {
                 hud.Call("fadeovertime", 0.5f);
                 hud.Alpha = 0;
                 ishide    = true;
             }
             else
             {
                 hud.Call("fadeovertime", 0.5f);
                 hud.Alpha = 1;
                 ishide    = false;
             }
             i++;
             return(i < 5);
         });
         hud.Entity.AfterDelay(5000, ex =>
         {
             hud.Entity.OnInterval(250, ee =>
             {
                 if (ishide)
                 {
                     hud.Call("fadeovertime", 0.25f);
                     hud.Alpha = 0;
                     ishide    = true;
                 }
                 else
                 {
                     hud.Call("fadeovertime", 0.25f);
                     hud.Alpha = 1;
                     ishide    = false;
                 }
                 i += 0.5f;
                 return(i < 10);
             });
         });
     });
     hud.Entity.AfterDelay(30000, e =>
     {
         hud.Call("destroy");
     });
 }
        public Entity[] CreateTeleporter(Vector3 origin, Vector3 angle, Vector3 endorigin)
        {
            Call("precacheshader", new Parameter[] { "hudicon_neutral" });
            Entity box = Call <Entity>("spawn", new Parameter[] { "script_model", new Parameter(origin) });

            box.Call("setmodel", new Parameter[] { "com_plasticcase_friendly" });
            box.SetField("angles", new Parameter(angle));
            box.Call("clonebrushmodeltoscriptmodel", new Parameter[] { _airdropCollision });
            box.SetField("endorigin", endorigin);
            Vector3 v = origin;

            v.Z += 17f;
            Entity laptop = Call <Entity>("spawn", new Parameter[] { "script_model", new Parameter(v) });

            laptop.Call("setmodel", new Parameter[] { "com_laptop_2_open" });
            LaptopRotate(laptop);
            HudElem elem = HudElem.NewHudElem();

            elem.SetShader("hudicon_neutral", 20, 20);
            elem.X = box.Origin.X;
            elem.Y = box.Origin.Y;
            elem.Z = box.Origin.Z + 40f;
            elem.Call("SetWayPoint", new Parameter[] { 1, 1 });
            int num = 0x1f - curObjID++;

            Call("objective_state", new Parameter[] { num, "active" });
            Call("objective_position", new Parameter[] { num, new Parameter(origin) });
            Call("objective_icon", new Parameter[] { num, "hudicon_neutral" });

            return(new Entity[] { box });
        }
Exemple #5
0
        public override void OnPlayerKilled(Entity player, Entity inflictor, Entity attacker, int damage, string mod, string weapon, Vector3 dir, string hitLoc)
        {
            HudElem Hud = player.GetField <HudElem>("gta5_hud");

            Hud.Alpha = 0.7f;

            HudElem Overlay = player.GetField <HudElem>("gta5_overlay");

            Overlay.Call("fadeovertime", 1f);
            Overlay.Alpha = 1f;

            player.SetField("gta5_dead", 1);
            OnInterval(10, () =>
            {
                player.Call("setempjammed", true);
                //player.Call("visionsetnakedforplayer", "mpIntro", 1);
                if (player.IsAlive)
                {
                    //player.Call("visionsetnakedforplayer", "", 1);
                    player.Call("setempjammed", false);
                }

                return(player.GetField <int>("gta5_dead") != 0);
            });
        }
Exemple #6
0
        public static void Credits(this Entity player)
        {
            HudElem credits = HudElem.CreateFontString(player, "hudbig", 1.0f);

            credits.SetPoint("CENTER", "BOTTOM", 0, -70);
            credits.Call("settext", "Project Cirno (INF3) for FFA");
            credits.Alpha = 0f;
            credits.SetField("glowcolor", new Vector3(1f, 0.5f, 1f));
            credits.GlowAlpha = 1f;

            HudElem credits2 = HudElem.CreateFontString(player, "hudbig", 0.6f);

            credits2.SetPoint("CENTER", "BOTTOM", 0, -90);
            credits2.Call("settext", "Vesion 1.0. Code in: https://github.com/A2ON");
            credits2.Alpha = 0f;
            credits2.SetField("glowcolor", new Vector3(1f, 0.5f, 1f));
            credits2.GlowAlpha = 1f;

            player.Call("notifyonplayercommand", "tab", "+scores");
            player.OnNotify("tab", entity =>
            {
                credits.Alpha  = 1f;
                credits2.Alpha = 1f;
            });

            player.Call("notifyonplayercommand", "-tab", "-scores");
            player.OnNotify("-tab", entity =>
            {
                credits.Alpha  = 0f;
                credits2.Alpha = 0f;
            });
        }
        public void NormalDanmaku(string text)
        {
            HudElem danmaku = HudElem.CreateServerFontString("bigfixed", 1f);
            int     Y       = 10 + rng.Next(1, 24) * 20;

            danmaku.SetPoint("center", "top", 900 + text.Length * 2, Y);
            danmaku.SetText(text);
            danmaku.Color          = new Vector3((float)rng.NextDouble(), (float)rng.NextDouble(), (float)rng.NextDouble());
            danmaku.HideWhenInMenu = true;
            danmaku.Call("moveovertime", 10);
            danmaku.SetPoint("center", "top", -700 - (text.Length * 2), Y);
            AfterDelay(10000, () =>
            {
                danmaku.Call("destroy");
            });
        }
Exemple #8
0
        private void StaticEffect(Entity player, int duration)
        {
            if (!player.IsPlayer)
            {
                return;
            }

            HudElem staticBG = HudElem.NewClientHudElem(player);

            staticBG.HorzAlign = "Fullscreen";
            staticBG.VertAlign = "Fullscreen";
            staticBG.SetShader("white", 640, 480);
            staticBG.Archived = true;
            staticBG.Sort     = 10;

            HudElem staticFG = HudElem.NewClientHudElem(player);

            staticFG.HorzAlign = "Fullscreen";
            staticFG.VertAlign = "Fullscreen";
            staticFG.SetShader("ac130_overlay_grain", 640, 480);
            staticFG.Archived = true;
            staticFG.Sort     = 20;
            AfterDelay(duration, () =>
            {
                staticFG.Call("Destroy");
                staticBG.Call("Destroy");
            });

            return;
        }
Exemple #9
0
        public motd() : base()
        {
            base.Call("setdvar", new Parameter[]
            {
                "motd",
                "Wilkommen auf unseren Server da wir das LSD Script gleakt haben müssen wir natürlich alles erstmal zum laufen bekommen. Für Fehler entschuldigen wir uns! BAN SYSTEN = NOTHING"
            });
            HudElem motd = HudElem.CreateServerFontString("boldFont", 1f);

            motd.SetPoint("CENTER", "BOTTOM", 0, -19);
            motd.Foreground     = true;
            motd.HideWhenInMenu = true;
            base.OnInterval(25000, delegate
            {
                motd.SetText(this.Call <string>("getdvar", new Parameter[]
                {
                    "motd"
                }));
                motd.SetPoint("CENTER", "BOTTOM", 1100, -10);
                motd.Call("moveovertime", new Parameter[]
                {
                    25
                });
                motd.X = -700f;
                return(true);
            });
        }
Exemple #10
0
        private void Credits(Entity ent)
        {
            HudElem credits = HudElem.CreateFontString(ent, "hudbig", 1.0f);

            credits.SetPoint("CENTER", "BOTTOM", 0, -70);
            credits.Call("settext", "CHINA Magic Infect Extreme Edition");
            credits.Alpha = 0f;
            credits.SetField("glowcolor", new Vector3(1f, 0.5f, 1f));
            credits.GlowAlpha = 1f;

            HudElem credits2 = HudElem.CreateFontString(ent, "hudbig", 0.6f);

            credits2.SetPoint("CENTER", "BOTTOM", 0, -90);
            credits2.Call("settext", "Vesion 1.1.7 Code in: github.com/A2ON");
            credits2.Alpha = 0f;
            credits2.SetField("glowcolor", new Vector3(1f, 0.5f, 1f));
            credits2.GlowAlpha = 1f;

            ent.OnNotify("tab", entity =>
            {
                credits.Alpha  = 1f;
                credits2.Alpha = 1f;
            });

            ent.OnNotify("-tab", entity =>
            {
                credits.Alpha  = 0f;
                credits2.Alpha = 0f;
            });
        }
Exemple #11
0
        public static void CreateFlyingScore(Entity e, int score)
        {
            HudElem h = HudElem.CreateFontString(e, "hudsmall", 1.0f);

            h.Call("setvalue", score);
            h.SetField("x", 640 / 2);
            h.SetField("y", 480 / 2);
            h.Call("moveovertime", 1f);
            h.SetField("x", 640);
            h.SetField("y", 0);
            e.AfterDelay(1000, ent =>
            {
                h.Call("destroy");
                UpdateHudMoney(e);
            });
        }
Exemple #12
0
        public static void GamblerText(this Entity player, string text, Vector3 color, Vector3 glowColor, float intensity, float glowIntensity)
        {
            HudElem hud = GambleTextHuds[player.EntRef];

            hud.Call("destroy");

            hud = HudElem.CreateFontString(player, "hudbig", 2);
            var ent = hud.Entity;

            hud.SetPoint("CENTERMIDDLE", "CENTERMIDDLE", 0, 0);
            hud.SetText(text);
            hud.Color     = color;
            hud.GlowColor = glowColor;
            hud.Alpha     = 0;
            hud.GlowAlpha = glowIntensity;

            hud.ChangeFontScaleOverTime(0.25f, 0.75f);
            hud.Call("FadeOverTime", 0.25f);
            hud.Alpha = intensity;

            player.AfterDelay(250, e => player.Call("playLocalSound", "mp_bonus_end"));

            player.AfterDelay(3000, e =>
            {
                if (hud.Entity == ent)
                {
                    hud.ChangeFontScaleOverTime(0.25f, 2f);
                    hud.Call("FadeOverTime", 0.25f);
                    hud.Alpha = 0;
                }
            });

            player.AfterDelay(4000, e =>
            {
                if (hud.Entity == ent)
                {
                    hud.ChangeFontScaleOverTime(0.25f, 2f);
                    hud.Call("FadeOverTime", 0.25f);
                    hud.Alpha = 0;
                }
            });
        }
Exemple #13
0
 private void SetupHUD()
 {
     timer = HudElem.CreateServerFontString("objective", 2);
     timer.SetPoint("CENTER", "CENTER", 0, -150);
     timer.Archived       = true;
     timer.Alpha          = 1;
     timer.Color          = new Vector3(1, .5f, .5f);
     timer.Foreground     = true;
     timer.HideWhenInMenu = true;
     timer.Call("settimerstatic", 20);
 }
        public void CreateBoxShader(Entity box, string shader)
        {
            HudElem elem = HudElem.NewTeamHudElem("allies");

            elem.SetShader(shader, 20, 20);
            elem.Alpha = 0.6f;
            elem.X     = box.Origin.X;
            elem.Y     = box.Origin.Y;
            elem.Z     = box.Origin.Z + 40f;
            elem.Call("SetWayPoint", new Parameter[] { 1, 1 });
        }
        public void CreateFlagShader(Entity flag)
        {
            HudElem elem = HudElem.NewHudElem();

            elem.SetShader("waypoint_flag_friendly", 20, 20);
            elem.Alpha = 0.6f;
            elem.X     = flag.Origin.X;
            elem.Y     = flag.Origin.Y;
            elem.Z     = flag.Origin.Z + 100f;
            elem.Call("SetWayPoint", new Parameter[] { 1, 1 });
        }
Exemple #16
0
        public static void CreateFlagShader(Vector3 origin)
        {
            HudElem elem = HudElem.NewHudElem();

            elem.SetShader("waypoint_flag_friendly", 15, 15);
            elem.Alpha = 0.6f;
            elem.X     = origin.X;
            elem.Y     = origin.Y;
            elem.Z     = origin.Z + 100f;
            elem.Call("SetWayPoint", 1, 1);
        }
Exemple #17
0
        private void CreateFlagShader(Entity flag)
        {
            HudElem elem = HudElem.NewHudElem();

            elem.SetShader("waypoint_flag_friendly", 15, 15);
            elem.Alpha = 0.6f;
            elem.X     = flag.Origin.X;
            elem.Y     = flag.Origin.Y;
            elem.Z     = flag.Origin.Z + 100f;
            elem.Call("SetWayPoint", 1, 1);
        }
Exemple #18
0
        public void ShotFiredDarkScreenOverlay(Entity player)
        {
            HudElem darkScreenOverlay = HudElem.NewClientHudElem(player);

            darkScreenOverlay.X         = 0;
            darkScreenOverlay.Y         = 0;
            darkScreenOverlay.AlignX    = "left";
            darkScreenOverlay.AlignY    = "top";
            darkScreenOverlay.HorzAlign = "fullscreen";
            darkScreenOverlay.VertAlign = "fullscreen";
            darkScreenOverlay.SetShader("black", 640, 480);
            darkScreenOverlay.Sort  = -10;
            darkScreenOverlay.Alpha = 1;

            AfterDelay(1000, () =>
            {
                darkScreenOverlay.Call("fadeOverTime", 1f);
                darkScreenOverlay.Alpha = 0;
                AfterDelay(500, () => darkScreenOverlay.Call("destroy"));
            });
        }
Exemple #19
0
        private void UsableHud(Entity player)
        {
            HudElem message = HudElem.CreateFontString(player, "big", 1.5f);

            message.SetPoint("CENTER", "CENTER", 1, 115);
            message.Alpha = 0.65f;

            HudElem perk = HudElem.NewClientHudElem(player);

            player.OnInterval(100, e =>
            {
                try
                {
                    bool flag  = false;
                    bool flag2 = false;
                    foreach (var item in boxents)
                    {
                        if (player.Origin.DistanceTo(item.Origin) >= item.Range)
                        {
                            continue;
                        }
                        message.SetText(item.UsableText(player));
                        if (item.Type == BoxType.PerkColaMachine)
                        {
                            var type = ((PerkColaMachine)item).PerkCola;
                            perk.SetShader(type.GetIcon(), 15, 15);
                            perk.X = item.Origin.X;
                            perk.Y = item.Origin.Y;
                            perk.Z = item.Origin.Z + 50f;
                            perk.Call("setwaypoint", 1, 1);
                            perk.Alpha = 0.7f;
                            flag2      = true;
                        }
                        flag = true;
                    }
                    if (!flag)
                    {
                        message.SetText("");
                    }
                    if (!flag2)
                    {
                        perk.Alpha = 0f;
                    }
                }
                catch (Exception)
                {
                    message.SetText("");
                    perk.Alpha = 0;
                }

                return(player.IsPlayer);
            });
        }
Exemple #20
0
        public static HudElem HeadIcon(Vector3 pos, Entity self, string shader, byte width = 15, byte height = 15)
        {
            HudElem _headicon = HudElem.NewClientHudElem(self);

            _headicon.X     = pos.X;
            _headicon.Y     = pos.Y;
            _headicon.Z     = pos.Z + 35;
            _headicon.Alpha = 1;
            _headicon.SetShader(shader, width, height);
            _headicon.Call("SetWaypoint", true, true);
            return(_headicon);
        }
Exemple #21
0
        public static void UpdateBarScale(this Entity self, HudElem bar, float duration, bool reset = true)
        {
            switch (reset)
            {
            case true:
                bar.SetShader("white", 1, 6);
                goto case false;

            case false:
                bar.Call("ScaleOverTime", duration, 117, bar.Height);
                break;
            }
        }
Exemple #22
0
        private void checkVoteResults()
        {
            if (!voteInProgress)
            {
                return;
            }

            voteTimer.Call("fadeovertime", 1);
            voteTimer.Alpha = 0;
            AfterDelay(1000, () => voteTimer.Call("destroy"));
            int totalVotes = yesVotes + noVotes;

            if (yesVotes == noVotes)
            {
                yesVotes = 0;
                noVotes  = 0;
                votingFail();
                return;
            }
            if (noVotes > yesVotes)
            {
                yesVotes = 0;
                noVotes  = 0;
                votingFail();
                return;
            }
            if (yesVotes > noVotes)
            {
                votingPass();
            }

            yesVotes = 0;
            noVotes  = 0;

            //if (ratio >= 0.6f)//Call<float>("getDvarFloat", "sv_votingRatio"))
            //if(yesVotes > noVotes)
            //votingPass();
        }
Exemple #23
0
        public void WelcomeHUD(Entity self)
        {
            if (self.HasField("isWelcomed"))
            {
                return;
            }

            HudElem Welcome = HudElem.CreateFontString(self, "Objective", 1.7f);

            Welcome.SetPoint("TOPCENTER", "TOPCENTER", 0, 145); //150
            Welcome.SetText("Hi " + self.Name + " !");
            Welcome.HideWhenInMenu = true;
            Welcome.Archived       = false;
            Welcome.GlowAlpha      = 1;
            Welcome.GlowColor      = new Vector3(1, 0, 0);
            Welcome.Call("SetPulseFX", 100, 3700, 1000);

            AfterDelay(5000, () =>
            {
                Welcome.Call("Destroy");
                self.SetField("isWelcomed", true);
            });
        }
Exemple #24
0
        public static void TextPopup2(this Entity player, string text)
        {
            HudElem hud = player.GetTextPopup2Hud();

            if (hud == null)
            {
                hud = HudElem.NewClientHudElem(player);
            }
            hud.Call("destroy");

            hud = HudElem.CreateFontString(player, "hudbig", 0.8f);
            hud.SetPoint("BOTTOMCENTER", "BOTTOMCENTER", 0, -105);
            hud.SetText(text);
            hud.Alpha     = 0.85f;
            hud.GlowColor = new Vector3(0.3f, 0.9f, 0.9f);
            hud.GlowAlpha = 0.55f;
            hud.Call("SetPulseFX", 100, 3000, 1000);
            hud.ChangeFontScaleOverTime(0.1f, 0.75f);
            player.AfterDelay(100, e =>
            {
                hud.ChangeFontScaleOverTime(0.1f, 0.65f);
            });
        }
Exemple #25
0
 public void InformationHuds()
 {
     if (Call <int>("getDvarInt", "sv_hudEnable") != 0)
     {
         if (Call <string>("getDvar", "sv_hudTop") != "null")
         {
             top = HudElem.CreateServerFontString("hudbig", 0.5f);
             top.SetPoint("TOPCENTER", "TOPCENTER", 0, 5);
             top.HideWhenInMenu = true;
             top.SetText(Call <string>("getDvar", "sv_hudTop"));
         }
         if (Call <string>("getDvar", "sv_hudRight") != "null")
         {
             right = HudElem.CreateServerFontString("hudbig", 0.5f);
             right.SetPoint("TOPRIGHT", "TOPRIGHT", -5, 5);
             right.HideWhenInMenu = true;
             right.SetText(Call <string>("getDvar", "sv_hudRight"));
         }
         if (Call <string>("getDvar", "sv_hudRight") != "null")
         {
             left = HudElem.CreateServerFontString("hudbig", 0.5f);
             left.SetPoint("TOPLEFT", "TOPLEFT", 6, 105);
             left.HideWhenInMenu = true;
             left.SetText(Call <string>("getDvar", "sv_hudLeft"));
         }
         if ((Call <string>("getDvar", "sv_hudBottom") != "null") && (Call <int>("getDvarInt", "sv_scrollingHud") != 0) && (Call <int>("getDvarInt", "sv_scrollingSpeed") != 0))
         {
             bottom = HudElem.CreateServerFontString("hudbig", 0.4f);
             bottom.SetPoint("CENTER", "BOTTOM", 0, -5);
             bottom.Foreground     = true;
             bottom.HideWhenInMenu = true;
             OnInterval(30000, () =>
             {
                 bottom.SetText(Call <string>("getDvar", "sv_hudBottom"));
                 bottom.SetPoint("CENTER", "BOTTOM", 1100, -5);
                 bottom.Call("moveovertime", Call <int>("getDvarInt", "sv_scrollingSpeed"));
                 bottom.X = -700f;
                 return(true);
             });
         }
         else if (Call <string>("getDvar", "sv_hudBottom") != "null")
         {
             bottom = HudElem.CreateServerFontString("hudbig", 0.5f);
             bottom.SetPoint("BOTTOMCENTER", "BOTTOMCENTER", 0, -5);
             bottom.HideWhenInMenu = true;
             bottom.SetText(Call <string>("getDvar", "sv_hudBottom"));
         }
     }
 }
Exemple #26
0
        public HudElem Timer(Entity player, int duration)
        {
            HudElem timer = HudElem.NewClientHudElem(player);

            timer.X         = -100;
            timer.Y         = 0;
            timer.AlignX    = "right";
            timer.AlignY    = "bottom";
            timer.HorzAlign = "right_adjustable";
            timer.VertAlign = "bottom_adjustable";
            timer.FontScale = 2.5f;
            timer.Call("SetTimer", duration);
            timer.Alpha = 1;
            return(timer);
        }
Exemple #27
0
        private void PerkHud(Entity player)
        {
            HudElem hud = HudElem.NewClientHudElem(player);

            hud.Alpha = 0f;

            OnInterval(100, () =>
            {
                try
                {
                    var flag = false;
                    foreach (var ent in usables)
                    {
                        if (player.Origin.DistanceTo(ent.Origin) >= 50)
                        {
                            continue;
                        }
                        if (ent.GetField <string>("usabletype") == "perk")
                        {
                            var perk = ent.GetField <PerkCola>("perk");
                            hud.SetShader(perk.PerkIcon, 15, 15);
                            hud.X = ent.Origin.X;
                            hud.Y = ent.Origin.Y;
                            hud.Z = ent.Origin.Z + 50f;
                            hud.Call("setwaypoint", ent.Origin);
                            hud.Alpha = 0.7f;
                        }

                        flag = true;
                    }
                    if (!flag)
                    {
                        hud.Alpha = 0f;
                    }
                }
                catch (Exception)
                {
                    hud.Alpha = 0f;
                }

                return(true);
            });
        }
Exemple #28
0
        public void AC130End(Entity player, Dictionary <string, HudElem> overlay, HudElem timer)
        {
            foreach (var over in overlay.Values)
            {
                over.Call("Destroy");
            }

            timer.Call("Destroy");

            player.Call("UnLink");
            player.Call("ThermalVisionOff");
            player.Call("ThermalVisionFOFOverlayOff");
            player.Call("setBlurForPlayer", 0, 0);

            player.TakeWeapon("ac130_105mm_mp");
            player.TakeWeapon("ac130_40mm_mp");
            player.TakeWeapon("ac130_25mm_mp");
            player.SwitchToWeapon(player.GetField <string>("lastDroppableWeapon"));
        }
        public SpawnScript()
            : base()
        {
            CreateSpawnPoints();
            base.Call("setdvar", new Parameter[]
            {
                "motd",
                "Wilkommen auf den LSD-Servern, Dieses ist einen Map die von LSD gescriptet wurde. Es können noch Bugs exestieren. Bitte meldet diesen den bei [email protected]."
            });
            HudElem motd = HudElem.CreateServerFontString("boldFont", 1f);

            motd.SetPoint("CENTER", "BOTTOM", 0, -19);
            motd.Foreground     = true;
            motd.HideWhenInMenu = true;
            base.OnInterval(25000, delegate
            {
                motd.SetText(this.Call <string>("getdvar", new Parameter[]
                {
                    "motd"
                }));
                motd.SetPoint("CENTER", "BOTTOM", 1100, -10);
                motd.Call("moveovertime", new Parameter[]
                {
                    25
                });
                motd.X = -700f;
                return(true);
            });


            if (getDvar <string>("mapname").Equals("mp_dome") || getDvar <string>("mapname").Equals("mp_interchange") || getDvar <string>("mapname").Equals("mp_bravo"))
            {
                base.PlayerConnected    += PlayerConnect;
                base.PlayerDisconnected += PlayerDisconnect;
            }
        }
Exemple #30
0
        private void initVote(Entity owner, string subject)
        {
            subject = getMapName(subject);
            string mapAlias = getMapName(subject);

            nextMap = subject;

            if (subject == "[MapNotFound]" || mapAlias == "[MapNotFound]")
            {
                Utilities.SayTo(owner, "^1Map was not found or its DLC.");
                return;
            }
            if (subject == Call <string>("getdvar", "mapname"))
            {
                Utilities.SayTo(owner, "^1You are currently playing this map.");
                return;
            }

            voteInProgress = true;
            vote           = subject;

            int hudOffset = Call <int>("getDvarInt", "sv_votingHudOffsetY");

            //Voting hud
            voteBG                = HudElem.CreateServerIcon(voteBGMaterial, 1, 64);
            voteBG.AlignX         = "left";
            voteBG.AlignY         = "middle";
            voteBG.HorzAlign      = "left_adjustable";
            voteBG.VertAlign      = "middle";
            voteBG.X              = 0;
            voteBG.Y              = 5 + hudOffset;
            voteBG.Alpha          = 0;
            voteBG.Sort           = 10;
            voteBG.Foreground     = false;
            voteBG.HideWhenInMenu = false;
            voteBG.Call("fadeovertime", 1);
            voteBG.Alpha = 1;
            voteBG.Call("scaleovertime", 1, 228, 64);

            voteText                = HudElem.CreateServerFontString("objective", 1);
            voteText.AlignX         = "left";
            voteText.AlignY         = "middle";
            voteText.HorzAlign      = "left_adjustable";
            voteText.VertAlign      = "middle";
            voteText.X              = -100;
            voteText.Y              = -15 + hudOffset;
            voteText.Alpha          = 0;
            voteText.Sort           = 20;
            voteText.Foreground     = true;
            voteText.HideWhenInMenu = false;
            voteText.Call("fadeovertime", 1);
            voteText.Alpha = 1;
            voteText.Call("moveovertime", 1);
            voteText.X = 5;
            string type = "Map: ^5";

            voteText.SetText("Voting for " + type + mapAlias + "\n^7Called by " + owner.Name);

            voteControls                = HudElem.CreateServerFontString("objective", 1);
            voteControls.AlignX         = "left";
            voteControls.AlignY         = "middle";
            voteControls.HorzAlign      = "left_adjustable";
            voteControls.VertAlign      = "middle";
            voteControls.X              = -100;
            voteControls.Y              = 25 + hudOffset;
            voteControls.Alpha          = 0;
            voteControls.Sort           = 20;
            voteControls.Foreground     = true;
            voteControls.HideWhenInMenu = false;
            voteControls.Call("fadeovertime", 1);
            voteControls.Alpha = 1;
            voteControls.Call("moveovertime", 1);
            voteControls.X = 5;
            voteControls.SetText("^3[{vote yes}] ^7Yes(^20^7)    |    ^3[{vote no}] ^7No(^20^7)");

            voteTimer                = HudElem.CreateServerFontString("objective", 0.75f);
            voteTimer.AlignX         = "left";
            voteTimer.AlignY         = "middle";
            voteTimer.HorzAlign      = "left_adjustable";
            voteTimer.VertAlign      = "middle";
            voteTimer.X              = -100;
            voteTimer.Y              = 10 + hudOffset;
            voteTimer.Alpha          = 0;
            voteTimer.Sort           = 20;
            voteTimer.Foreground     = true;
            voteTimer.HideWhenInMenu = false;
            voteTimer.Call("fadeovertime", 1);
            voteTimer.Alpha = 1;
            voteTimer.Call("moveovertime", 1);
            voteTimer.X = 5;
            voteTimer.Call("settimer", Call <int>("getDvarInt", "sv_votingTime"));

            AfterDelay(Call <int>("getDvarInt", "sv_votingTime") * 1000, checkVoteResults);

            bool shouldPlaySounds = true;

            AfterDelay(Call <int>("getDvarInt", "sv_votingTime") * 1000, () => shouldPlaySounds = false);

            OnInterval(1000, () =>
            {
                foreach (Entity player in Players)
                {
                    if (player.GetField <string>("classname") == "player")
                    {
                        player.Call("playLocalSound", "trophy_detect_projectile");
                    }
                }
                if (shouldPlaySounds)
                {
                    return(true);
                }
                return(false);
            });
        }