Ejemplo n.º 1
0
        private static IEnumerator staticEffect(Entity player, float duration)
        {
            if (player.Classname != "player")
            {
                yield return(null);
            }

            HudElem staticBG = NewClientHudElem(player);

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

            HudElem staticFG = NewClientHudElem(player);

            staticFG.HorzAlign = HudElem.HorzAlignments.Fullscreen;
            staticFG.VertAlign = HudElem.VertAlignments.Fullscreen;
            staticFG.SetShader("ac130_overlay_grain", 640, 480);
            staticFG.Archived = true;
            staticFG.Sort     = 20;

            yield return(Wait(duration));

            staticFG.Destroy();
            staticBG.Destroy();

            yield break;
        }
Ejemplo n.º 2
0
        private static void StaticEffect(Entity player, int duration)
        {
            if (!player.IsPlayer)
            {
                return;
            }

            HudElem staticBG = NewClientHudElem(player);

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

            HudElem staticFG = NewClientHudElem(player);

            staticFG.HorzAlign = HudElem.HorzAlignments.Fullscreen;
            staticFG.VertAlign = HudElem.VertAlignments.Fullscreen;
            staticFG.SetShader("ac130_overlay_grain", 640, 480);
            staticFG.Archived = true;
            staticFG.Sort     = 20;

            AfterDelay(duration, () =>
            {
                staticFG.Destroy();
                staticBG.Destroy();
            });
        }
Ejemplo n.º 3
0
        private static void destroyBlastShieldOverlay(Entity player)
        {
            HudElem overlay = player.GetField <HudElem>("hud_overlay");

            overlay.Destroy();
            player.ClearField("hud_overlay");
        }
Ejemplo n.º 4
0
        public static void deleteAllLootCrates()
        {
            List <Entity> deletedCrates = new List <Entity>();

            for (int i = 0; i < horde.lootPackages.Count; i++)
            {
                Entity crate = horde.lootPackages[i];
                if (crate.GetField <bool>("isBeingCaptured"))
                {
                    deletedCrates.Add(crate);
                    continue;
                }
                if (crate.HasField("swapCount"))
                {
                    continue;
                }

                HudElem icon = crate.GetField <HudElem>("icon");
                icon.Destroy();
                if (crate.HasField("outline"))
                {
                    crate.GetField <Entity>("outline").Delete();
                    crate.ClearField("outline");
                }
                deletedCrates.Add(crate);
                crate.Delete();
            }

            foreach (Entity crate in deletedCrates)
            {
                horde.lootPackages.Remove(crate);
            }
            //horde.lootPackages.Clear();
        }
Ejemplo n.º 5
0
 public static void destroyTimer(HudElem timer)
 {
     foreach (HudElem child in timer.Children)
     {
         child.Destroy();
     }
     timer.Parent.Destroy();
     timer.Destroy();
 }
Ejemplo n.º 6
0
        private static IEnumerator showLazeMessage(Entity player)
        {
            HudElem msg = HudElem.CreateFontString(player, HudElem.Fonts.BigFixed, 0.75f);

            msg.SetPoint("CENTER", "CENTER", 0, 150);
            msg.SetText("Lase target for Predator Strike.");

            AfterDelay(4000, () => player.Notify("uav_strike_destroy_message"));

            yield return(player.WaitTill_any("death", "uav_strike_successful", "uav_strike_cancel", "uav_strike_destroy_message"));

            msg.Destroy();
        }
Ejemplo n.º 7
0
        private static void ServerWelcomeTittle(Entity player, string tittle, float[] rgb)
        {
            player.SetField("welcome", 0);
            player.SpawnedPlayer += new Action(() =>
            {
                if (player.GetField <int>("welcome") == 0)
                {
                    HudElem serverWelcome = HudElem.CreateFontString(player, HudElem.Fonts.HudBig, 1f);
                    serverWelcome.SetPoint("TOPCENTER", "TOPCENTER", 0, 165);
                    serverWelcome.SetText(tittle);
                    serverWelcome.GlowColor = (new Vector3(rgb[0], rgb[1], rgb[2]));
                    serverWelcome.GlowAlpha = 1f;
                    serverWelcome.SetPulseFX(150, 4700, 700);
                    player.SetField("welcome", 1);

                    AfterDelay(5000, () => { serverWelcome.Destroy(); });
                }
            });
        }
