Ban Accounts #

This guide covers how to ban an account, view ban history, and revoke bans.

Create ban reason #

  1. Update the ExtBanReason to have a custom enum value (EXT_BAN_REASON_DEMO):
AccountRpcExt.proto
enum ExtBanReason {
  option (unreal_enum_name) = "ExtBanReason";
  EXT_BAN_REASON_UNSPECIFIED = 0;  // do not use; this exists to support default value
  reserved 1 to 100; // Pragma supported Ban Reasons

  //  === EXTENSIONS (101+) === // Add your custom reasons here
  EXT_BAN_REASON_DEMO = 101;
}
  1. Run the following command to build the protos: ./pragma build project-protos.

Ban an account #

SDK #

Ban an account from all game servers:

Server->Session()->BansApi().BanAccountFromGameShard(
  SocialId, 
  AllGameShards,
  DurationInMillis, 
  BanReason,
  Comment,
  Delegate
);
server.BansApi.BanAccountFromGameShard(
  socialId, 
  allGameShards, 
  durationInMillis,
  comment,
  banReason,
  completeDelegate
);

To ban an account from a specific game server set allGameShards to false. This restricts the account only from the current game they’re connected to.

Ban an account from all social and game servers:

Server->Session()->BansApi().BanAccount(
  SocialId, 
  DurationInMillis, 
  BanReason,
  Comment,
  Delegate
);
server.BansApi.BanAccount(
  socialId, 
  durationInMillis,
  comment,
  banReason,
  completeDelegate
);

Social Operator Portal #

From a specific account’s page, navigate to the Account Bans tab to add bans.

Handle ban notifications #

Once an account has been issued a ban, the currently connected player will receive a notification. The content of this message can be found in AccountRpc.BanV1Notification.

The player game client can receive ban notifications through the SDK. Here, you can implement custom behavior to manage how the ban is handled.

Player->Session()->BansApi().OnAccountBanned.AddLambda(
    [this](const FPragmaBan& Ban) {
        // handle ban event
    });
player.BansApi.OnAccountBanned += ban =>
{
    // handle ban event
};

Show a player their ban reason and duration on login #

When an account with active bans attempts to authenticate, the authenticateorcreate endpoint will respond with an AccountApplicationError which contains a list of associated active bans. You can use the list of associated active bans to customize what ban information (duration, reason) is shown to the player.

Revoke a ban #

Navigate to the Account Bans tab. Hover over the ban you’d like to remove and click Revoke.