Exemple #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.");
        }
Exemple #2
0
        public void cmd_lockcrate(Client sender)
        {
            if (sender.GetAccount().AdminLevel < 5)
            {
                return;
            }

            Airdrop a = FindNearestAirdrop(sender);

            if (a == null)
            {
                return;
            }
            if (!a.IsOpen)
            {
                return;
            }

            a.UpdateMarkerClose();
            Account acc = sender.GetAccount();

            ChatManager.NearbyMessage(sender, 10, "~p~" + acc.AdminName + " locks the crate.");



            LogManager.Log(LogManager.LogTypes.AdminActions,
                           $"[/{MethodBase.GetCurrentMethod().GetCustomAttributes(typeof(CommandAttribute), false)[0].CastTo<CommandAttribute>().CommandString}] Admin {acc.AdminName} has locked a crate.");
        }
Exemple #3
0
        public void OpenCrate(Client sender)
        {
            if (API.IsPlayerInAnyVehicle(sender))
            {
                API.SendChatMessageToPlayer(sender, "You can't open a crate while you're in a vehicle!");
                return;
            }

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

            if (closest == null)
            {
                return;
            }

            if (!closest.IsOpen)
            {
                ChatManager.RoleplayMessage(c, "attempts to open the crate, but was unable to open it.", ChatManager.RoleplayMe);
                API.SendChatMessageToPlayer(sender, "The crate is locked.");
                return;
            }

            ChatManager.RoleplayMessage(c, "attempts to open the crate, peering inside.", ChatManager.RoleplayMe);

            InventoryManager.ShowInventoryManager(sender, sender.GetCharacter(), closest, "Inventory: ", "Crate: ");
        }
Exemple #4
0
        private Airdrop FindNearestAirdrop(Client sender, float bound = 5)
        {
            Airdrop drop = null;

            foreach (var a in _airdrops)
            {
                var dist = a.Loc.DistanceTo(API.GetEntityPosition(sender));
                if (dist < bound)
                {
                    drop = a;
                }
            }
            return(drop);
        }
Exemple #5
0
        // Creates the drop, adds it to the list and calls for the prop to be set on the floor.
        public void SpawnDrop(Client sender, IInventoryItem drug)
        {
            var drop = new Airdrop(drug, API.GetEntityPosition(sender));

            _airdrops.Add(drop);
            PlaceAirDropProp(drop, API.GetEntityPosition(sender));
            API.TriggerClientEvent(sender, "PLACE_OBJECT_ON_GROUND_PROPERLY", drop.prop, "");
            Vector3 crateLoc = API.GetEntityPosition(drop.prop);

            drop.SetCorrectCrateLocation(crateLoc);
            drop.marker = new MarkerZone(crateLoc, new Vector3())
            {
                TextLabelText = "Drugs Crate - Locked"
            };
            drop.marker.Create();
        }
Exemple #6
0
        public void cmd_deleteCrate(Client sender)
        {
            Account a = sender.GetAccount();

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

            Airdrop dropToDelete = FindNearestAirdrop(sender);

            if (dropToDelete == null)
            {
                API.SendChatMessageToPlayer(sender, "No airdrops nearby.");
                return;
            }

            dropToDelete.Delete();
            _airdrops.Remove(dropToDelete);
            API.SendChatMessageToPlayer(sender, "Airdrop has been deleted.");
            LogManager.Log(LogManager.LogTypes.AdminActions,
                           $"[/{MethodBase.GetCurrentMethod().GetCustomAttributes(typeof(CommandAttribute), false)[0].CastTo<CommandAttribute>().CommandString}] Admin {a.AdminName} has deleted a crate.");
        }
Exemple #7
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!");
        }
Exemple #8
0
        // Airdrop helper methods.

        public void PlaceAirDropProp(Airdrop drop, Vector3 loc)
        {
            drop.prop = API.CreateObject(1885839156, drop.Loc, new Vector3());
        }