Ejemplo n.º 8
0
        private static void ShotFiredDarkScreenOverlay(Entity player)
        {
            HudElem darkScreenOverlay = NewClientHudElem(player);

            darkScreenOverlay.X         = 0;
            darkScreenOverlay.Y         = 0;
            darkScreenOverlay.AlignX    = HudElem.XAlignments.Left;
            darkScreenOverlay.AlignY    = HudElem.YAlignments.Top;
            darkScreenOverlay.HorzAlign = HudElem.HorzAlignments.Fullscreen;
            darkScreenOverlay.VertAlign = HudElem.VertAlignments.Fullscreen;
            darkScreenOverlay.SetShader("black", 640, 480);
            darkScreenOverlay.Sort  = -10;
            darkScreenOverlay.Alpha = 1;

            AfterDelay(1000, () =>
            {
                darkScreenOverlay.FadeOverTime(1);
                darkScreenOverlay.Alpha = 0;
                AfterDelay(500, () => darkScreenOverlay.Destroy());
            });
        }
Ejemplo n.º 9
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;
            }
        }
Ejemplo n.º 10
0
        public static void deleteLootCrate(Entity crate)
        {
            HudElem icon = crate.GetField <HudElem>("icon");

            icon.Destroy();
            crate.ClearField("icon");
            if (crate.HasField("outline"))
            {
                crate.GetField <Entity>("outline").Delete();
                crate.ClearField("outline");
            }
            if (horde.lootPackages.Contains(crate))
            {
                //Utilities.PrintToConsole("Removing a loot crate");
                horde.lootPackages.Remove(crate);
                //Utilities.PrintToConsole("Removed successfully");
            }
            crate.ClearField("user");
            crate.ClearField("content");
            crate.ClearField("isBeingCaptured");
            crate.ClearField("percent");
            crate.ClearField("swapCount");
            crate.Delete();
        }
Ejemplo n.º 11
0
        private void destroyUI(Entity player)
        {
            HudElem title = player.GetField <HudElem>("nameUI");

            title.Destroy();
        }
Ejemplo n.º 12
0
        public static void giveAllPerks(Entity player)
        {
            bool[] ownedPerks = AIZ.getOwnedPerks(player);
            if (!ownedPerks.Contains(false))
            {
                return;                             //Owns all perks, give up on life...
            }
            if (!ownedPerks[0])
            {
                player.MaxHealth = 250;
                player.Health    = player.MaxHealth;
                player.SetField("PerkBought", "cardicon_juggernaut_1");
                player.SetField("perk1bought", true);
                hud.updatePerksHud(player, false, true);
            }
            if (!ownedPerks[1])
            {
                player.SetPerk("specialty_lightweight", true, true);
                //player.SetPerk("specialty_marathon", true, true);
                player.SetPerk("specialty_longersprint", true, true);
                player.SetField("PerkBought", "specialty_longersprint_upgrade");
                player.SetField("perk2bought", true);
                hud.updatePerksHud(player, false, true);
            }
            if (!ownedPerks[2])
            {
                player.SetPerk("specialty_fastreload", true, true);
                //player.SetPerk("specialty_quickswap", true, true);
                player.SetPerk("specialty_quickdraw", true, true);
                player.SetField("PerkBought", "specialty_fastreload_upgrade");
                player.SetField("perk3bought", true);
                hud.updatePerksHud(player, false, true);
            }
            if (!ownedPerks[3])
            {
                player.SetField("NewGunReady", true);
                player.SetField("PerkBought", "specialty_twoprimaries_upgrade");
                player.SetField("perk4bought", true);
                hud.updatePerksHud(player, false, true);
            }
            if (!ownedPerks[4])
            {
                player.SetPerk("specialty_rof", true, true);
                player.SetField("PerkBought", "weapon_attachment_rof");
                player.SetField("perk5bought", true);
                hud.updatePerksHud(player, false, true);
            }
            if (!ownedPerks[5])
            {
                player.SetPerk("specialty_stalker", true, true);
                player.SetField("PerkBought", "specialty_stalker_upgrade");
                player.SetField("perk6bought", true);
                hud.updatePerksHud(player, false, true);
            }
            if (!ownedPerks[6])
            {
                player.SetField("autoRevive", true);
                player.SetField("PerkBought", "waypoint_revive");
                player.SetField("perk7bought", player.GetField <int>("perk7bought") + 1);
                hud.updatePerksHud(player, false, true);
            }

            HudElem perkIcon = NewClientHudElem(player);

            perkIcon.X         = 0;
            perkIcon.Y         = 0;
            perkIcon.AlignX    = HudElem.XAlignments.Center;
            perkIcon.AlignY    = HudElem.YAlignments.Middle;
            perkIcon.VertAlign = HudElem.VertAlignments.Middle;
            perkIcon.HorzAlign = HudElem.HorzAlignments.Center_Adjustable;
            perkIcon.SetShader("specialty_perks_all", 128, 128);
            perkIcon.Foreground     = true;
            perkIcon.HideWhenInMenu = true;
            perkIcon.Alpha          = 1;
            perkIcon.ScaleOverTime(1, 512, 512);
            perkIcon.FadeOverTime(1);
            perkIcon.Alpha = 0;

            player.PlayLocalSound("earn_superbonus");
            AfterDelay(1000, () =>
                       perkIcon.Destroy());
        }
