Ban Accounts #
This guide covers how to ban an account, view ban history, and revoke bans.
Create ban reason #
- Update the
ExtBanReasonto have a custom enum value (EXT_BAN_REASON_DEMO):
- 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 setallGameShardstofalse. 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.