Beispiel #1
0
        public Trampoline(Vector3 origin, Vector3 angle, int height) : base(BoxType.Trampline, origin, angle, 50)
        {
            Height      = height;
            Icon        = "cardicon_tictacboom";
            Shader      = Hud.CreateShader(origin, Icon);
            ObjectiveId = Hud.CreateObjective(origin, Icon);

            OnTriggerString += player =>
            {
                return("Press ^3[{+gostand}] ^7to boost jump.");
            };

            OnInterval(100, e =>
            {
                foreach (var player in Utility.Players)
                {
                    if (player.IsAlive && Origin.DistanceTo(player.Origin) <= Range && player.Call <int>("IsOnGround") == 1)
                    {
                        DoJump(player);
                    }
                }

                return(true);
            });
        }
Beispiel #2
0
        public Gambler(Vector3 origin, Vector3 angle) : base(BoxType.Gambler, origin, angle, 50)
        {
            IsUsing     = false;
            Laptop      = MapEdit.CreateLaptop(Origin);
            Icon        = "cardicon_8ball";
            Shader      = Hud.CreateShader(Origin, Icon);
            ObjectiveId = Hud.CreateObjective(Origin, Icon);
            Cost        = 500;

            OnTriggerString += player =>
            {
                if (!IsUsing && player.GetField <int>("isgambling") == 0)
                {
                    if ((player.GetTeam() == "allies" && Utility.GetDvar <int>("allies_fire_sale") == 1) || (player.GetTeam() == "axis" && Utility.GetDvar <int>("axis_fire_sale") == 1))
                    {
                        return("Press ^3[{+activate}] ^7to gamble. [Cost: ^2$^610^7]");
                    }
                    return("Press ^3[{+activate}] ^7to gamble. [Cost: ^2$^3" + Cost + "^7]");
                }
                return("");
            };

            OnTriggerUse += player =>
            {
                if (IsUsing)
                {
                    return;
                }
                if (!player.IsAlive)
                {
                    return;
                }
                if ((!player.HasField("isgambling") || player.GetField <int>("isgambling") == 0))
                {
                    if ((player.GetTeam() == "allies" && Utility.GetDvar <int>("allies_fire_sale") == 1) || (player.GetTeam() == "axis" && Utility.GetDvar <int>("axis_fire_sale") == 1) && player.GetCash() >= 10)
                    {
                        player.PayCash(10);
                        Gamble(player);
                    }
                    else if (player.GetCash() >= Cost)
                    {
                        player.PayCash(Cost);
                        Gamble(player);
                    }
                    else
                    {
                        player.Println("^1Not enough cash for Gambler. Need ^2$^3" + Cost);
                    }
                }
            };
        }
Beispiel #3
0
        public Teleporter(Vector3 origin, Vector3 exit, Vector3 angle) : base(BoxType.Teleporter, origin, angle, 50)
        {
            Exit        = exit;
            Laptop      = MapEdit.CreateLaptop(Origin);
            Icon        = "hudicon_neutral";
            Shader      = Hud.CreateShader(Origin, Icon);
            ObjectiveId = Hud.CreateObjective(Origin, Icon);
            Cost        = 500;

            OnTriggerString += player =>
            {
                if (player.GetTeam() == "allies")
                {
                    if (player.GetField <int>("usingteleport") == 0)
                    {
                        if ((player.GetTeam() == "allies" && Utility.GetDvar <int>("allies_fire_sale") == 1) || (player.GetTeam() == "axis" && Utility.GetDvar <int>("axis_fire_sale") == 1))
                        {
                            return("Press ^3[{+activate}] ^7to use teleporter. [Cost: ^2$^610^7]");
                        }
                        return("Press ^3[{+activate}] ^7to use teleporter. [Cost: ^2$^3" + Cost + "^7]");
                    }
                }
                return("");
            };

            OnTriggerUse += player =>
            {
                if (!player.IsAlive)
                {
                    return;
                }
                if (player.GetField <int>("usingteleport") == 0)
                {
                    if ((player.GetTeam() == "allies" && Utility.GetDvar <int>("allies_fire_sale") == 1) || (player.GetTeam() == "axis" && Utility.GetDvar <int>("axis_fire_sale") == 1) && player.GetCash() >= 10)
                    {
                        player.PayCash(10);
                        Teleport(player);
                    }
                    else if (player.GetCash() >= Cost)
                    {
                        player.PayCash(Cost);
                        Teleport(player);
                    }
                    else
                    {
                        player.Println("^1Not enough cash for Teleporter. Need ^2$^3" + Cost);
                    }
                }
            };
        }
