Get player name from ulong Steam ID?Solved
Hiya,

I'm trying to get a player name from a Steam ID ulong - so far I have this which was a solution I found in the forum here:

BasePlayer player = BasePlayer.FindPlayer(id);
string playerName = player.displayName;​

But this errors out saying `BasePlayer` doesn't have a `FindPlayer` method, I also tried dropping in `FindPlayerByID` but got the same :(

Any help appreciated on this.

Thanks.
Did you add all references to your IDE? Also try players.FindPlayerById(id.ToString())?.Name ?? "Unknown" that would return unknown if not found and otherwise their name.
Thanks for the reply, what references do I need?
Usually I just add them all in VS/Rider
I'm not an expert at this stuff - when you say a reference, you mean a `using` declaration? I currently have:

using System;
using System.Linq;
using Rust;
using Oxide.Plugins;
using Oxide.Core.Plugins;
using Oxide.Core.Libraries;
using Oxide.Core.Libraries.Covalence;
using Microsoft.CSharp;
using System.Collections.Generic;​

When I add `players.FindPlayerById(id.ToString())?.Name ?? "Unknown"` I get an error in the console that says `players does not exist in the current context`

Merged post

Got it working - thanks my friend!
Locked automatically