Sign In Register

How can we help you today?

Start a new topic
Answered

How to get player location in cloudcode

Hi there!

I'm trying to get the location of my player in the cloudcode but i'm not able to get it.

I don't see any method in SparkPlayer to get it.


Does anyone know how to do it?

Thank you


Best Answer

I don't know if this will work, but you can try to send a AccounDetails request in cloud code and store the response. Then you can access all the data from the response.

It should be something like this:


var response = Spark.sendRequest({"@class":".AccountDetailsRequest"});

var location = response.location;


Hope this works.


Answer

I don't know if this will work, but you can try to send a AccounDetails request in cloud code and store the response. Then you can access all the data from the response.

It should be something like this:


var response = Spark.sendRequest({"@class":".AccountDetailsRequest"});

var location = response.location;


Hope this works.

It works great! 


When I thought about doing it in that way, I dessestimate it because I thought that the request was going to be Async, but it seems like not


Thanks