Skip to content

Friends

Francisco Dias edited this page Jan 30, 2023 · 1 revision

Back To Top

Because playing with friends is even better and thrilling. List all user's friends and create an healthy competition environment to keep them all engaged.

Functions

The following function is provided for fetching friends:




Back To Top

This function queries an array of user_id represent the a user's friends (further information can be queried using the GameJolt_User_FetchWithUserID). This is an asynchronous function that will trigger either the callback_success method (if task is successful) or the callback_failed method (if task fails).


Syntax:

GameJolt_Friends([callback_success], [callback_failed])
Argument Type Description
callback_success function The callback function executed if the request succeeds (array of user_id is passed as argument) ✴️ OPTIONAL
callback_failed function The callback function executed if the request fails (error message is passed as argument) ✴️ OPTIONAL

Returns:

N/A

Example:

GameJolt_Friends(
    function(array)
    {
        // If the array has at least one entry
        if (array_length(array) > 1)
        {
            GameJolt_User_FetchWithUserID(array[0], function(data) {
                show_message_async(data);
            })
        }
    }
);

In the code sample above we perform an action to retrieve an array with the user_ids of all the logged user friends. We then provide a method that will fetch the user information for the first user id in the returned array (using the GameJolt_User_FetchWithUserID function), printing out the result when finished.




Clone this wiki locally