I'm trying to implement "delete account" option in my game as I believe it's required by GDPR. I have implemented the event (named deletePlayer) which deletes the player:
var player = Spark.getPlayer(); player.deletePlayer();
Let me describe the problem:
1. Let's say there are two users user1 and user2.
2. New challenge is started (RUNNING state) where one of those users is challenger and the second one is challenged.
3. Event deletePlayer is called to remove user1. The user is removed from the challenge and system correctly.
4. Now deletePlayer event is called to remove user2. The user isn't removed from the system. His account is blocked for a while. The script gives the error message like:
Index: 0, Size: 0 (event/deletePlayer.js#2)
Also I tested this for challenges with COMPLETED state. Next, I tried to call Spark.loadPlayer(playerId).deletePlayer(). Finally, I tested deleting code not in the event but as the GS_MINUTE script. The result and the error message was the same. It looks like the player cannot be deleted when it's the only principal assigned to the challenge.
Am I doing something wrong? Is there the workaround for it?
Thank you and regards,
There is a bug when using deletePlayer() while a player is in a challenge. It is something we will be addressing in a future update. If you manually remove the player from challenges you can delete the player without an issue.