Hello, I'm searching in your documentation, and can't seem to find a way to get the player score from the database.
I can manage to get the top 10 user leaderboards with this in the Test Harness:
{ "@class": ".LeaderboardDataRequest", "leaderboardShortCode": "topScoreLeaderboard", "entryCount": "10", "requestId": "1406654736164" }
which would translate into this in unity:
GameSparksApi.leaderboardDataRequest("topScoreLeaderboard", 10).sendAsync(onResult);
How can I get the current players score and rank?
Thank you
You can either use
GetLeaderboardEntries
or
AroundMeLeaderboardDataRequest
G
There is a good example on getting the player scores using LeaderboardDataRequest here...https://support.gamesparks.net/support/discussions/topics/1000066784
The score is not a field supplied in LeaderboardDataResponse that you can access in code. You need to refer to JSONData in the response.
The link shows you code for this.
I answered cloud code for leaderboard
var Scoresplayer = Spark.getData().Score;
var Levelplayer=Spark.getData().Level;
var requestLB = new SparkRequest.SocialLeaderboardDataRequest();
var responseLB = requestLB.Send();
var requestData = new SparkRequest.LeaderboardDataRespnse();
var responseData = requestData.Send();
var ScoreData = responseData.Score;
var scriptDataLB = responseLB.scriptData;
var scriptDataDB = responseData.scriptData;
var SendPlayerLevel = requestLB.Send().Level;
var SendPlayerScore = requestLB.Send().Score;
var SendPlayermyData = requesLB.getPlayer().getPlayerId();
var requestmyData ={"SendPlayerLevel":SendPlayerLevel,"SendPlayerScore":SendPlayerScore,"SendPlayermyData":SendPlayermyData }; function RequestData(){
var LeadersData; responseLB.leaderboardShortCode("LB.Level"+i);
}
function setRequestData(){ var data = Spark.getData()["requesmyData"];
Spark.setScriptData("scriptData",requestmyData);
function getRequestData(){ var data =Spark.getData()["scriptData"]["requestmyData"]; return data;
Ricardo Magalhaes
Hello, I'm searching in your documentation, and can't seem to find a way to get the player score from the database.
I can manage to get the top 10 user leaderboards with this in the Test Harness:
which would translate into this in unity:
How can I get the current players score and rank?
Thank you
You can either use
GetLeaderboardEntries
or
AroundMeLeaderboardDataRequest
G
- Oldest First
- Popular
- Newest First
Sorted by Oldest FirstTech Support
You can either use
GetLeaderboardEntries
or
AroundMeLeaderboardDataRequest
G
Greg Quinn
There is a good example on getting the player scores using LeaderboardDataRequest here...
https://support.gamesparks.net/support/discussions/topics/1000066784
The score is not a field supplied in LeaderboardDataResponse that you can access in code. You need to refer to JSONData in the response.
The link shows you code for this.
Stefan Salvadore
I answered cloud code for leaderboard
var Scoresplayer = Spark.getData().Score;
var Levelplayer=Spark.getData().Level;
var requestLB = new SparkRequest.SocialLeaderboardDataRequest();
var responseLB = requestLB.Send();
var requestData = new SparkRequest.LeaderboardDataRespnse();
var responseData = requestData.Send();
var ScoreData = responseData.Score;
var scriptDataLB = responseLB.scriptData;
var scriptDataDB = responseData.scriptData;
var SendPlayerLevel = requestLB.Send().Level;
var SendPlayerScore = requestLB.Send().Score;
var SendPlayermyData = requesLB.getPlayer().getPlayerId();
var requestmyData ={"SendPlayerLevel":SendPlayerLevel,"SendPlayerScore":SendPlayerScore,"SendPlayermyData":SendPlayermyData }; function RequestData(){
var LeadersData; responseLB.leaderboardShortCode("LB.Level"+i);
}
function setRequestData(){ var data = Spark.getData()["requesmyData"];
Spark.setScriptData("scriptData",requestmyData);
}
function getRequestData(){ var data =Spark.getData()["scriptData"]["requestmyData"]; return data;
}
-
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