1. Is there an easy/efficient way of getting BasePlayer info when all you have is their 7656xxxxxxxxxxx SteamID?

    CSharp.

    Thanks!
     
  2. Wulf

    Wulf Community Admin

    Using Rust's code:
    Code:
    var player = BasePlayer.FindByID(ulong userId);
    Using Oxide's core:
    Code:
    var player = RustCore.FindPlayerById(string userId);
    Using Oxide's Covalence API:
    Code:
    var basePlayer = players.FindPlayerById(string userId)?.Object as BasePlayer;
    
     
  3. Boss. Thx.
     
  4. More to the point, and a n00b question here, but what does the internals of BasePlayer look like, I am writing my first plugin (well actually a patch for NoEscape plugin to be precise) and I wanted to extract the players SteamID, but I have no idea what BasePlayer objects look like.
     
  5. Wulf

    Wulf Community Admin

    Open up Rust's Assembly-CSharp.dll using a .NET decompiler such as JustDecompile, ILSpy, etc.
     
  6. Alright I'll give this a go when I am back at my Windows box tommorow...
     
  7. Wulf

    Wulf Community Admin

    There are programs that run on Mac and Linux I'm sure. ;)
     
  8. Mono *shudders*, that won't be going on my Mac any time soon. It's all good I have other headaches to deal with concerning Steam OpenID for this evening :)
     
  9. Apologies for a quick follow up point, but I came across this thread while looking for information on this topic, and figured I'd help the next poor sod.

    BasePlayer.FindByID(ulong userId) only works for players actively logged into the server. It doesn't list anyone who's logged off.

    BasePlayer.sleepingPlayerList.Find(o => o.userID == userId) should work for finding sleepers who have not died. Once they've been eaten by a bear, etc. they're pulled off the sleepingPlayerList.

    The Oxide Colvalance library give us
    Interface.Oxide.GetLibrary<Covalence>().Players.FindPlayerById("userIdAsString") for anyone who's ever connected, but this is not a BasePlayer object but an IPlayer with different methods. You also need a using Oxide.Core.Libraries.Covalence; command. Not sure of the scope of this function.

    Found some of this on Getting "BasePlayer of some disconnected?", so thanks to Wulf and those people.
     
  10. Wulf

    Wulf Community Admin

    You do not need to grab the library for Covalence, it's already exposed via "players" if a CovalencePlugin, and "covalence.Players" if a RustPlugin. The Covalence API is the universal API provided by Oxide.