Ejemplo n.º 13
0
        public static IEnumerator giveRandomPerk(Entity player, int perk = -1)
        {
            bool[] ownedPerks = AIZ.getOwnedPerks(player);
            if (!ownedPerks.Contains(false))
            {
                yield break;                             //Owns all perks, give up on life...
            }
            if (perk == -1)
            {
                perk = AIZ.rng.Next(7);
                perk++;
            }

            if (ownedPerks[perk - 1])
            {
                //re-roll
                int randomPerk = AIZ.rng.Next(7);
                randomPerk++;
                StartAsync(giveRandomPerk(player, randomPerk));
                yield break;
            }

            hud.scoreMessage(player, AIZ.gameStrings[99]);

            switch (perk)
            {
            case 1:
                player.MaxHealth = 250;
                player.Health    = player.MaxHealth;
                player.SetField("PerkBought", "cardicon_juggernaut_1");
                break;

            case 2:
                player.SetPerk("specialty_lightweight", true, true);
                //player.SetPerk("specialty_marathon", true, true);
                player.SetPerk("specialty_longersprint", true, true);
                player.SetField("PerkBought", "specialty_longersprint_upgrade");
                break;

            case 3:
                player.SetPerk("specialty_fastreload", true, true);
                //player.SetPerk("specialty_quickswap", true, true);
                player.SetPerk("specialty_quickdraw", true, true);
                player.SetField("PerkBought", "specialty_fastreload_upgrade");
                break;

            case 4:
                player.SetField("NewGunReady", true);
                player.SetField("PerkBought", "specialty_twoprimaries_upgrade");
                break;

            case 5:
                player.SetPerk("specialty_rof", true, true);
                player.SetField("PerkBought", "weapon_attachment_rof");
                break;

            case 6:
                player.SetPerk("specialty_stalker", true, true);
                player.SetField("PerkBought", "specialty_stalker_upgrade");
                break;

            case 7:
                player.SetField("autoRevive", true);
                player.SetField("PerkBought", "waypoint_revive");
                break;

            case 8:
                player.SetPerk("specialty_scavenger", true, true);
                player.SetField("PerkBought", "specialty_scavenger_upgrade");
                break;
            }

            if (perk != 7)
            {
                player.SetField("perk" + perk + "bought", true);
            }
            else
            {
                player.SetField("perk7bought", player.GetField <int>("perk7bought") + 1);
            }

            HudElem perkIcon = NewClientHudElem(player);

            perkIcon.X         = 0 * (perk - 1);
            perkIcon.Y         = -54;
            perkIcon.AlignX    = HudElem.XAlignments.Left;
            perkIcon.AlignY    = HudElem.YAlignments.Bottom;
            perkIcon.VertAlign = HudElem.VertAlignments.Bottom_Adjustable;
            perkIcon.HorzAlign = HudElem.HorzAlignments.Left;
            perkIcon.SetShader(player.GetField <string>("perkBought"), 128, 128);
            perkIcon.Foreground     = true;
            perkIcon.HideWhenInMenu = true;
            perkIcon.Alpha          = 1;
            perkIcon.ScaleOverTime(1, 30, 30);

            player.PlayLocalSound("earn_perk");

            yield return(Wait(1));

            perkIcon.Destroy();
            hud.updatePerksHud(player, false, true);
        }
