Amnesty.RageMp
1.0.3
dotnet add package Amnesty.RageMp --version 1.0.3
NuGet\Install-Package Amnesty.RageMp -Version 1.0.3
<PackageReference Include="Amnesty.RageMp" Version="1.0.3" />
<PackageVersion Include="Amnesty.RageMp" Version="1.0.3" />
<PackageReference Include="Amnesty.RageMp" />
paket add Amnesty.RageMp --version 1.0.3
#r "nuget: Amnesty.RageMp, 1.0.3"
#:package Amnesty.RageMp@1.0.3
#addin nuget:?package=Amnesty.RageMp&version=1.0.3
#tool nuget:?package=Amnesty.RageMp&version=1.0.3
Amnesty.RageMp
Official C# SDK for Amnesty — collect and audit game events from your multiplayer server.
Overview
The SDK sends events to the Amnesty collector in the background — fire-and-forget, non-blocking. It handles authentication, queuing, and retries automatically so your game logic is never affected.
Two modes are available:
| Templates mode | Raw mode | |
|---|---|---|
| Setup | Manual Track() calls at key points |
One option: AutoTrack = true |
| Statuses | Start / Success / Fail | — |
| Message templates | Yes | No (raw data) |
| Best for | Developers + game designers | Rapid exploration, debugging |
Requirements
- .NET Core 3.1 or .NET 8.0
- A running Amnesty instance
- A service account with access to your project (created in the web panel under Users)
Installation
dotnet add package Amnesty.RageMp
Quick Start
Templates mode
Call Configure() once at server startup, then call Track*() at key points in your code.
using Amnesty.RageMp;
// In your resource constructor (after RAGE:MP assemblies are loaded)
Amnesty.Configure(new AmnestyOptions
{
ApiUrl = "https://amnesty.example.com",
ProjectId = "gta5-ragemp-roleplay",
Username = "gameserver",
Password = "secret",
});
// Single-step event
Amnesty.TrackSuccess("player_login",
playerId: player.SocialClubName,
appName: "server",
payload: new Dictionary<string, object>
{
["playerName"] = player.Name,
["ip"] = player.Address,
});
// Multi-step operation (Start → Success / Fail)
var trace = Amnesty.NewTraceId();
Amnesty.TrackStart("vehicle_purchase", trace,
playerId: player.SocialClubName, appName: "server");
if (success)
Amnesty.TrackSuccess("vehicle_purchase", trace,
playerId: player.SocialClubName, appName: "server",
payload: new Dictionary<string, object> { ["model"] = carModel, ["price"] = price });
else
Amnesty.TrackFail("vehicle_purchase", trace,
playerId: player.SocialClubName, appName: "server",
payload: new Dictionary<string, object> { ["reason"] = "insufficient_funds" });
Raw mode
Set AutoTrack = true — the SDK intercepts every TriggerClientEvent call via Harmony and forwards it to the collector automatically. No templates or manual Track() calls needed.
using Amnesty.RageMp;
Amnesty.Configure(new AmnestyOptions
{
ApiUrl = "https://amnesty.example.com",
ProjectId = "gta5-ragemp-roleplay",
Username = "gameserver",
Password = "secret",
AutoTrack = true,
});
Using gRPC transport
By default, the SDK uses HTTP REST. For high-RPS servers, switch to gRPC for lower latency and binary encoding:
using Amnesty.RageMp;
Amnesty.Configure(new AmnestyOptions
{
ApiUrl = "https://amnesty.example.com",
ProjectId = "gta5-ragemp-roleplay",
Username = "gameserver",
Password = "secret",
Transport = TransportMode.Grpc,
GrpcUrl = "https://amnesty.example.com:9090",
});
On .NET Core 3.1 with an
http://(plaintext) gRPC endpoint, set the following before callingConfigure():AppContext.SetSwitch("System.Net.Http.SocketsHttpHandler.Http2UnencryptedSupport", true);The SDK sets this automatically when it detects
http://on .NET Core 3.1.
Configuration reference
| Option | Type | Default | Description |
|---|---|---|---|
ApiUrl |
string |
required | Base URL of the collector (e.g. https://amnesty.example.com) |
ProjectId |
string |
required | Project ID from the web panel |
Username |
string |
required | Service account username |
Password |
string |
required | Service account password |
Transport |
TransportMode |
Http |
Http or Grpc |
GrpcUrl |
string |
"" |
gRPC endpoint — required when Transport = Grpc |
AutoTrack |
bool |
false |
Enable Raw mode (Harmony auto-intercept) |
TrackUpdateEvent |
bool |
false |
Forward the Update system tick event (Raw mode only) |
Debug |
bool |
false |
Print diagnostic messages to stdout (patched method count, throttle stats). Errors are always printed regardless of this setting |
MaxQueueSize |
int |
2000 |
Max events held in the in-memory queue; oldest are dropped when full |
WorkerIntervalMs |
int |
200 |
How often the background worker flushes the queue (ms) |
BatchSize |
int |
5 |
Events sent per worker iteration (HTTP) / streamed per batch (gRPC) |
API reference
Amnesty.Configure(options)
Initialises the SDK. Call once at server startup, inside your resource constructor (not in a static initializer — RAGE:MP assemblies must be loaded first).
Amnesty.Track(templateName, status, ...)
Enqueues an event. Never throws. Never blocks.
| Parameter | Type | Description |
|---|---|---|
templateName |
string |
Template name defined in the web panel |
status |
EventStatus |
Start, Success, or Fail |
traceId |
string? |
Links related Start/Success/Fail events |
playerId |
string? |
Player's SocialClub name or Steam ID |
appName |
string? |
Event source label, e.g. "server" or "client" |
payload |
Dictionary<string, object>? |
Template variables |
Shortcuts
Amnesty.TrackStart(templateName, traceId?, playerId?, appName?, payload?)
Amnesty.TrackSuccess(templateName, traceId?, playerId?, appName?, payload?)
Amnesty.TrackFail(templateName, traceId?, playerId?, appName?, payload?)
Amnesty.NewTraceId() // returns a UUID string
Integration example (standard RAGE:MP resource)
// dotnet/resources/YourResource/Main.cs
using Amnesty.RageMp;
public class Main : Script
{
public Main()
{
Amnesty.Configure(new AmnestyOptions
{
ApiUrl = Environment.GetEnvironmentVariable("AMNESTY_API_URL") ?? "http://localhost:3000",
ProjectId = Environment.GetEnvironmentVariable("AMNESTY_PROJECT_ID") ?? "my-server",
Username = Environment.GetEnvironmentVariable("AMNESTY_USERNAME") ?? "gameserver",
Password = Environment.GetEnvironmentVariable("AMNESTY_PASSWORD") ?? "secret",
AutoTrack = true,
});
}
}
Store credentials in a .env file or environment variables — never hardcode them in source.
License
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp3.1 is compatible. |
-
.NETCoreApp 3.1
- Google.Protobuf (>= 3.27.2)
- Grpc.Net.Client (>= 2.62.0)
- lib.harmony (>= 2.2.2)
- System.Text.Json (>= 4.7.2)
-
net8.0
- Google.Protobuf (>= 3.27.2)
- Grpc.Net.Client (>= 2.62.0)
- lib.harmony (>= 2.3.3)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.