Exemple #1
0
        public BoxEntity(BoxType type, Vector3 origin, Vector3 angle, int range)
        {
            Type  = type;
            Range = range;

            Entity = MapEdit.SpawnCrate(origin, angle);
        }
Exemple #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);
                    }
                }
            };
        }
Exemple #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);
                    }
                }
            };
        }