I have to end the challenge when one of two players disconnects.
I'm trying to catch this event in GS_PLAYER_DISCONNECT script, but it seems that this script gets called for both players. And i'm not sure which player trigger disconnection.
I need to know this, since other player should win the challenge.
Thanks in advance.
Best Answer
C
Customer Support
said
about 5 years ago
Hi,
Can you clarify this a little ? GS_PLAYER_DISCONNECT should only run if a single player disconnects. This script has player context so you should be able to use "var playerID = Spark.getPlayer().getPlayerId();" to identify the player and then find the challenge they were in and set the other player as the winner or remove the disconnected player from the challenge.
Can you clarify this a little ? GS_PLAYER_DISCONNECT should only run if a single player disconnects. This script has player context so you should be able to use "var playerID = Spark.getPlayer().getPlayerId();" to identify the player and then find the challenge they were in and set the other player as the winner or remove the disconnected player from the challenge.
Thanks,
Liam
1 person likes this
P
Percy J Legendre IV
said
almost 5 years ago
How do you find the challenge they were in using their player id?
Old Scheme
A little help is needed here.
I have to end the challenge when one of two players disconnects.
I'm trying to catch this event in GS_PLAYER_DISCONNECT script, but it seems that this script gets called for both players. And i'm not sure which player trigger disconnection.
I need to know this, since other player should win the challenge.
Thanks in advance.
Hi,
Can you clarify this a little ? GS_PLAYER_DISCONNECT should only run if a single player disconnects. This script has player context so you should be able to use "var playerID = Spark.getPlayer().getPlayerId();" to identify the player and then find the challenge they were in and set the other player as the winner or remove the disconnected player from the challenge.
Thanks,
Liam
- Oldest First
- Popular
- Newest First
Sorted by Oldest FirstCustomer Support
Hi,
Can you clarify this a little ? GS_PLAYER_DISCONNECT should only run if a single player disconnects. This script has player context so you should be able to use "var playerID = Spark.getPlayer().getPlayerId();" to identify the player and then find the challenge they were in and set the other player as the winner or remove the disconnected player from the challenge.
Thanks,
Liam
1 person likes this
Percy J Legendre IV
How do you find the challenge they were in using their player id?
-
Documentation Notes
-
Design issues with user events
-
Using NoSQL
-
Runtime Collections vs Metadata Collections
-
Anonymous authentication from browser app
-
Modules
-
Movement With Unity
-
Problem with url parameters for downloadables
-
Querying NoSql GameSparks database
-
Challenge accesType
See all 2487 topics