Namespace: Steamworks

Lua
C++
Edit

GetUserId

This function gets the user's Steam profile ID.

Syntax

Returns

Returns the user ID.

#include "UltraEngine.h"
#include "Steamworks/Steamworks.h"

using namespace UltraEngine;

int main(int argc, const char* argv[])
{
    if (not Steamworks::Initialize())
    {
        RuntimeError("Steamworks failed to initialize.");
        return 1;
    }

    //Get app ID
    auto appid = Steamworks::GetAppId();
    Print("App ID: " + String(appid));

    //Get build ID
    auto buildid = Steamworks::GetBuildId();
    Print("Build ID: " + String(buildid));

    //Confirm app installed
    bool installed = Steamworks::AppInstalled(appid);
    Print("App installed: " + String(installed));

    //Confirm app owned
    bool owned = Steamworks::AppSubscribed(appid);
    Print("App subscribed: " + String(owned));

    //Get user ID
    auto id = Steamworks::GetUserId();
    Print("User ID: " + String(id));

    //Get user name
    Print("User name: " + Steamworks::GetUserName(id));

    //Get user avatar
    auto pixmap = Steamworks::GetUserAvatar(id);
    if (pixmap)
    {
        pixmap->Save("avatar.dds");
        RunFile("avatar.dds");
    }

    Steamworks::Shutdown();
    return 0;
}
Copyright © 2006-2025 Leadwerks Software.
All rights reserved.
Leadwerks 4 Documentation