question

rupert avatar image
rupert asked

Get FriendsList from CloudScript

We're looking to get the friends list of the user we're adding in our sendFriendRequest function within CloudScript.

This is so that we can check the count of this list against our maxFriends variable we're passing through client side, that limits the amount of player and ensures no players can go over the limit of friends we set.

Is this possible?

CloudScriptFriends
1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

rupert avatar image rupert commented ·

I should add - we want to handle this through CloudScript to limit the amount of API calls we need to do for each request. Handling it all within CloudScript seems the most efficient way to handle things

0 Likes 0 ·
Hernando avatar image
Hernando answered

Sure, you can retrieve the current friends list for the user with Server/GetFriendsList API from CloudScript.

2 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

rupert avatar image rupert commented ·

Thanks. However, there's not much info we can find on handling multiple functions from within CloudScript. Could you give us some pointers? We just want to get a list of friends a user has, count them, and then only proceed if they are below a value.

I have this function working, but it returns a JSON to the client. This means potentially two API calls too if it passes.

Ideally we would like, in our addFriends function, to check the list of friends for args.friendID and then continue from there, instead of handling anything client side.

Thanks for the help!

0 Likes 0 ·
rupert avatar image rupert rupert commented ·

*update*

GetFriendsList returns nothing for another players friends list. But it works if we want to check our own?

0 Likes 0 ·
rupert avatar image
rupert answered

Got it working using above method.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.