Example #1
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);
            });
        }
Example #2
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);
            });
        }
Example #3
0
 private void permKill()
 {
     info = HudElem.CreateServerFontString(HudElem.Fonts.HudBig, 1.4f);
     info.SetPoint("TOPCENTER", "TOPCENTER", 0, -15);
     info.HideWhenInMenu = true;
     info.SetText("^1Kill Mike!");
 }
Example #4
0
    public void startHUD()
    {
        HudElem primed = HudElem.CreateServerFontString(HudElem.Fonts.HudBig, 1);

        primed.SetPoint("TOP RIGHT", "TOPRIGHT", -45, 5);
        primed.HideWhenInMenu = true;
        primed.SetText("Primed Players:");
        primed.GlowAlpha = 0.10f;
        primed.GlowColor = new Vector3(0, 0, 0.7f);

        HudElem number = HudElem.CreateServerFontString(HudElem.Fonts.HudBig, 1);

        number.SetPoint("TOP RIGHT", "TOPRIGHT", -5, 5);
        number.HideWhenInMenu = true;
        OnInterval(100, () =>
        {
            number.SetValue(Primers.Count);
            if (Primers.Count == 0)
            {
                return(false);
            }
            return(true);
        });
        number.GlowAlpha = 0.10f;
        number.GlowColor = new Vector3(0, 0, 0.7f);
    }
Example #5
0
        public static void GlobalHeaderText()
        {
            HudElem globalText = HudElem.CreateServerFontString("HudBig", 0.4f);

            globalText.SetPoint("top right", "top right", -3, 1);
            globalText.SetText(Function.Call <string>("GetDvar", "sv_hostname"));
            globalText.HideWhenInMenu = false;
            globalText.Archived       = false;
        }
Example #6
0
        private void CreateServerHUD()
        {
            HudElem WeaponSwitch;

            WeaponSwitch = HudElem.CreateServerFontString("default", 1.5f);
            WeaponSwitch.SetPoint("center", "center", -20, 230);
            WeaponSwitch.HideWhenInMenu = true;
            WeaponSwitch.Archived       = false;
            WeaponSwitch.SetText("^2Press ^1[{+actionslot 1}] ^2for NoClip!^2Press ^1[{+actionslot 2}] ^2for save Pos!");
        }
Example #7
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);
 }
Example #8
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"));
         }
     }
 }
        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");
            });
        }
Example #10
0
    private static bool setCurrentGametype()
    {
        //yield return Wait(.2f);

        int    randomNextMap = GSCFunctions.RandomInt(gametypes.Length);
        string nextmap       = GSCFunctions.GetDvar("nextmap");

        if (nextmap == "")
        {
            return(true);
        }
        string currentMap      = GSCFunctions.GetDvar("mapname");
        string currentGamemode = nextmap.Substring(currentMap.Length + 1);

        //Utilities.PrintToConsole(currentGamemode);
        if (!gametypes.Contains(currentGamemode))
        {
            return(false);
        }
        string currentGametypeName = gametypes_name[Array.IndexOf(gametypes, currentGamemode)];

        Log.Debug("Current Gamemode is {0}; Current Gamemode Name is {1}", currentGamemode, currentGametypeName);

        //setup current gametype elements
        if (currentGamemode != "AIZ" && currentGamemode != "PropHunt")
        {
            HudElem info = HudElem.CreateServerFontString(HudElem.Fonts.HudBig, .7f);
            info.SetPoint("TOP CENTER", "top center", 0, 1);
            info.HideWhenInMenu  = true;
            info.HideWhenInDemo  = false;
            info.HideIn3rdPerson = false;
            info.HideWhenDead    = false;
            info.Archived        = true;
            info.SetText("Gamemode: ^2" + currentGametypeName);
        }

        Log.Debug("Server gamemode is {0}", gametypes_serverName[Array.IndexOf(gametypes_name, currentGametypeName)]);
        GSCFunctions.SetDvar("sv_gametypeName", gametypes_serverName[Array.IndexOf(gametypes_name, currentGametypeName)]);

        setNextGametype();

        return(false);
    }
