C++ ScoreController::SetScores()
From J2Play
Orkut > Flash Challenge.getDisplayMessage() > Flash Access Player Profile > C++ ScoreController::SetScores()
Contents |
Description
Submits the score record to server
Syntax
bool ScoreController::SetScores(
const char* scoretype,
bool ascending,
int numtostore,
const char* username,
const char* usermessage,
long long* values,
unsigned int count
);
Parameters
* @param scoretype, the type name of score
* @param ascending, the order of score sorted
* @param numtostore, the count of score records will be store on server.
A value of 0 or less indicates that this score type is cumulative causing this score to be added to the current value.
A value greater than 0 will cause that many of the best scores to be stored and will drop extras
* @param username, the user whose score is being submitted; if empty string, current user's username is used
* @param usermessage, the message stored with score record
* @param values, a 64 bits integer array of score values
* @param count, the count of score values in the values array
Return Value
@return true if score has been submitted to score server successfully, otherwise false
Examples
Here is the example to store an accumulative score to server. When you lose 2000 points in a gambling game,
long long score = -2000;
ScoreController scorecon = CGDKInstance::GetInstance()->GetScoreController();
if (scorecon && scorecon->SetScores(J2PLAY_DEFAULT_LEADER_BOARD_SCORE_TYPE, false, 0, "", "", &score, 1))
{
// submit score successfully
}
else
{
// error
}