Beispiel #4
0
        public void CreateElevator(Vector3 enter, Vector3 exit)
        {
            Entity flag = Utility.Spawn("script_model", enter);

            flag.Call("setmodel", Utility.GetFlagModel());
            Utility.Spawn("script_model", exit).Call("setmodel", "prop_flag_neutral");
            Hud.CreateFlagShader(enter);
            Hud.CreateObjective(enter, "compass_waypoint_target");
            OnInterval(100, () =>
            {
                foreach (Entity entity in Utility.Players)
                {
                    if (entity.Origin.DistanceTo(enter) <= 50f)
                    {
                        entity.Call("setorigin", exit);
                    }
                }
                return(true);
            });
        }
Beispiel #5
0
        public PerkColaMachine(Vector3 origin, Vector3 angle, PerkColaType perk) : base(BoxType.PerkColaMachine, origin, angle, 50)
        {
            if (MapEdit.spawnedPerkColas.Contains(perk))
            {
                Dispose();
                return;
            }
            MapEdit.spawnedPerkColas.Add(perk);

            PerkCola    = new PerkCola(perk);
            Icon        = PerkCola.GetIcon();
            ObjectiveId = Hud.CreateObjective(Origin, Icon);
            Cost        = PerkCola.GetCost();

            string fullname = PerkCola.GetFullName();

            OnTriggerString += player =>
            {
                if ((player.GetTeam() == "allies" && Utility.GetDvar <int>("allies_fire_sale") == 1) || (player.GetTeam() == "axis" && Utility.GetDvar <int>("axis_fire_sale") == 1))
                {
                    return("Press ^3[{+activate}] ^7to buy " + fullname + ". [Cost: ^2$^610^7]");
                }
                return("Press ^3[{+activate}] ^7to buy " + fullname + ". [Cost: ^2$^3" + Cost + "^7]");
            };

            OnTriggerUse += player =>
            {
                if (!player.IsAlive)
                {
                    return;
                }
                if ((player.GetTeam() == "allies" && Utility.GetDvar <int>("allies_fire_sale") == 1) || (player.GetTeam() == "axis" && Utility.GetDvar <int>("axis_fire_sale") == 1) && player.GetCash() >= 10)
                {
                    if (player.PerkColasCount() >= 4)
                    {
                        player.PrintlnBold("^1You already have 4 Perk-a-Cola.");
                        return;
                    }
                    if (player.HasPerkCola(PerkCola))
                    {
                        player.PrintlnBold("^1You already have " + fullname + ".");
                        return;
                    }
                    player.PayCash(10);
                    player.GivePerkCola(PerkCola);
                }
                else if (player.GetCash() >= Cost)
                {
                    if (player.PerkColasCount() >= 4)
                    {
                        player.PrintlnBold("^1You already have 4 Perk-a-Cola.");
                        return;
                    }
                    if (player.HasPerkCola(PerkCola))
                    {
                        player.PrintlnBold("^1You already have " + fullname + ".");
                        return;
                    }
                    player.PayCash(Cost);
                    player.GivePerkCola(PerkCola);
                }
                else
                {
                    player.Println("^1Not enough cash for " + fullname + ". Need ^2$^3" + Cost);
                }
            };
        }