Skip to main content

Account Module

Session::Account() answers questions about the account the local player is logged in with. Plugins initialize after the login screen, so the data is generally available for the whole session. It goes away only when the user logs out, for instance, by going back to the title screen to switch servers; the getters then return empty until the next login.

Unlike the Player module, the account getters need no server connection: they describe the account, not an in-world entity.

Getters

GetterReturnsNotes
GetAccountID()Uint64TruckersMP account ID. Stable across sessions.
GetCompanyID()Uint64ID of the virtual company the player is a part of.
IsPatron()BoolHas a Patreon tier that qualifies for in-game rewards.
IsGameModerator()BoolGame moderator.
IsTeamMember()BoolTruckersMP team member.
if( const std::optional< TruckersMP::Uint64 > id = g_session->Account().GetAccountID() )
{
LoadMySettingsFor( *id );
}

Match GetAccountID() against the Web API (GET /player/{id}) to fetch the public profile, and GetCompanyID() against the virtual company endpoints.