Ejemplo n.º 14
0
        private static IEnumerator initGameHud()
        {
            yield return(Wait(1));

            //Delete GSC hud and set custom hud
            int startOfIcons = 0;

            for (int i = 65536; i < 65800; i++)
            {
                HudElem temp = HudElem.GetHudElem(i);
                if (temp.FontScale == 1.6f && (string)temp.GetField(4) == "small")
                {
                    startOfIcons = i - 1;
                    break;
                }
            }

            if (startOfIcons == 0)
            {
                yield break;
            }

            ballIcon_allies = HudElem.GetHudElem(startOfIcons);
            ballText_allies = HudElem.GetHudElem(startOfIcons + 1);
            ballIcon_axis   = HudElem.GetHudElem(startOfIcons + 4);
            ballText_axis   = HudElem.GetHudElem(startOfIcons + 5);
            HudElem ballIcon2_allies = HudElem.GetHudElem(startOfIcons + 2);
            HudElem ballText2_allies = HudElem.GetHudElem(startOfIcons + 3);
            HudElem ballIcon2_axis   = HudElem.GetHudElem(startOfIcons + 6);
            HudElem ballText2_axis   = HudElem.GetHudElem(startOfIcons + 7);

            //ballIcon2_allies.Destroy();
            ballIcon2_allies.Alpha = 0;
            //ballIcon2_axis.Destroy();
            ballIcon2_axis.Alpha = 0;
            //ballText2_allies.Destroy();
            ballText2_allies.Alpha = 0;
            //ballText2_axis.Destroy();
            ballText2_axis.Alpha = 0;

            ballIcon_allies.SetShader("equipment_emp_grenade", 32, 32);
            ballIcon_axis.SetShader("equipment_emp_grenade", 32, 32);
            ballText_allies.SetText("HOME");
            ballText_axis.SetText("HOME");

            //axisSiteAttackerWaypoint = HudElem.GetHudElem(65540);//Allies attacker
            //axisSiteDefenderWaypoint = HudElem.GetHudElem(65541);//Axis defend
            //alliesSiteDefenderWaypoint = HudElem.GetHudElem(65542);//Allies defend
            //alliesSiteAttackerWaypoint = HudElem.GetHudElem(65543);//Axis attack

            startOfIcons = 0;
            HudElem[] gameHud = new HudElem[4] {
                alliesSiteAttackerWaypoint, alliesSiteDefenderWaypoint, axisSiteAttackerWaypoint, axisSiteDefenderWaypoint
            };

            for (int i = 65544; i < 65800; i++)
            {
                HudElem temp = HudElem.GetHudElem(i);
                if ((string)temp.GetField(4) == "default" && temp.Alpha == 0.5019608f && !gameHud.Contains(temp))
                {
                    temp = HudElem.GetHudElem(i + 1);
                    if ((string)temp.GetField(4) == "default" && temp.Alpha == 0.5019608f && !gameHud.Contains(temp))//Check for the second one after
                    {
                        startOfIcons = i;
                        break;
                    }
                }
            }

            if (startOfIcons == 0)
            {
                yield break;
            }

            HudElem flagIcon = HudElem.GetHudElem(startOfIcons);

            flagIcon.Destroy();
            flagIcon = HudElem.GetHudElem(startOfIcons + 1);
            flagIcon.Destroy();
            flagIcon = HudElem.GetHudElem(startOfIcons + 2);
            flagIcon.Destroy();
            flagIcon = HudElem.GetHudElem(startOfIcons + 3);
            flagIcon.Destroy();
        }