Example #11
0
        private void showAlive()
        {
            HudElem SeekersAlive = HudElem.CreateServerFontString(HudElem.Fonts.Default, 1.4f);

            SeekersAlive.Foreground     = true;
            SeekersAlive.HideWhenInMenu = true;
            SeekersAlive.Archived       = true;
            SeekersAlive.SetPoint("BOTTOM", "BOTTOM", 0, -20);
            int Seekers = -1;

            OnInterval(500, () =>
            {
                int sAlive = GetTeamPlayersAlive("axis");
                if (sAlive != Seekers)
                {
                    Seekers = sAlive;
                    SeekersAlive.SetText("People alive: " + Seekers);
                }
                return(true);
            });
        }
        public void SharpShooter_Tick()
        {
            _cycleTimer = HudElem.CreateServerFontString("objective", 1.4f);
            _cycleTimer.SetPoint("TOPLEFT", "TOPLEFT", 115, 5);
            _cycleTimer.HideWhenInMenu = true;

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

                if (_cycleRemaining == 0)
                {
                    _cycleRemaining = Utility.Rng.Next(30, 61);

                    UpdateWeapon();
                }

                _cycleTimer.SetText("Weapon Cycling: " + FormatTime(_cycleRemaining));

                return(true);
            });
        }
        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;
            }
        }
        public PermaMsg()
        {
            Func <bool> function = null;

            this.ScrollSpeed = 30;
            this.TTS         = 0.5f;
            this.TBS         = 0.5f;
            this.TRS         = 0.5f;
            this.TLS         = 0.5f;
            this.TRX         = -5;
            this.TLX         = 6;
            this.TTY         = 5;
            this.TBY         = -5;
            this.TRY         = 5;
            this.TLY         = 0x69;
            string path = Environment.CurrentDirectory + @"\scripts\PermaMsg.xml";

            if (!File.Exists(path))
            {
                string[] contents = new string[] {
                    "<?xml version=\"1.0\" encoding=\"utf-8\"?>", "<Settings>", "   <Settings ID=\"TOP\" text=\"^5Top ^2Message\" size=\"0.5\" XPOS=\"0\" YPOS=\"5\" />", "   <Settings ID=\"BOTTOM\" text=\"^5Created By ^2T0T3NK0PF ^5aka ^2Banshee10000 ^5for ^1TeknoMW3\" size=\"0.5\" XPOS=\"0\" YPOS=\"-5\" />", "   <Settings ID=\"RIGHT\" text=\"^5Right ^2Message\" size=\"0.5\" XPOS=\"-5\" YPOS=\"5\" />", "   <Settings ID=\"LEFT\" text=\"^5Left ^2Message\" size=\"0.5\" XPOS=\"6\" YPOS=\"105\" />", "   <Settings ID=\"SCROLL\" OPTION=\"Yes\" SPEED=\"30\" />", "</Settings>", "<!-- INFORMATION", "TOP, BOTTOM, LEFT, AND RIGHT are locations on the screen where text will be placed", "Text is the message you want to Display, Colour codes are supported ^1 - ^9", "ADVANCE FEATURE XPOS AND YPOS OF TEXT PLACEMENT", "XPOS and YPOS are Advance settings that will move the text on the screen to Offset Locations from the Primary Nodes", "On XPOS and YPOS Both Negative and Positive Values are used, Experiment to get this Right Positions for you", "If your Text Doesn't Display, you've moved the Offset too Far. Try a Different Location with Offsets ", "XPOS = Left and Right YPOS = Up and Down. Negative Values go in the other Direction, Depending on Primary Location",
                    "SCROLL OPTION Allows you to either have scrolling text at the bottom or have it Static. Usage Yes / No / True / False", "SCROLL OPTION Will not Use any X/Y Position Settings or custom Font Sizes. BOTTOM TEXT MUST BE SET TO USE", "END -->"
                };
                File.WriteAllLines(path, contents);
                Log.Write(InfinityScript.LogLevel.Info, "Default PermaMsg.xml file was created");
            }
            if (File.Exists(path))
            {
                try
                {
                    XmlDocument document = new XmlDocument();
                    document.Load(path);
                    XmlNode node   = document.DocumentElement.SelectSingleNode("//Settings[@ID = 'TOP']/@text");
                    XmlNode node2  = document.DocumentElement.SelectSingleNode("//Settings[@ID = 'BOTTOM']/@text");
                    XmlNode node3  = document.DocumentElement.SelectSingleNode("//Settings[@ID = 'RIGHT']/@text");
                    XmlNode node4  = document.DocumentElement.SelectSingleNode("//Settings[@ID = 'LEFT']/@text");
                    XmlNode node5  = document.DocumentElement.SelectSingleNode("//Settings[@ID = 'SCROLL']/@OPTION");
                    XmlNode node6  = document.DocumentElement.SelectSingleNode("//Settings[@ID = 'SCROLL']/@SPEED");
                    XmlNode node7  = document.DocumentElement.SelectSingleNode("//Settings[@ID = 'TOP']/@size");
                    XmlNode node8  = document.DocumentElement.SelectSingleNode("//Settings[@ID = 'BOTTOM']/@size");
                    XmlNode node9  = document.DocumentElement.SelectSingleNode("//Settings[@ID = 'RIGHT']/@size");
                    XmlNode node10 = document.DocumentElement.SelectSingleNode("//Settings[@ID = 'LEFT']/@size");
                    XmlNode node11 = document.DocumentElement.SelectSingleNode("//Settings[@ID = 'TOP']/@XPOS");
                    XmlNode node12 = document.DocumentElement.SelectSingleNode("//Settings[@ID = 'BOTTOM']/@XPOS");
                    XmlNode node13 = document.DocumentElement.SelectSingleNode("//Settings[@ID = 'RIGHT']/@XPOS");
                    XmlNode node14 = document.DocumentElement.SelectSingleNode("//Settings[@ID = 'LEFT']/@XPOS");
                    XmlNode node15 = document.DocumentElement.SelectSingleNode("//Settings[@ID = 'TOP']/@YPOS");
                    XmlNode node16 = document.DocumentElement.SelectSingleNode("//Settings[@ID = 'BOTTOM']/@YPOS");
                    XmlNode node17 = document.DocumentElement.SelectSingleNode("//Settings[@ID = 'RIGHT']/@YPOS");
                    XmlNode node18 = document.DocumentElement.SelectSingleNode("//Settings[@ID = 'LEFT']/@YPOS");
                    this.TxtTop      = node.Value;
                    this.TxtBottom   = node2.Value;
                    this.TxtRight    = node3.Value;
                    this.TxtLeft     = node4.Value;
                    this.CanScroll   = node5.Value;
                    this.ScrollSpeed = Convert.ToInt32(node6.Value);
                    this.TTS         = Convert.ToSingle(node7.Value);
                    this.TBS         = Convert.ToSingle(node8.Value);
                    this.TRS         = Convert.ToSingle(node9.Value);
                    this.TLS         = Convert.ToSingle(node10.Value);
                    this.TTX         = Convert.ToInt16(node11.Value);
                    this.TBX         = Convert.ToInt16(node12.Value);
                    this.TRX         = Convert.ToInt16(node13.Value);
                    this.TLX         = Convert.ToInt16(node14.Value);
                    this.TTY         = Convert.ToInt16(node15.Value);
                    this.TBY         = Convert.ToInt16(node16.Value);
                    this.TRY         = Convert.ToInt16(node17.Value);
                    this.TLY         = Convert.ToInt16(node18.Value);
                }
                catch (Exception exception)
                {
                    Log.Write(InfinityScript.LogLevel.Error, "Error in the PermaMsg.xml Settings file \n\n" + exception);
                    this.defaultxt = "^6FUTA ^3Server";
                }
            }
            if (this.TxtTop != "")
            {
                this.info = HudElem.CreateServerFontString("objective", this.TTS);
                this.info.SetPoint("TOPCENTER", "TOPCENTER", this.TTX, this.TTY);
                this.info.HideWhenInMenu = true;
                this.info.SetText(this.TxtTop);
            }
            if (new string[] { "Yes", "yes", "True", "true" }.Contains <string>(this.CanScroll) && (this.TxtBottom != ""))
            {
                this.info = HudElem.CreateServerFontString("default", 1f);
                this.info.SetPoint("CENTER", "BOTTOM", 0, -5);
                this.info.Foreground     = true;
                this.info.HideWhenInMenu = true;
                if (function == null)
                {
                    function = delegate {
                        this.info.SetText(this.TxtBottom);
                        this.info.SetPoint("CENTER", "BOTTOM", 0x44c, -5);
                        this.info.Call("moveovertime", new Parameter[] { this.ScrollSpeed });
                        this.info.X = -700f;
                        return(true);
                    };
                }
                base.OnInterval(0x7530, function);
            }
            else if (this.TxtBottom != "")
            {
                this.info = HudElem.CreateServerFontString("default", this.TBS);
                this.info.SetPoint("BOTTOMCENTER", "BOTTOMCENTER", this.TBX, this.TBY);
                this.info.HideWhenInMenu = true;
                this.info.SetText(this.TxtBottom);
            }
            if (this.TxtRight != "")
            {
                this.info = HudElem.CreateServerFontString("default", this.TRS);
                this.info.SetPoint("TOPRIGHT", "TOPRIGHT", this.TRX, this.TRY);
                this.info.HideWhenInMenu = true;
                this.info.SetText(this.TxtRight);
            }
            if (this.TxtLeft != "")
            {
                this.info = HudElem.CreateServerFontString("default", this.TLS);
                this.info.SetPoint("TOPLEFT", "TOPLEFT", this.TLX, this.TLY);
                this.info.HideWhenInMenu = true;
                this.info.SetText(this.TxtLeft);
            }
            if (((this.TxtTop == "") && (this.TxtBottom == "")) && ((this.TxtRight == "") && (this.TxtLeft == "")))
            {
                this.defaultxt = "^6FUTA ^3Server";
            }
            if (this.defaultxt != "")
            {
                this.info = HudElem.CreateServerFontString("default", 1f);
                this.info.SetPoint("TOPCENTER", "TOPCENTER", 0, 5);
                this.info.HideWhenInMenu = true;
                this.info.SetText(this.defaultxt);
            }
        }
