Skip to content

Sanctions

Francisco Dias edited this page Jun 20, 2024 · 4 revisions

Sanctions

Epic Online Services Interface: Sanctions Interface

The Sanctions Interface manages punitive actions taken against your users. Actions may include temporary or permanent bans from gameplay or communication bans that limit the social aspects of your product for a particular user. You define the disciplinary actions for your product to handle negative behaviour based on your use cases.

Functions

These functions are provided for handling sanctions:

Structs

These are the structs used by the Sanctions module:



Back To Top

EpicGames_Sanctions_CopyPlayerSanctionByIndex

Epic Online Services Function: EOS_Sanctions_CopyPlayerSanctionByIndex

This function copies an active player sanction.

Note

Requires a previous call to EpicGames_Sanctions_QueryActivePlayerSanctions to store values in cache.


Syntax:

EpicGames_Sanctions_CopyPlayerSanctionByIndex(UserID_target, index)
Argument Type Description
UserID_target String Product User ID of the user whose active sanctions are to be copied
index Real Index of the sanction to retrieve from the cache



Returns:

PlayerSanctionData


Example:

var _count = EpicGames_Sanctions_GetPlayerSanctionCount(UserID_target);
for(var i = 0 ; i < _count ; i++)
{
    EpicGames_Sanctions_CopyPlayerSanctionByIndex(UserID_target, i);
    var Action = struct.Action;
}

The above code shows an example of how the function should be used. The player sanction data is returned for the provided index.




Back To Top

EpicGames_Sanctions_GetPlayerSanctionCount

Epic Online Services Function: EOS_Sanctions_GetPlayerSanctionCount

This function fetches the number of player sanctions that have been retrieved for a given player.

Note

Requires a previous call to EpicGames_Sanctions_QueryActivePlayerSanctions to store values in cache.


Syntax:

EpicGames_Sanctions_GetPlayerSanctionCount(UserID_target)
Argument Type Description
UserID_target String Product User ID of the user whose sanction count should be returned



Returns:

Real


Example:

var _count = EpicGames_Sanctions_GetPlayerSanctionCount(UserID_target);
for(var i = 0 ; i < _count ; i++)
{
    var _struct = EpicGames_Sanctions_CopyPlayerSanctionByIndex(UserID_target, i);
    var _action = _struct.Action;
}

The above code shows an example of how the function should be used. After a successful call to EpicGames_Sanctions_QueryActivePlayerSanctions, the function EpicGames_Sanctions_GetPlayerSanctionCount will return the number of entries in the query array which can then be accessed using the EpicGames_Sanctions_CopyPlayerSanctionByIndex function.




Back To Top

EpicGames_Sanctions_QueryActivePlayerSanctions

Epic Online Services Function: EOS_Sanctions_QueryActivePlayerSanctions

This function starts an asynchronous query to retrieve any active sanctions for a specified user. Once the callback has been fired with a successful EpicGames_Result, it is possible to call one of the following functions:

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Social Async Event.


Syntax:

EpicGames_Sanctions_QueryActivePlayerSanctions(UserID, UserID_target)
Argument Type Description
UserID String The Product User ID of the local user who initiated this request. Dedicated servers should set this to null.
UserID_target String Product User ID of the user whose active sanctions are to be retrieved.



Returns:

Real


Triggers:

Social Async Event

Key Type Description
type String The string "EpicGames_Sanctions_QueryActivePlayerSanctions"
status EpicGames_Result The status code for the operation. EpicGames_Success indicates that the operation succeeded; other codes indicate errors
status_message String Text representation of the status code
identifier Real The asynchronous listener ID.

Example:

identifier = EpicGames_Sanctions_QueryActivePlayerSanctions();

The code sample above saves the identifier that can be used inside a Social Async Event.

if (async_load[? "type"] == "EpicGames_Sanctions_QueryActivePlayerSanctions")
if (async_load[? "identifier"] == identifier)
{
    if (async_load[? "status"] == EpicGames_Success)
    {
        show_debug_message(async_load[? "type"] + " succeeded!");
    }
    else
    {
         show_debug_message(async_load[? "type"] + " failed: " + async_load[? "status_message"]);
    }
}

The code above matches the response against the correct event type and logs the success of the task.




Back To Top

PlayerSanctionData

A struct holding the sanction data for a player

This struct is referenced by the following functions:


Member Type Description
Action String The action associated with this sanction
ReferenceId String A unique identifier for this specific sanction
TimeExpires Real The POSIX timestamp when the sanction will expire. If the sanction is permanent, this will be 0
TimePlaced Real The POSIX timestamp when the sanction was placed

Clone this wiki locally