1. Oxide for Rust Legacy has been discontinued and is no longer supported. No updates or additions will be made, and Rust Legacy-specific plugin submissions will no longer be accepted. We recommend upgrading to the latest version of Rust as able.
    Dismiss Notice
  1. PreFiX

    PreFiX Shack Builder Plugin Developer

    Code (Text):
     
    else if (this.IsConnected(clientConnection.UserID))
      {
      Debug.Log((object) ("Denying entry to " + clientConnection.UserID.ToString() + " because they're already connected"));
      approval.Deny(uLink.NetworkConnectionError.AlreadyConnectedToAnotherServer);
      }
      else
      {
      if (Interface.CallHook("OnUserApprove", (object) clientConnection, (object) approval, (object) this) != null)
      return;
      this.m_Connections.Add(clientConnection);
      this.StartCoroutine(clientConnection.AuthorisationRoutine(approval));
      approval.Wait();
      }
     
    I guess it's not possible to hook on Debug.Log messages either.

    Since hook in last else how to make I should hook it?
     
  2. Wulf

    Wulf Community Admin Community Admin Oxide Developer

    What exactly are you wanting to do? Pretty sure legit Rust Legacy by default already prevents duplicate players from connecting. Are you wanting to kick the existing player instead of denying entry to the new?
     
  3. PreFiX

    PreFiX Shack Builder Plugin Developer

    yeah we get lag spikes and people lost connections but they are still in server
     
  4. copper

    copper Shack Builder Plugin Developer

    maybe you can try onuser approve if player in server kick player and try kicking the player a second time. that should work unless the hook doesnt get called.
     
  5. PreFiX

    PreFiX Shack Builder Plugin Developer

    Well that hook works after checking client version and if player in server
     
  6. DraB

    DraB Shack Builder Plugin Developer

    Was this ever solved? Would love a fix for this.
     
  7. Pilatus9

    Pilatus9 Shack Builder Plugin Developer

    The only way to fix it, is hooking the "else" before the approval.Deny, and working with the hook to handle it better and fix it
     
  8. PsychoTea

    PsychoTea Shack Builder Plugin Developer

    I found the original code from the dll and wrote where I think the hook could be added. Kicking the 'ghost' player and returning false on this hook should fix this issue. Maybe if @Wulf could add in this hook and push a new update with his magical Oxide Patcher then we could have this sorted (which would be awesome).

    Code (Text):
    public void uLink_OnPlayerApproval(NetworkPlayerApproval approval)
    {
        if (this.m_Connections.Count >= server.maxplayers)
        {
            approval.Deny(NetworkConnectionError.TooManyConnectedPlayers);
            return;
        }
        ClientConnection clientConnection = new ClientConnection();
        if (!clientConnection.ReadConnectionData(approval.loginData))
        {
            approval.Deny(NetworkConnectionError.IncorrectParameters);
            return;
        }
        if (clientConnection.Protocol != 1069)
        {
            Debug.Log(string.Concat("Denying entry to client with invalid protocol version (", approval.ipAddress, ")"));
            approval.Deny(NetworkConnectionError.IncompatibleVersions);
            return;
        }
        if (BanList.Contains(clientConnection.UserID))
        {
            Debug.Log(string.Concat("Rejecting client (", clientConnection.UserID.ToString(), "in banlist)"));
            approval.Deny(NetworkConnectionError.ConnectionBanned);
            return;
        }
        if (this.IsConnected(clientConnection.UserID) && Interface.CallHook("IOnUserApproveShouldKick")) //Can kick the player on this hook and return false
        {
            Debug.Log(string.Concat("Denying entry to ", clientConnection.UserID.ToString(), " because they're already connected"));
            approval.Deny(NetworkConnectionError.AlreadyConnectedToAnotherServer);
            return;
        }
        object[] objArray = new object[] { clientConnection, approval, this };
        if (Interface.CallHook("IOnUserApprove", objArray) != null)
        {
            return;
        }
        this.m_Connections.Add(clientConnection);
        base.StartCoroutine(clientConnection.AuthorisationRoutine(approval));
        approval.Wait();
    }
     
  9. Wulf

    Wulf Community Admin Community Admin Oxide Developer

    You could actually just bump the index up for IOnUserApprove to be above it and then kick as necessary. I'd probably add a different hook though closer to the top before a few of the checks.
     
  10. Wulf

    Wulf Community Admin Community Admin Oxide Developer

    Does anyone actually have a way to reproduce this on a server that doesn't involve non-Steam players?
     
  11. DraB

    DraB Shack Builder Plugin Developer

    I can yes.
     
  12. Wulf

    Wulf Community Admin Community Admin Oxide Developer

    Do you have any steps?
     
  13. DraB

    DraB Shack Builder Plugin Developer

    Some how make your game crash.. :p
     
  14. PsychoTea

    PsychoTea Shack Builder Plugin Developer

    All you have to do is crash your game at pretty much any point within the connecting screen. Easiest way is probably to force quit the game from Task Manager.
     
    Wulf likes this.
  15. DraB

    DraB Shack Builder Plugin Developer

    Any updates ;)
     
  16. Wulf

    Wulf Community Admin Community Admin Oxide Developer

    We talked about it, but I guess it was forgotten about. I'll check back soon. :)
     
    DraB likes this.
  17. PsychoTea

    PsychoTea Shack Builder Plugin Developer

    I'll have a look at doing what you said and see if I can figure it out -
    I'll submit a PR if I have any success :)
     
  18. DraB

    DraB Shack Builder Plugin Developer

    Solved, thanks Psycho! :)
     
    PsychoTea likes this.