Hello fellow devs,
guys I need help in getting the player name(like Bob, Andrew, Christopher) of the player in the leaderboard of my game. when I use loadScores, I only get the playerID( which is a string numbers), I tried to use loadPlayers and use alias, it doesn’t give me anything. I can successfully logged in in google play game services.
I use this chunk of codes to get those values.
local iPlayerID = nil; for i = 1, 10 do local function loadScoresFromLeaderboard(event) iPlayerID = event.data[i].playerID; local function locatePlayerName(event) local playerName = display.newText(group, i..". "..event.data[i].alias, 0, 0, native.systemFont, 14); playerName.x, playerName.y = bg.contentBounds.xMin+30+playerName.contentWidth\*.5, topSide+70+(i\*25); playerName:setFillColor(1, 1, 1); end local score = display.newText(group, event.data[i].value, 0, 0, native.systemFont, 14); score.x, score.y = bg.contentBounds.xMax-30-score.contentWidth\*.5, topSide+70+(i\*25); score:setFillColor(1, 1, 1); end gameNetwork.request("loadScores", { leaderboard = { category = "LEADERBOARD\_ID", playerScope = "Global", range = {1,10} }, listener = loadScoresFromLeaderboard }) gameNetwork.request( "loadPlayers", { playerIDs = { iPlayerID }, listener = locatePlayerName }) end
the idea here is to create a local leaderboard based off the google play leaderboard values. I googled 2 weeks now, trying everything, every detail I searched for, but still I couldn’t fine any solution to my problem.
thanks in advance.
Leo
3 months corona developer.