PcoWSkbVqDnWTu_dm2ix
Collapse Sidebar

GetPolicyInfoForPlayerAsync

Returns policy information about a player which is based on geolocation, age group, and platform. The structure of the returned dictionary is as follows:

Name Type Description
ArePaidRandomItemsRestricted Boolean Whether the player can interact with paid random item generators.
IsSubjectToChinaPolicies Boolean See here for details.
AllowedExternalLinkReferences Array of strings Which external link references are allowed in a country/region.

Exceptions

Like any async call, this needs to be wrapped in a pcall and error-handled properly. A full list of possible error messages and their reasons is as below:

Message Reason
GetPolicyInfoForPlayerAsync not enabled Client setting - API not enabled
Instance was not a player Dev's usage - The parameter is not a Player instance
GetPolicyInfoForPlayerAsync currently only available from server Client setting - API not enabled on Client
Players not foundInternal error - Players object missing
This method cannot be called on the client for a non-local player Dev's usage - This method cannot be called on the client for a non-local player
GetPolicyInfoForPlayerAsync is called too many times Internal error - GetPolicyInfoForPlayerAsync is called more than 100(current setting) times before http response coming back
API service not found Internal error - API service object missing
Empty parameter value Internal error - Can't find ip address of user agent string for this player
Http request failed to get policy info Web API error - Http request failure
Failed to parse response Web API error - Http response error

See also

  • LocalizationService/GetCountryRegionForPlayerAsync, returns country/region code string according to player’s client IP geolocation

Parameters

Name Type Default Description

The Player that you are getting policy information for

Returns

Return Type Summary

A dictionary containing information about the policy information of a given player


Code Samples


Getting Policy Information for a Player

This code sample gets policy information for the local player and warns if they cannot interact with paid random item generators.