Global Leaderboards Documentation
Encrypted and Secure
All user details are encrypted and securely stored.
How to add a leaderboard to your game
Below is the easiest way to set up logins and registrations for your application
- Register for your FREE account to create your unique user identifier..
- Create a leaderboard to create your unique identifier
Sending Your Score
dataSource = "leaderboardString=" + string(UNIQUE-LEADERBOARD-STRING) + "&ownerString=" + string(UNIQUE-USER-STRING) + "&playerName=" + string(PLAYER-NAME) + "&playerScore=" + PLAYER-SCORE";
submitScore = http_post_string("https://www.gmdb.co.uk/data/insertScore.php", dataSource);
submitScore = http_post_string("https://www.gmdb.co.uk/data/insertScore.php", dataSource);
Recieving Scores
leaderboardData = "leaderboardString=" + string(UNIQUE-LEADERBOARD-STRING) + "&ownerString=" + string(UNIQUE-USER-STRING)";
getLeaderboard = http_post_string("https://www.gmdb.co.uk/data/get_leaderboard.php", leaderboardData);
getLeaderboard = http_post_string("https://www.gmdb.co.uk/data/get_leaderboard.php", leaderboardData);
Async Result
if (ds_map_find_value(async_load, "id") == getLeaderboard)
{
if (ds_map_find_value(async_load, "status") == 0)
{
getResult = ds_map_find_value(async_load, "result");
getResultDecoded = json_decode(getResult);
var getAllData = ds_map_find_value(getResultDecoded, "default");
var leaderboardMapSize = ds_list_size(getAllData);
for (var i = 0; i < leaderboardMapSize; i++)
{
leaderboardData = ds_list_find_value(getAllData, i);
global.leaderboardPlayerName[i] = string(ds_map_find_value(leaderboardData, "playerName")); //SAVES PLAY NAME INTO ARRAY
global.leaderboardPlayerScore[i] = string(ds_map_find_value(leaderboardData, "playerScore")); // SAVES PLAYER SCORE INTO ARRAY
//EXTRA VARIABLES
global.leaderboardScoreSubmittedDate[i] = string(ds_map_find_value(leaderboardData, "scoreDate")); // SAVES THE DATE THE SCORE WAS SUBMITTED INTO AN ARRAY AS TIMESTAMP
}
}
}
{
if (ds_map_find_value(async_load, "status") == 0)
{
getResult = ds_map_find_value(async_load, "result");
getResultDecoded = json_decode(getResult);
var getAllData = ds_map_find_value(getResultDecoded, "default");
var leaderboardMapSize = ds_list_size(getAllData);
for (var i = 0; i < leaderboardMapSize; i++)
{
leaderboardData = ds_list_find_value(getAllData, i);
global.leaderboardPlayerName[i] = string(ds_map_find_value(leaderboardData, "playerName")); //SAVES PLAY NAME INTO ARRAY
global.leaderboardPlayerScore[i] = string(ds_map_find_value(leaderboardData, "playerScore")); // SAVES PLAYER SCORE INTO ARRAY
//EXTRA VARIABLES
global.leaderboardScoreSubmittedDate[i] = string(ds_map_find_value(leaderboardData, "scoreDate")); // SAVES THE DATE THE SCORE WAS SUBMITTED INTO AN ARRAY AS TIMESTAMP
}
}
}