TentaRJ / GameJolt-FNF-Integration

Add trophies, track player's play time and sessions, and connect to GameJolt with this project!

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How I Do The LeaderBoard thing

JustJasonLol opened this issue · comments

Just Asking, I Need To Know

commented

Make sure that your GameJoltAPI.leaderboardToggle flag is set to true and then use addScore(score, tableID, ?extraData).

Your tableID is the ID of the table you wanna send data to.

    /**
     * Add a score to a table!
     * @param score Score of the song. **Can only be an int value!**
     * @param tableID ID of the table you want to add the score to!
     * @param extraData (Optional) You could put accuracy or any other details here!
     */
    public static function addScore(score:Int, tableID:Int, ?extraData:String)
    {
        if (GameJoltAPI.leaderboardToggle)
        {
            trace("Trying to add a score");
            var formData:String = extraData.split(" ").join("%20");
            GJApi.addScore(score+"%20Points", score, tableID, false, null, formData, function(data:Map<String, String>){
                trace("Score submitted with a result of: " + data.get("success"));
                Main.gjToastManager.createToast(GameJoltInfo.imagePath, "Score submitted!", "Score: " + score + "\nExtra Data: "+extraData, true);
            });
        }
        else
        {
            Main.gjToastManager.createToast(GameJoltInfo.imagePath, "Score not submitted!", "Score: " + score + "Extra Data: " +extraData+"\nScore was not submitted due to score submitting being disabled!", true);
        }
    }

Thanks, it worked :D

commented

Thanks, it worked :D

👍