示例#1
0
        public void cmd_aopencrate(Client sender)
        {
            Account a = sender.GetAccount();

            if (a.AdminLevel < 5)
            {
                return;
            }

            if (a.AdminDuty)
            {
                Airdrop drop = FindNearestAirdrop(sender);
                if (drop == null)
                {
                    API.SendChatMessageToPlayer(sender, "No crate around.");
                    return;
                }

                if (drop.IsOpen)
                {
                    API.SendChatMessageToPlayer(sender, "Crates already open!");
                    return;
                }

                ChatManager.NearbyMessage(sender, 10, "~p~" + a.AdminName + " opens the crate.");
                drop.IsOpen = true;
                drop.UpdateMarkerOpen();
                return;
            }

            API.SendChatMessageToPlayer(sender, "You're not on admin duty!");
            LogManager.Log(LogManager.LogTypes.AdminActions,
                           $"[/{MethodBase.GetCurrentMethod().GetCustomAttributes(typeof(CommandAttribute), false)[0].CastTo<CommandAttribute>().CommandString}] Admin {a.AdminName} has admin opened a crate.");
        }
示例#2
0
        public void PryCrate(Client sender)
        {
            if (API.IsPlayerInAnyVehicle(sender))
            {
                API.SendChatMessageToPlayer(sender, "You can't pry a crate while you're in a vehicle!");
                return;
            }

            Character c       = sender.GetCharacter();
            Airdrop   closest = FindNearestAirdrop(sender);

            if (closest == null)
            {
                return;
            }

            if (closest.IsOpen)
            {
                API.SendChatMessageToPlayer(sender, "This crate is already open!");
                return;
            }

            if (!closest.IsOpen && InventoryManager.DoesInventoryHaveItem <Crowbar>(c).Length >= 1)
            {
                ChatManager.RoleplayMessage(c, "forces open the crate, using their crowbar to pry the lid off.",
                                            ChatManager.RoleplayMe);
                closest.UpdateMarkerOpen();
                LogManager.Log(LogManager.LogTypes.Commands,
                               $"[/{MethodBase.GetCurrentMethod().GetCustomAttributes(typeof(CommandAttribute), false)[0].CastTo<CommandAttribute>().CommandString}] User {c.CharacterName} has opened a crate.");

                return;
            }

            ChatManager.RoleplayMessage(c, "attempts to pry open the crate lid with their hands, but is unable to.", ChatManager.RoleplayMe);
            API.SendChatMessageToPlayer(sender, "You need a crowbar for this!");
        }