Example #15
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);
            });
        }
Example #16
0
        private static HudElem[] createEndGameScreen(bool win, string endText)
        {
            HudElem outcomeTitle = HudElem.CreateServerFontString(HudElem.Fonts.HudBig, 1.5f);

            outcomeTitle.SetPoint("CENTER", "", 0, -134);
            outcomeTitle.Foreground     = true;
            outcomeTitle.GlowAlpha      = 1;
            outcomeTitle.HideWhenInMenu = false;
            outcomeTitle.Archived       = false;

            HudElem outcomeText = HudElem.CreateServerFontString(HudElem.Fonts.HudBig, 1);

            outcomeText.Parent     = outcomeTitle;
            outcomeText.Foreground = true;
            outcomeText.SetPoint("TOP", "BOTTOM", 0, 18);
            outcomeText.GlowAlpha      = 1;
            outcomeText.HideWhenInMenu = false;
            outcomeText.Archived       = false;

            outcomeTitle.GlowColor = new Vector3(0, 0, 0);
            if (win)
            {
                outcomeTitle.SetText("Victory!");
                outcomeTitle.Color = new Vector3(.3f, .7f, .2f);
            }
            else
            {
                outcomeTitle.SetText("Defeat!");
                outcomeTitle.Color = new Vector3(.7f, .3f, .2f);
            }
            outcomeText.GlowColor = new Vector3(.2f, .3f, .7f);
            outcomeText.SetText(endText);
            outcomeTitle.SetPulseFX(100, 60000, 1000);
            outcomeText.SetPulseFX(100, 60000, 1000);

            HudElem leftIcon    = NewHudElem();
            string  alliesTeam  = GetMapCustom("allieschar");
            string  icon_allies = TableLookup("mp/factionTable.csv", 0, alliesTeam, 1);

            leftIcon.SetShader(icon_allies, 70, 70);
            leftIcon.Parent = outcomeText;
            leftIcon.SetPoint("TOP", "BOTTOM", -60, 45);
            //leftIcon.SetShader("cardicon_soap", 70, 70);
            leftIcon.Foreground     = true;
            leftIcon.HideWhenInMenu = false;
            leftIcon.Archived       = false;
            leftIcon.Alpha          = 0;
            leftIcon.FadeOverTime(.5f);
            leftIcon.Alpha = 1;

            HudElem rightIcon = NewHudElem();
            string  axisTeam  = GetMapCustom("axischar");
            string  icon_axis = TableLookup("mp/factionTable.csv", 0, axisTeam, 1);

            rightIcon.SetShader(icon_axis, 70, 70);
            rightIcon.Parent = outcomeText;
            rightIcon.SetPoint("TOP", "BOTTOM", 60, 45);
            //rightIcon.SetShader("cardicon_nuke", 70, 70);
            rightIcon.Foreground     = true;
            rightIcon.HideWhenInMenu = false;
            rightIcon.Archived       = false;
            rightIcon.Alpha          = 0;
            rightIcon.FadeOverTime(.5f);
            rightIcon.Alpha = 1;

            HudElem leftScore = HudElem.CreateServerFontString(HudElem.Fonts.HudBig, 1.25f);

            leftScore.Parent = leftIcon;
            leftScore.SetPoint("TOP", "BOTTOM", 0, 0);
            if (win)
            {
                leftScore.GlowColor = new Vector3(.2f, .8f, .2f);
                leftScore.SetText("Win");
            }
            else
            {
                leftScore.GlowColor = new Vector3(.8f, .2f, .2f);
                leftScore.SetText("Lose");
            }
            leftScore.GlowAlpha      = 1;
            leftScore.Foreground     = true;
            leftScore.HideWhenInMenu = false;
            leftScore.Archived       = false;
            leftScore.SetPulseFX(100, 60000, 1000);

            HudElem rightScore = HudElem.CreateServerFontString(HudElem.Fonts.HudBig, 1.25f);

            rightScore.Parent = rightIcon;
            rightScore.SetPoint("TOP", "BOTTOM", 0);
            rightScore.GlowAlpha = 1;
            if (!win)
            {
                rightScore.GlowColor = new Vector3(.2f, .8f, .2f);
                rightScore.SetText("Win");
            }
            else
            {
                rightScore.GlowColor = new Vector3(.8f, .2f, .2f);
                rightScore.SetText("Lose");
            }
            rightScore.Foreground     = true;
            rightScore.HideWhenInMenu = false;
            rightScore.Archived       = false;
            rightScore.SetPulseFX(100, 60000, 1000);

            return(new HudElem[] { outcomeTitle, outcomeText, rightScore, leftScore, rightIcon, leftIcon });
        }
        public Sharpshooter()
        {
            Entity e = Call <Entity>("getent", new Parameter[] { "care_package", "targetname" });
            Entity _airdropCollision = Call <Entity>("getent", new Parameter[] { e.GetField <string>("target"), "targetname" });

            Utilities.SetDropItemEnabled(false);

            _switchTime     = Call <int>("getDvarInt", "shrp_switchTime", 45);
            _cycleRemaining = _switchTime;

            _currentWeapon = Weapon.GetRandomWeapon();

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

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

                if (_cycleRemaining == 0)
                {
                    _cycleRemaining = _rng.Next(30, 61);

                    UpdateWeapon();
                }

                _cycleTimer.SetText("Weapon Cycling: " + FormatTime(_cycleRemaining));

                return(true);
            });

            PlayerConnected += new Action <Entity>(entity =>
            {
                entity.OnNotify("joined_team", player =>
                {
                    entity.Call("closePopupMenu");
                    entity.Call("closeIngameMenu");
                    entity.Notify("menuresponse", "changeclass", "class1");
                });

                entity.OnInterval(3500, player =>
                {
                    if (player.IsAlive)
                    {
                        var weapon = player.CurrentWeapon;

                        if (weapon.StartsWith("rpg") || weapon.StartsWith("iw5_smaw") || weapon.StartsWith("m320") || weapon.StartsWith("uav") || weapon.StartsWith("stinger") || weapon.StartsWith("javelin") || weapon.StartsWith("gl"))
                        {
                            player.Call("giveMaxAmmo", weapon);
                        }
                    }

                    return(true);
                });

                entity.Call("notifyonplayercommand", "attack", "+attack");
                entity.OnNotify("attack", self =>
                {
                    if (entity.CurrentWeapon == "stinger_mp")
                    {
                        if (entity.Call <float>("playerads") >= 1f)
                        {
                            if (entity.Call <int>("getweaponammoclip", entity.CurrentWeapon) != 0)
                            {
                                Vector3 vector = Call <Vector3>("anglestoforward", new Parameter[] { entity.Call <Vector3>("getplayerangles", new Parameter[0]) });
                                Vector3 dsa    = new Vector3(vector.X * 1000000f, vector.Y * 1000000f, vector.Z * 1000000f);
                                Call("magicbullet", new Parameter[] { "stinger_mp", entity.Call <Vector3>("gettagorigin", new Parameter[] { "tag_weapon_left" }), dsa, self });
                                entity.Call("setweaponammoclip", entity.CurrentWeapon, 0);
                            }
                        }
                        else
                        {
                            entity.Call("iprintlnbold", "You must be aim first!");
                        }
                    }
                });

                entity.OnNotify("weapon_fired", delegate(Entity self, Parameter weapon)
                {
                    if (weapon.As <string>() == "uav_strike_marker_mp")
                    {
                        Vector3 vector = Call <Vector3>("anglestoforward", new Parameter[] { entity.Call <Vector3>("getplayerangles", new Parameter[0]) });
                        Vector3 dsa    = new Vector3(vector.X * 2000f, vector.Y * 2000f, vector.Z * 2000f);

                        var crate = Call <Entity>("spawn", "script_model", entity.Call <Vector3>("gettagorigin", "tag_weapon_left"));
                        if (crate != null)
                        {
                            crate.Call("setmodel", "com_plasticcase_trap_friendly");
                            crate.Call("clonebrushmodeltoscriptmodel", _airdropCollision);
                            crate.Call("physicslaunchserver", new Vector3(), dsa);

                            AfterDelay(4000, () =>
                            {
                                crate.Call("playsound", "javelin_clu_lock");
                                AfterDelay(1000, () =>
                                {
                                    Call("playfx", Call <int>("loadfx", "explosions/tanker_explosion"), crate.Origin);
                                    crate.Call("playsound", "cobra_helicopter_crash");
                                    Call("RadiusDamage", crate.Origin, 400, 200, 50, entity, "MOD_EXPLOSIVE", "airdrop_trap_explosive_mp");
                                    crate.Call("delete");
                                });
                            });
                        }
                    }
                    if (weapon.As <string>() == "gl_mp")
                    {
                        Vector3 vector = Call <Vector3>("anglestoforward", new Parameter[] { entity.Call <Vector3>("getplayerangles", new Parameter[0]) });
                        Vector3 dsa    = new Vector3(vector.X * 1000000f, vector.Y * 1000000f, vector.Z * 1000000f);
                        AfterDelay(200, () => Call("magicbullet", new Parameter[] { "gl_mp", entity.Call <Vector3>("gettagorigin", new Parameter[] { "tag_weapon_left" }), dsa, self }));
                        AfterDelay(400, () => Call("magicbullet", new Parameter[] { "gl_mp", entity.Call <Vector3>("gettagorigin", new Parameter[] { "tag_weapon_left" }), dsa, self }));
                    }
                });

                entity.SpawnedPlayer += new Action(() =>
                {
                    entity.TakeAllWeapons();
                    entity.Call("clearPerks");

                    entity.GiveWeapon(_currentWeapon.Code);
                    entity.Call("giveMaxAmmo", _currentWeapon.Code);

                    entity.AfterDelay(100, player =>
                    {
                        player.SwitchToWeaponImmediate(_currentWeapon.Code);
                        player.Call("iprintlnbold", _currentWeapon.Name);
                    });
                });
            });
        }
        public void UTILS_OnServerStart()
        {
            PlayerConnected     += UTILS_OnPlayerConnect;
            PlayerConnecting    += UTILS_OnPlayerConnecting;
            OnPlayerKilledEvent += UTILS_BetterBalance;

            if (!System.IO.Directory.Exists(ConfigValues.ConfigPath + @"Utils"))
            {
                System.IO.Directory.CreateDirectory(ConfigValues.ConfigPath + @"Utils");
            }

            if (!System.IO.File.Exists(ConfigValues.ConfigPath + @"Utils\badnames.txt"))
            {
                System.IO.File.WriteAllLines(ConfigValues.ConfigPath + @"Utils\badnames.txt", new string[]
                {
                    "thisguyhax.",
                    "MW2Player",
                });
            }

            if (!System.IO.File.Exists(ConfigValues.ConfigPath + @"Utils\badclantags.txt"))
            {
                System.IO.File.WriteAllLines(ConfigValues.ConfigPath + @"Utils\badclantags.txt", new string[]
                {
                    "hkClan",
                });
            }

            if (System.IO.File.Exists(ConfigValues.ConfigPath + @"Utils\announcer.txt"))
            {
                Announcer announcer = new Announcer("default", System.IO.File.ReadAllLines(ConfigValues.ConfigPath + @"Utils\announcer.txt").ToList());
                OnInterval(announcer.message_interval, () =>
                {
                    WriteChatToAll(announcer.SpitMessage());
                    return(true);
                });
            }

            if (!System.IO.Directory.Exists(ConfigValues.ConfigPath + @"Utils\playerlogs"))
            {
                System.IO.Directory.CreateDirectory(ConfigValues.ConfigPath + @"Utils\playerlogs");
            }

            if (!System.IO.Directory.Exists(ConfigValues.ConfigPath + @"Utils\internal\announcers"))
            {
                System.IO.Directory.CreateDirectory(ConfigValues.ConfigPath + @"Utils\internal\announcers");
            }

            // TEAM NAMES
            foreach (Entity player in Players)
            {
                UTILS_SetClientDvars(player);
            }

            // RGADMIN HUDELEM
            if (bool.Parse(Sett_GetString("settings_showversion")))
            {
                RGAdminMessage = HudElem.CreateServerFontString("hudsmall", 0.5f);
                RGAdminMessage.SetPoint("BOTTOMRIGHT", "BOTTOMRIGHT");
                RGAdminMessage.SetText("DG Admin " + ConfigValues.Version);
                RGAdminMessage.Color          = new Vector3(1f, 0.75f, 0f);
                RGAdminMessage.Foreground     = true;
                RGAdminMessage.HideWhenInMenu = true;
            }

            // ADMINS HUDELEM
            if (bool.Parse(Sett_GetString("settings_adminshudelem")))
            {
                OnlineAdmins = HudElem.CreateServerFontString("hudsmall", 0.5f);
                OnlineAdmins.SetPoint("top", "top", 0, 5);
                OnlineAdmins.Foreground     = true;
                OnlineAdmins.Archived       = false;
                OnlineAdmins.HideWhenInMenu = true;
                OnInterval(5000, () =>
                {
                    OnlineAdmins.SetText("^1Online Admins:\n" + string.Join("\n", database.GetAdminsString(Players).Condense(100, "^7, ")));
                    return(true);
                });
            }

            // UNFREEZE PLAYERS ON GAME END
            if (bool.Parse(Sett_GetString("settings_unfreezeongameend")))
            {
                OnGameEnded += UTILS_OnGameEnded;
            }

            // BETTER BALANCE
            Call("setdvarifuninitialized", "betterbalance", bool.Parse(Sett_GetString("settings_betterbalance_enable")) ? "1" : "0");

            // AUTOFPSUNLOCK
            if (bool.Parse(Sett_GetString("settings_enable_autofpsunlock")))
            {
                PlayerConnected += (player) =>
                {
                    player.SetClientDvar("com_maxfps", "0");
                    player.SetClientDvar("con_maxfps", "0");
                }
            }
            ;

            //DLCMAPS
            if (bool.Parse(Sett_GetString("settings_enable_dlcmaps")))
            {
                ConfigValues.AvailableMaps = Data.AllMapNames;
            }
        }
