question

doronhn avatar image
doronhn asked

Cant remove all players for title

Hey,

just trying to delete all my players for a title.

i saw some old posts that the best way if from cloud script using scheduled tasks.

well, this is the cloud script i runing:

what do i do wrong?

handlers.DeleteUserByID = function (args, context) 
{
  var request = {
  				 PlayFabId: currentPlayerId,
    			 "TitleId": "D668"
                  };
  
    server.DeleteUsers(request);
}
CloudScriptscheduled tasks
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.

doronhn avatar image doronhn commented ·

any update on this isssue?

0 Likes 0 ·

1 Answer

·
Andy avatar image
Andy answered

On the API Features tab under Settings, you need to select "Allow server to delete player accounts" in order for that API to function from Cloud Script.

20 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.

doronhn avatar image doronhn commented ·

i did, but its not working....

0 Likes 0 ·
brendan avatar image brendan ♦♦ doronhn commented ·

The DeleteUsers call takes a PlayFabIds parameter, which is an array of PlayFab IDs of users. If you can update your test to use the format shown in the example here (https://api.playfab.com/documentation/Server/method/DeleteUsers), you should be able to get this to work without issues.

0 Likes 0 ·
doronhn avatar image doronhn brendan ♦♦ commented ·

ok...

but how do i get a list of all the player ids? on cloud script?

0 Likes 0 ·
Show more comments
Show more comments
doronhn avatar image doronhn commented ·

Done. Not working.

I tried to edit the "Scheduled Task", and instead of pick "Execute cloud script" under action i select delete player.

then i run the scheduled task and it work. (its delete all the players buy not the player number (i see 63 players when i have none).

but still it dosent explaine why the cloud script didnt manage to delete all players.

0 Likes 0 ·
brendan avatar image brendan ♦♦ doronhn commented ·

I just put that code (above) into my own project and changed the Title ID to my own. Running it on a player works fine. Can you test that this works for you, as well?

0 Likes 0 ·
doronhn avatar image doronhn brendan ♦♦ commented ·

this code?:

handlers.DeleteUserByID = function (args, context) 
{
  var request = {
                   "PlayFabIds": [currentPlayerId],
                 "TitleId": "D668"
                  };
  
    server.DeleteUsers(request);
}
0 Likes 0 ·
Show more comments

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.