Jump to content

need some help in fixing a plugin from mevent (PAYED)


mrdecoder

Recommended Posts

hi all 
im trying to get help all day on this but nobody knows or how to help 
and mevent is not responding 

i cant wait 3 months before he finaly fixes it so  lets try here 

this is about his shop plugin 

inside he has console commands that should works 
but like alot of things in his plugin it does not 
atleast not through console

im showing a small section of code  that i would like to work


       

 [ConsoleCommand("UI_Shop")]
        private void CmdConsoleShop(ConsoleSystem.Arg arg)
        {
            var player = arg?.Player();
            if (player == null || !arg.HasArgs()) return;

            switch (arg.Args[0])
            {
                case "closeui":
                {
                    _itemsToUpdate.Remove(player);
                    _openedShops.Remove(player);
                    break;
                }

                case "main_page":
                {
                    int catPage, page;
                    if (!arg.HasArgs(3) || !int.TryParse(arg.Args[1], out catPage) ||
                        !int.TryParse(arg.Args[2], out page)) return;

                    var search = string.Empty;
                    if (arg.HasArgs(4)) search = string.Join(" ", arg.Args.Skip(3));

                    if (string.IsNullOrEmpty(search) && catPage == -1)
                        catPage = 0;

                    MainUi(player, catPage, page, GetShopByPlayer(player), search);
                    break;
                }

both of these commands not work in normal way 

so with help from other plugin makers we came up with this:
 

[ConsoleCommand("openshopUI")]
        void OpenShopUI(ConsoleSystem.Arg arg)
        {
            if (!arg.IsRcon) MainUi(arg.Player(), 0, 0, GetShopByPlayer(arg.Player()), string.Empty, true);
        }

this way i can do 
player.SendConsoleCommand("openshopUI");
to open the shop

but sadly we cannot make it work for closing the shop

this is where i need your help in 

i need a simple way to close the shop with a player.SendConsoleCommand

 

Link to comment
Share on other sites


        private List<ulong> _openedUI = new List<ulong>();

        [ConsoleCommand("openshopUI")]
        private void OpenShopUI(ConsoleSystem.Arg arg)
        {
            var player = arg?.Player();
            if (player == null) return;

            if (_openedUI.Contains(player.userID))
            {
                CuiHelper.DestroyUi(player, Layer);
                _openedUI.Remove(player.userID);
            }
            else
            {
                MainUi(player, first: true);
                _openedUI.Add(player.userID);
            }
        }
        

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
1.1m

Downloads

Total number of downloads.

5.6k

Customers

Total customers served.

80.7k

Files Sold

Total number of files sold.

1.6m

Payments Processed

Total payments processed.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.