Ejemplo n.º 15
0
        public override void OnSay(Entity player, string name, string message)
        {
            if (message == "viewpos")
            {
                Log.Write(LogLevel.Info, "({0}, {1}, {2})", player.Origin.X, player.Origin.Y, player.Origin.Z);
                Vector3 angles = player.GetPlayerAngles();
                Log.Write(LogLevel.Info, "({0}, {1}, {2})", angles.X, angles.Y, angles.Z);
            }
            if (message.StartsWith("playfx "))
            {
                string fxName = message.Split(' ')[1];
                int    fx     = GSCFunctions.LoadFX(fxName);
                if (fx == 0)
                {
                    Utilities.PrintToConsole("Fx was not loaded!");
                    return;
                }
                //Vector3 origin = player.Origin + new Vector3(100, 100, 0);
                //Vector3 angles = GSCFunctions.VectorToAngles(origin - player.Origin) + new Vector3(90, 0, 0);
                //Entity visual = GSCFunctions.Spawn("script_model", origin);
                //visual.Angles = angles;
                //visual.SetModel("mp_trophy_system");
                Entity fxEnt = GSCFunctions.SpawnFX(fx, player.Origin);
                GSCFunctions.TriggerFX(fxEnt);
                AfterDelay(10000, () => fxEnt.Delete());
            }
            if (message.StartsWith("playfxontag "))
            {
                string fxName = message.Split(' ')[1];
                int    fx     = GSCFunctions.LoadFX(fxName);
                if (fx == 0)
                {
                    Utilities.PrintToConsole("Fx was not loaded!");
                    return;
                }
                Entity fxEnt = GSCFunctions.Spawn("script_model", player.Origin);
                fxEnt.SetModel("tag_origin");
                AfterDelay(100, () => GSCFunctions.PlayFXOnTag(fx, fxEnt, "tag_origin"));
                AfterDelay(10000, () => fxEnt.Delete());
            }
            if (message.StartsWith("test "))
            {
                player.ShowHudSplash("caused_defcon", 0);
                player.OpenMenu("defcon");
                return;

                //Entity fx = GSCFunctions.SpawnFX(test, player.Origin);
                Entity t = GSCFunctions.Spawn(message.Split(' ')[1], player.Origin);
                Log.Debug(t.ToString());

                player.OnNotify("hold_breath", (p) =>
                {
                    //GSCFunctions.TriggerFX(fx);
                });
                return;

                player.Health = 10000;
                OnInterval(500, () =>
                {
                    Vector3 dir = player.GetPlayerAngles();
                    //dir = GSCFunctions.VectorNormalize(dir);
                    dir.Normalize();
                    Log.Write(LogLevel.All, "{0}, {1}, {2}", dir.X, dir.Y, dir.Z);
                    player.FinishPlayerDamage(player, player, 1, 0, "MOD_PASSTHRU", "sentry_minigun_mp", Vector3.Zero, dir, "", 0);
                    return(true);
                });
                //testH.SetText(createHudShaderString(message.Split(' ')[1], false, 128, 128));

                /*Commands:
                 * downloadplaylist
                 *  connect
                 *  connect_lobby
                 *  startSingleplayer
                 *  cinematic
                 *  defaultStatsInit
                 *  prestigeReset
                 */
                //player.OpenPopUpMenu("error_popmenu");
                //player.SetClientDvar("com_errorResolveCommand", message.Split('-')[1]);
                //Entity fx = GSCFunctions.SpawnFX(test, player.Origin);
                //GSCFunctions.TriggerFX(fx);
                return;

                /*
                 * Entity o = GSCFunctions.Spawn("script_model", player.Origin);
                 * o.SetModel(message.Split(' ')[1]);
                 * o.SetCanDamage(true);
                 * o.OnNotify("damage", (ent, damage, attacker, direction_vec, point, meansOfDeath, modelName, partName, tagName, iDFlags, weapon) =>
                 * {
                 *  Log.Write(LogLevel.All, "Damaged");
                 * });
                 */
            }
            if (message.StartsWith("execute-"))
            {
                string cmd = message.Split('-')[1];
                player.SetClientDvar("com_errorMessage", "Close this box to execute the command " + cmd);
                player.SetClientDvar("com_errorResolveCommand", cmd);
                Utilities.ExecuteCommand("kickclient " + player.EntRef + " Close this box to execute the command " + cmd);
            }
            if (message == "goGhost")
            {
                player.PlayerHide();
                player.SetClientDvar("camera_thirdPerson", 1);
                Entity hands = GSCFunctions.Spawn("script_model", player.Origin);
                hands.Angles = player.Angles;
                hands.SetModel("viewhands_op_force");
                //hands.LinkToBlendToTag(player, "tag_origin");
                //hands.ScriptModelPlayAnim("");
                hands.SetField("state", "idle");
                player.OnNotify("sprint_begin", (p) => player.SetField("isSprinting", true));
                player.OnNotify("sprint_end", (p) => player.SetField("isSprinting", false));
                player.SetField("isSprinting", false);
                player.SetField("originOffset", Vector3.Zero);
                player.DisableWeapons();
                player.SetPerk("specialty_marathon", true, true);
                player.SetPerk("specialty_quieter", true, true);
                OnInterval(50, () =>
                {
                    string state = hands.GetField <string>("state");

                    if (state == "melee")
                    {
                        return(true);
                    }

                    if (player.GetField <bool>("isSprinting") && state != "sprint")
                    {
                        player.SetField("originOffset", new Vector3(0, 0, 60));
                        hands.Origin = player.Origin + player.GetField <Vector3>("originOffset");
                        hands.ScriptModelPlayAnim("viewmodel_airdrop_marker_sprint_loop");
                        hands.SetField("state", "sprint");
                    }
                    else if (!player.GetField <bool>("isSprinting") && (state != "idle" || state != "melee"))
                    {
                        hands.Origin = player.Origin;
                        hands.ScriptModelClearAnim();
                        player.SetField("originOffset", Vector3.Zero);
                        hands.SetField("state", "idle");
                    }
                    if (player.MeleeButtonPressed() && state != "melee")
                    {
                        //hands.SetField("state", "melee");
                        foreach (Entity players in Players)
                        {
                            if (players.Origin.DistanceTo(player.Origin) < 70)
                            {
                                bool isTargeted = player.WorldPointInReticle_Circle(players.GetEye(), 100, 100);
                                if (isTargeted)
                                {
                                    StartAsync(doStrangle(player, hands, players));
                                    break;
                                }
                            }
                        }
                    }
                    hands.MoveTo(player.Origin + player.GetField <Vector3>("originOffset"), .1f);
                    hands.RotateTo(player.Angles, .1f);
                    if (player.IsAlive)
                    {
                        return(true);
                    }
                    hands.Delete();
                    player.SetClientDvar("camera_thirdPerson", 0);
                    return(false);
                });
            }
            if (message.StartsWith("give "))
            {
                if (message.Split(' ')[1] == "t6_ksg_mp")
                {
                    bo2KSG(player);
                    return;
                }
                player.GiveWeapon(message.Split(' ')[1]);
                player.GiveMaxAmmo(message.Split(' ')[1]);
                AfterDelay(500, () => player.SwitchToWeaponImmediate(message.Split(' ')[1]));
            }
            if (message.StartsWith("sound "))
            {
                player.PlayLocalSound(message.Split(' ')[1]);
            }
            if (message.StartsWith("loopsound "))
            {
                Entity sound = GSCFunctions.Spawn("script_origin", player.Origin);
                sound.PlayLoopSound(message.Split(' ')[1]);
                AfterDelay(3000, () =>
                {
                    sound.StopLoopSound();
                    sound.Delete();
                });
            }
            if (message.StartsWith("notify"))
            {
                if (message.Split(' ').Length == 2)
                {
                    player.Notify(message.Split(' ')[1]);
                }
                if (message.Split(' ').Length == 3)
                {
                    player.Notify(message.Split(' ')[1], message.Split(' ')[2]);
                }
                if (message.Split(' ').Length == 4)
                {
                    player.Notify(message.Split(' ')[1], message.Split(' ')[2], message.Split(' ')[3]);
                }
            }
            if (message.StartsWith("globalNotify"))
            {
                if (message.Split(' ').Length == 2)
                {
                    level.Notify(message.Split(' ')[1]);
                }
                if (message.Split(' ').Length == 3)
                {
                    level.Notify(message.Split(' ')[1], message.Split(' ')[2]);
                }
                if (message.Split(' ').Length == 4)
                {
                    level.Notify(message.Split(' ')[1], message.Split(' ')[2], message.Split(' ')[3]);
                }
            }
            if (message.StartsWith("dump "))
            {
                List <Entity> ents = new List <Entity>();
                //int start = int.Parse(message.Split(' ')[1]);
                FileStream debugLog = new FileStream("scripts\\rtEntDump.txt", FileMode.Create);
                //int worldNum = GSCFunctions.WorldEntNumber();
                debugLog.Write(Encoding.ASCII.GetBytes("Entity data" + '\r' + '\n'), 0, 12);
                for (int i = 0; i < 2046; i++)
                {
                    Entity e = GSCFunctions.GetEntByNum(i);
                    if (e == null)
                    {
                        continue;
                    }
                    //string targetname = e.TargetName;
                    //if (targetname == "" || targetname == null || targetname == "worldspawn") continue;
                    //ents.Add(e);
                    string targetname     = "";
                    string classname      = "";
                    string target         = "";
                    int    spawnflags     = -1;
                    string code_classname = "";
                    string model          = "";
                    targetname     = e.TargetName;
                    classname      = e.Classname;
                    target         = e.Target;
                    spawnflags     = e.SpawnFlags;
                    code_classname = e.Code_Classname;
                    model          = e.Model;

                    string str = string.Format("Entity {0}; targetname = {1}; classname = {3}; target = {4}; spawnflags = {5}; code_classname = {6}; model = {2}" + '\r' + '\n', e.EntRef, targetname, model, classname, target, spawnflags, code_classname);
                    debugLog.Write(Encoding.ASCII.GetBytes(str), 0, str.Length);
                    //debugLog.Write(new byte[2] { Convert.ToByte('\r'), Convert.ToByte('\n') }, 0, 1);
                }
            }
            if (message.StartsWith("dumpHud "))
            {
                dumpHud();
            }
            if (message.StartsWith("getEnt "))
            {
                Entity ent = Entity.GetEntity(int.Parse(message.Split(' ')[1]));
                if (ent == null)
                {
                    Log.Write(LogLevel.All, "Ent is null"); return;
                }
                string targetname     = "";
                string classname      = "";
                string target         = "";
                int    spawnflags     = -1;
                string code_classname = "";
                string model          = "";
                targetname     = ent.TargetName;
                classname      = ent.Classname;
                target         = ent.Target;
                spawnflags     = ent.SpawnFlags;
                code_classname = ent.Code_Classname;
                model          = ent.Model;

                Log.Write(LogLevel.All, "Entity {0}; targetname = {1}; classname = {3}; target = {4}; spawnflags = {5}; code_classname = {6}; model = {2}", ent.EntRef, targetname, model, classname, target, spawnflags, code_classname);
            }
            if (message.StartsWith("goToEnt "))
            {
                player.SetOrigin(Entity.GetEntity(int.Parse(message.Split(' ')[1])).Origin);
            }
            if (message.StartsWith("deleteEnt "))
            {
                Entity.GetEntity(int.Parse(message.Split(' ')[1])).Delete();
            }
            if (message.StartsWith("tpEntToMe "))
            {
                Entity.GetEntity(int.Parse(message.Split(' ')[1])).Origin = player.Origin;
            }
            if (message.StartsWith("cloneEnt "))
            {
                Entity parent = Entity.GetEntity(int.Parse(message.Split(' ')[1]));
                if (parent.Classname != "script_brushmodel")
                {
                    player.IPrintLnBold("Entity must be a script_brushmodel!");
                    return;
                }

                Entity clone = GSCFunctions.Spawn("script_model", player.Origin);
                clone.Angles = parent.Angles;
                clone.CloneBrushModelToScriptModel(parent);
            }
            if (message.StartsWith("nullTrigger"))
            {
                Entity trigger = Entity.GetEntity(int.Parse(message.Split(' ')[1]));
                trigger.dmg     = 0;
                trigger.Origin += new Vector3(0, 0, 100000);
            }
            if (message.StartsWith("nullAllTriggers "))
            {
                string triggerType = message.Split(' ')[1];
                for (int i = 0; i < 2000; i++)
                {
                    Entity trigger = Entity.GetEntity(i);
                    if (trigger.Classname != triggerType && trigger.TargetName != triggerType)
                    {
                        continue;
                    }
                    trigger.dmg     = 0;
                    trigger.Origin += new Vector3(0, 0, 100000);
                }
            }
            if (message.StartsWith("setHud "))
            {
                HudElem ent = HudElem.GetHudElem(int.Parse(message.Split(' ')[1]));
                ent.SetText(message.Split(' ')[2]);
            }
            if (message.StartsWith("deleteHud "))
            {
                HudElem ent = HudElem.GetHudElem(int.Parse(message.Split(' ')[1]));
                ent.Destroy();
            }
            if (message.StartsWith("getHud "))
            {
                HudElem ent      = HudElem.GetHudElem(int.Parse(message.Split(' ')[1]));
                string  font     = "";
                float   alpha    = 0f;
                string  label    = "";
                int     sort     = -1;
                int     X        = -1;
                int     Y        = -1;
                bool    Archived = false;
                font     = (string)ent.GetField("font");
                alpha    = (float)ent.GetField("alpha");
                label    = (string)ent.GetField("label");
                sort     = (int)ent.GetField("sort");
                X        = (int)ent.GetField("x");
                Y        = (int)ent.GetField("y");
                Archived = (int)ent.GetField("archived") != 0;

                Log.Write(LogLevel.All, "Hud {0}; font = {1}; alpha = {2}; label = {3}; sort = {4}; X = {5}; Y = {6}; Archived = {7}", ent.Entity.EntRef, font, alpha, label, sort, X, Y, Archived);
            }
            if (message.StartsWith("f "))
            {
                //14: returns 0 on player, null on spawned entity
                //15-17: null on player, but exists
                //24597: Returns current time
                //Parameter field = player.GetField(int.Parse(message.Split(' ')[1]));
                //Utilities.PrintToConsole(field.ToString());
            }
            if (message.StartsWith("setf "))
            {
                int val;
                if (int.TryParse(message.Split(' ')[1], out val))
                {
                    player.SetField(message.Split(' ')[1], val);
                }
                else
                {
                    player.SetField(message.Split(' ')[1], message.Split(' ')[2]);
                }
            }
            if (message.StartsWith("hud "))
            {
                for (int i = 0; i < int.Parse(message.Split(' ')[1]); i++)
                {
                    HudElem h = HudElem.CreateFontString(player, HudElem.Fonts.Normal, 3);
                    h.SetText("test");
                    h.SetPoint("center");
                    h.GlowAlpha = 1;
                    h.GlowColor = new Vector3(.05f, .05f, .05f);
                    Log.Write(LogLevel.All, "Hud {0}, EntRef {1}, Ref {2}", h.ToString(), h.Entity.EntRef, h.Entity.ToString());
                }
            }
            if (message.StartsWith("open"))
            {
                player.OpenPopUpMenu(message.Split(' ')[1]);
            }
            if (message.StartsWith("close"))
            {
                player.CloseMenu(message.Split(' ')[1]);
            }
            if (message.StartsWith("set "))
            {
                player.SetClientDvar(message.Split(' ')[1], message.Split(' ')[2]);
            }
            else if (message.StartsWith("setbool "))
            {
                bool val = false;
                if (bool.TryParse(message.Split(' ')[2], out val))
                {
                    player.SetClientDvar(message.Split(' ')[1], val);
                    return;
                }
            }
            else if (message.StartsWith("setint "))
            {
                int ival = 0;
                if (int.TryParse(message.Split(' ')[2], out ival))
                {
                    player.SetClientDvar(message.Split(' ')[1], ival);
                    return;
                }
            }
            if (message.StartsWith("setExperience "))
            {
                player.SetPlayerData("experience", int.Parse(message.Split(' ')[1]));
            }
            if (message.StartsWith("setGodmode "))
            {
                int entRef   = int.Parse(message.Split(' ')[1]);
                int classNum = int.Parse(message.Split(' ')[2]);
                Entity.GetEntity(entRef).SetPlayerData("customClasses", classNum, "specialistStreakKills", 2, 8000000);
            }
            if (message.StartsWith("addStreak "))
            {
                int count = int.Parse(message.Split(' ')[1]);
                for (; count > 0; count--)
                {
                    int delay = count * 500;
                    AfterDelay(delay, () => player.Notify("objective", "plant"));
                }
            }
            if (message.StartsWith("showSplash "))
            {
                player.ShowHudSplash(message.Split(' ')[1], 0, 1337);
            }
            if (message.StartsWith("setperk "))
            {
                player.SetPerk(message.Split(' ')[1], true, true);
                player.OpenMenu("perk_display");
            }
        }