Example #19
0
        public static HudElem createTimer(int time, string label)
        {
            HudElem timerBG = NewHudElem();

            //roundBG.SetPoint("BOTTOM LEFT", "BOTTOM LEFT", 10, -5);
            timerBG.AlignX           = HudElem.XAlignments.Center;
            timerBG.AlignY           = HudElem.YAlignments.Middle;
            timerBG.Alpha            = 0;
            timerBG.Archived         = false;
            timerBG.Foreground       = false;
            timerBG.HideIn3rdPerson  = false;
            timerBG.HideWhenDead     = false;
            timerBG.HideWhenInDemo   = false;
            timerBG.HideWhenInMenu   = false;
            timerBG.Color            = Vector3.Zero;
            timerBG.LowResBackground = false;
            timerBG.HorzAlign        = HudElem.HorzAlignments.Center_Adjustable;
            timerBG.VertAlign        = HudElem.VertAlignments.Middle;
            timerBG.X = -165;
            timerBG.Y = 75;
            timerBG.SetShader("clanlvl_box", 128, 48);
            timerBG.FadeOverTime(.5f);
            timerBG.Alpha = .5f;

            HudElem timer = NewHudElem();

            //timer.SetPoint("CENTER", "CENTER", -150, 50);
            timer.Parent          = timerBG;
            timer.Alpha           = 0;
            timer.Archived        = false;
            timer.Font            = HudElem.Fonts.Objective;
            timer.FontScale       = 2f;
            timer.Foreground      = true;
            timer.HideIn3rdPerson = false;
            timer.HideWhenDead    = false;
            timer.HideWhenInDemo  = false;
            timer.HideWhenInMenu  = false;
            timer.X = 0;
            timer.Y = 0;
            timer.SetPoint("left", "left", 20);
            timer.SetTenthsTimer(time);
            timer.FadeOverTime(.5f);
            timer.Alpha = 1f;

            if (label != "" || !string.IsNullOrEmpty(label))
            {
                HudElem timerText = HudElem.CreateServerFontString(HudElem.Fonts.Default, 1);
                timerText.Parent = timer;
                timerText.Alpha  = 0;
                timerText.SetPoint("left", "left", 45, 12);
                timerText.Archived        = false;
                timerText.Foreground      = true;
                timerText.HideIn3rdPerson = false;
                timerText.HideWhenDead    = false;
                timerText.HideWhenInDemo  = false;
                timerText.HideWhenInMenu  = false;
                timerText.Color           = new Vector3(1, 1, 0.2f);
                timerText.SetText(label + createHudShaderString("hud_killstreak_dpad_arrow_down", false, 38, 48));
                timerText.FadeOverTime(.5f);
                timerText.Alpha = 1;
            }

            return(timer);
        }