API ReferenceSandbox.Services

Statsclass

Allows access to stats for the current game. Stats are defined by the game's author and can be used to track anything from player actions to performance metrics. They are how you submit data to leaderboards.

object→Stats
Namespace
Sandbox.Services
Assembly
Sandbox.Engine
Declaration
public static abstract sealed class Sandbox.Services.Stats

Methods11

Showing 11 methods

public static void Flush()PUBLICSTATICINGEST

Send any pending stats to the backend. Don't wait for confirmation of ingestiom, fire and forget.

Returns:void—

public static System.Threading.Tasks.Task FlushAndWaitAsync(System.Threading.CancellationToken token = null)PUBLICSTATIC

Send any pending stats to the backend, will wait until they're available for query before finishing.

ParameterTypeDescription
token = nullCancellationToken—
Returns:Task—

public static System.Threading.Tasks.Task FlushAsync(System.Threading.CancellationToken token = null)PUBLICSTATICINGEST

Send any pending stats to the backend. Don't wait for confirmation of ingestiom, fire and forget.

ParameterTypeDescription
token = nullCancellationToken—
Returns:Task—

public static Sandbox.Services.Stats.GlobalStats GetGlobalStats(string packageIdent)PUBLICSTATIC

Get the global stats for this package

ParameterTypeDescription
packageIdentstring—
Returns:GlobalStats—

public static Sandbox.Services.Stats.PlayerStats GetLocalPlayerStats(string packageIdent)PUBLICSTATIC

Get the global stats for this package

ParameterTypeDescription
packageIdentstring—
Returns:PlayerStats—

public static Sandbox.Services.Stats.PlayerStats GetPlayerStats(string packageIdent, long steamid)PUBLICSTATIC

Get the stats for this package

ParameterTypeDescription
packageIdentstring—
steamidlong—
Returns:PlayerStats—

Properties2

Showing 2 properties

public static Sandbox.Services.Stats.PlayerStats Sandbox.Services.Stats.LocalPlayer { get; set; }PUBLICSTATICGETSET

Get the global stats for the calling package

Returns:PlayerStats—

On this page