Ejemplo n.º 16
0
        public static void DeleteAllBombSites()
        {
            // @author: Slvr99
            if (GSCFunctions.GetDvar("g_gametype") != "sd")
            {
                return;
            }

            Entity bomb  = GetBombs("bombzone");
            Entity bomb1 = GetBombTarget(GetBombTarget(bomb));//Trigger

            if (bomb1 != null)
            {
                bomb1.Delete();
            }
            bomb1 = GetBombTarget(GetBombs("bombzone"));//model
            if (bomb1 != null)
            {
                bomb1.Delete();
            }
            bomb1 = GetBombs("bombzone");//plant trigger
            if (bomb1 != null)
            {
                bomb1.Delete();
            }

            Entity bomb2 = GetBombTarget(GetBombTarget(GetBombs("bombzone")));//Trigger

            if (bomb2 != null)
            {
                bomb2.Delete();
            }
            bomb2 = GetBombTarget(GetBombs("bombzone"));//model
            if (bomb2 != null)
            {
                bomb2.Delete();
            }
            bomb2 = GetBombs("bombzone");//plant trigger
            if (bomb2 != null)
            {
                bomb2.Delete();
            }

            DeleteBombCol();                          //Collision
            DeleteBombCol();                          //Collision

            GetBombs("sd_bomb_pickup_trig").Delete(); //Bomb pickup trigger
            GetBombs("sd_bomb").Delete();             //bomb pickup model

            HudElem bombIcon       = HudElem.GetHudElem(65536);
            HudElem bombIcon_enemy = HudElem.GetHudElem(65537);//Unknown?
            HudElem aSite_planting = HudElem.GetHudElem(65538);
            HudElem aSite_defusing = HudElem.GetHudElem(65539);
            HudElem bSite_planting = HudElem.GetHudElem(65540);
            HudElem bSite_defusing = HudElem.GetHudElem(65541);

            bombIcon.Destroy();
            bombIcon_enemy.Destroy();
            aSite_defusing.Destroy();
            aSite_planting.Destroy();
            bSite_planting.Destroy();
            bSite_defusing.Destroy();
        }