Announcement

Collapse
No announcement yet.

How to get player steam id?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    #31
    Here is a video on how to get the Steam Player ID via blueprints if that helps.

    Comment


      #32
      CSteamID from Player State

      Dear Everyone,

      If what you want is specifically the CSteamID here is how you can get it from just the Player State ptr as an input!

      Code:
      if(PlayerState)
      {
          CSteamID TheSteamifiedPlayerID(*(uint64*)PlayerState->UniqueId->GetBytes());
      }
      Probably will need these includes:

      Code:
      #include "steam/steam_api.h"
      #include "steam/isteamuser.h"
      #include "steam/isteamutils.h"
      So what this code lets you do is, given any PlayerState, retrieve the already replicated UniqueID and convert Steam Platform-specific ID

      Enjooooy!



      Rama
      UE4 Marketplace: Melee Weapon Plugin & Compressed Binary Save System Plugin | Rama's C++ AI Jumping Videos | Vertex Snap Editor Plugin

      ♥ Rama

      Comment


        #33
        not fully understand how I can get these includes wich rama was defined (instead i use Steam OSS)
        so.. i tried to convert, but my code not works correctly(incorrect convertion)
        Code:
            TSharedPtr<const FUniqueNetId> pid = ion->GetIdentityInterface()->GetUniquePlayerId(PlayerControllerId);
        
            if (pid->IsValid())
            {
                //variables
                FString gz_pid = pid->ToString();
                uint64 iSteamId = FCString::Atoi(*gz_pid);
                FString gz_SteamId = "STEAM_"; // STEAM_X:Y:Z
        
                // convertion
                uint8 universe = (iSteamId >> 56) & 0xFF;
        
                if (universe == 1)
                {
                    universe = 0;
                }
        
                gz_SteamId += FString::FromInt(universe) + ":";
        
                uint8 accountIdLowBit = (iSteamId & 1) & 0xFF;
                gz_SteamId += FString::FromInt(accountIdLowBit) + ":";
        
                uint32 accountIdHighBits = (iSteamId >> 1) & 0x7FFFFFF;
                gz_SteamId += FString::FromInt(accountIdHighBits);
        
                //result
                return gz_SteamId;
            }
        Last edited by KGB1st; 11-18-2019, 09:43 AM.
        ue excellent but made by humans..

        Comment

        Working...
        X