sanctions - YoYoGames/GMEXT-EpicOnlineServices GitHub Wiki

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

eos_sanctions_copy_player_sanction_by_index

Epic Online Services Function: EOS_Sanctions_CopyPlayerSanctionByIndex

This function copies an active player sanction.

Note

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


Syntax:

eos_sanctions_copy_player_sanction_by_index(user_id_target, index)
Argument Type Description
user_id_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 = eos_sanctions_get_player_sanction_count(user_id_target);
for(var i = 0 ; i < _count ; i++)
{
    eos_sanctions_copy_player_sanction_by_index(user_id_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

eos_sanctions_get_player_sanction_count

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 eos_sanctions_query_active_player_sanctions to store values in cache.


Syntax:

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



Returns:

Real


Example:

var _count = eos_sanctions_get_player_sanction_count(user_id_target);
for(var i = 0 ; i < _count ; i++)
{
    var _struct = eos_sanctions_copy_player_sanction_by_index(user_id_target, i);
    var _action = _struct.action;
}

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




Back To Top

eos_sanctions_query_active_player_sanctions

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 EOS_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:

eos_sanctions_query_active_player_sanctions(user_id, user_id_target)
Argument Type Description
user_id String The Product User ID of the local user who initiated this request. Dedicated servers should set this to an empty string.
user_id_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 "eos_sanctions_query_active_player_sanctions"
status EOS_RESULT The status code for the operation. EOS_RESULT.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 = eos_sanctions_query_active_player_sanctions();

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

if (async_load[? "type"] == "eos_sanctions_query_active_player_sanctions")
if (async_load[? "identifier"] == identifier)
{
    if (async_load[? "status"] == EOS_RESULT.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
reference_id String A unique identifier for this specific sanction
time_expires Real The POSIX timestamp when the sanction will expire. If the sanction is permanent, this will be 0
time_placed Real The POSIX timestamp when the sanction was placed

⚠️ **GitHub.com Fallback** ⚠️