1. After the update there is a strange (Bug?) thing. My plugin GUI (InfoPanel) isn't show up.
    That is my code now in the OnPlayerInit:
    Code:
     void OnPlayerInit(BasePlayer player)
            {
                Puts("PINIT");
                Puts(player.displayName);
                Puts("PL: "+Panels.Count);
                InitializeGUI(player);
                timer.Once(1, () => RefreshOnlineAndSleeperPlayerGui());
            }
    Its working "fine" but my GUI remains in Wonderland....

    If i add this to the OnPlayerSleepEnded then my GUI show up.
    Code:
    void OnPlayerSleepEnded(BasePlayer player)
            {
               
                Puts("PSLEEPEND");
                Puts(player.displayName);
                Puts("PL: " + Panels.Count);
                InitializeGUI(player);
                timer.Once(1, () => RefreshOnlineAndSleeperPlayerGui());
            }
    Based on the console messages every variable is the same.

    There is an other code pieces in the OnServerInitialized function.
    Code:
    foreach (BasePlayer player in BasePlayer.activePlayerList)
                {               
                    InitializeGUI(player);
                }
    This one is calling the same InitializeGUI function and working fine if i am on the server and reload the plugin, so there is no problem i think.

    Any idea? Suggestion?
     
  2. Wulf

    Wulf Community Admin

    Nothing changed with the hook, but it may be the player is taking longer to be spawned in the game now.
     
  3. Use OnPlayerSleepEnded() as you already are.

    Edit:

    LustyMap still works init, maybe worth looking into.
     
    Last edited by a moderator: Oct 2, 2015
  4. I know some of the other UI stuff has changed, it seem like OnPlayerInit is called to early to be used to add UI's now.
    If you use a timer to add the UI later (e.g. 10 seconds later, which is what I am currently doing in LustyMap), then it works, but this is a bit hit and miss as some clients may take longer than 10 seconds to load...

    OnPlayerSleepEnded() is an ok workaround but you need to create some logic so that it only fires once per player per join.
    I guess we need some kind of way to check when the client has finished activating and is ready to accept the UI, but this is where someone cleverer than me needs to step in...
    [DOUBLEPOST=1443799693][/DOUBLEPOST]Been experimenting a little and best I have come up with so far is to check and wait until the ReceivingSnapshot flag for the player is false, then you seem to be able to send the UI.

    Code:
            [HookMethod("OnPlayerInit")]
            void OnPlayerInit(BasePlayer player)
            {
                sendUI(player);
            }        private void sendUI(BasePlayer player)
            {
                if (player.HasPlayerFlag(BasePlayer.PlayerFlags.ReceivingSnapshot))
                {
                    // Player still receiving snapshot, try again in a second...
                    timer.In(1, () => sendUI(player));
                }
                else
                {
                    // Your UI code / method
                }
            }
     
    Last edited by a moderator: Oct 2, 2015
  5. Yeah that is a good solution i think. I tried a lots of variable/function in the BasePlayer/Connection but didn't find better than that.
     
  6. What if the player gets disconnect before the timer kicks in? Like in rpc recieve texture error? maybe OnPlayerRespawned?
     
  7. Wulf

    Wulf Community Admin

    If they get disconnected before the timer, then the UI wasn't even created yet.
     
  8. Just saying, 100% of the times a player gets connected then immediatly disconnected because of rpc recievetexture error (sign artist), the plugin starts throwing timer errors non stop, either until that player connects again, or i reload the infopanel plugin.
     
  9. Wulf

    Wulf Community Admin

    It depends on the plugin. Sign Artist probably needs a few fixes. I've never encountered the error with any of my plugins that use the CUI.
     
  10. I was playing around with UI and the recieve texture error or whatever seems to be happening if you use not available setting. For example a not existing text align mode.