1. How can I get when the player open his inventory by binding a key.

    But if he close the inventory with ESC there is nothing I can do.

    What can I do to get if he did close his inventory?
     
    Last edited by a moderator: Jul 1, 2016
  2. Wulf

    Wulf Community Admin

    Take a look at my QuickSort plugin, it has something that does that.
     
  3. Hi Wulf. I did look the code, but I don't get it.

    Code:
    class UIDestroyer : MonoBehaviour
            {
                void PlayerStoppedLooting(BasePlayer player)
                {
                    // Destroy existing UI
                    string gui;
                    if (guiInfo.TryGetValue(player.userID, out gui))
                    {
                        CuiHelper.DestroyUi(player, gui);
                    }
                    Destroy(this);
                }
            }
    Thats what I need?
     
  4. Code:
            void OnLootPlayer(BasePlayer player) => SortUi(player);        void OnLootEntity(BasePlayer player) => SortUi(player);
    What that code doing is saying if (player) is in the guiInfo then remove his GUI.

    So essentially when a player loots himself(opens his inventory) it triggers a hook which adds him to a dictionary or list. When that player ends looting then it removes his GUI and him from the dictionary. T

    Code:
    guiInfo[player.userID] = CuiHelper.GetGuid();//Adds the player to a list/dictionary.
    Code:
    class UIDestroyer : MonoBehaviour
            {
                void PlayerStoppedLooting(BasePlayer player)
                {
                    // Destroy existing UI
                    string gui;
                    if (guiInfo.TryGetValue(player.userID, out gui))
                    {
                        CuiHelper.DestroyUi(player, gui);
                    }
                    Destroy(this);
                }
            }//This is saying if the player has his gui open(added upon looting) then destroy it.
    At least i'm fairly certain that's what it does :D
     
  5. Yes, but OnLootEntity, and OnLootPlayer does not work with the player it self. Just for other players, entities. I think.
     
  6. I'm not sure exactly. I can't do much as im on a laptop D: