Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 14 additions & 9 deletions Game.Client/C_BasePlayer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,15 +96,20 @@ public C_BasePlayer() {
static EUniverse SteamIDUniverse = EUniverse.k_EUniverseInvalid;
public bool GetSteamID(out CSteamID id) {
id = default;
if (engine.GetPlayerInfo(EntIndex(), out PlayerInfo pi)) {
if (pi.FriendsID != 0 && SteamAPI.IsSteamRunning()) {
if (SteamIDUniverse == EUniverse.k_EUniverseInvalid)
SteamIDUniverse = SteamUtils.GetConnectedUniverse();
id.InstancedSet(new AccountID_t(pi.FriendsID), 1, SteamIDUniverse, EAccountType.k_EAccountTypeIndividual);
return true;
}
}
return false;
if (!engine.GetPlayerInfo(EntIndex(), out PlayerInfo pi))
return false;

if (pi.FriendsID == 0 && !pi.FakePlayer)
return false;

if (!SteamAPI.IsSteamRunning())
return false;

if (SteamIDUniverse == EUniverse.k_EUniverseInvalid)
SteamIDUniverse = SteamUtils.GetConnectedUniverse();

id.InstancedSet(new AccountID_t(pi.FriendsID), 1, SteamIDUniverse, pi.FakePlayer ? EAccountType.k_EAccountTypeAnonGameServer : EAccountType.k_EAccountTypeIndividual);
return true;
}
public int GetUserID() {
if (!engine.GetPlayerInfo(EntIndex(), out PlayerInfo pi))
Expand Down
2 changes: 1 addition & 1 deletion Game.Shared/GarrysMod/LuaPlayer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ static int Player__SteamID64(ILuaInterface lua) {
static int Player__AccountID(ILuaInterface lua) {
BasePlayer player = Get_Player(1, false)!;
if (!player.GetSteamID(out Steamworks.CSteamID steamID)) {
lua.PushNumber(0);
lua.PushNumber(-1);
return 1;
}
lua.PushNumber(steamID.GetAccountID().m_AccountID);
Expand Down
2 changes: 1 addition & 1 deletion Source.Engine/Server/BaseServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1255,7 +1255,7 @@ protected virtual int GetChallengeType(NetAddress adr) {
return Protocol.PROTOCOL_HASHEDCDKEY;

#if !SWDS
if (Host.IsSinglePlayerGame() || !IsDedicated())
if (Host.IsSinglePlayerGame() || (Steam3Client().SteamUser() == null && !IsDedicated()))
return Protocol.PROTOCOL_HASHEDCDKEY;
else
#endif
Expand Down
Loading