Hi I am currently working on my 2D MMO Game so I would like to set my Player Statistic through Cloudscript to prevent exploiting or cheating from clients, but I don't know if I am doing the right way of updating the player statistic.
in my Revision, this is the code that I write for setting up the player statistic
handlers.UserRegister = function(args) { var updateStatistics = server.UpdatePlayerStatistics({ PlayFabId: currentPlayerId, Statistics: [{ StatisticName: "Health", Value: 100 }, { StatisticName: "MP", Value: 0 }, { StatisticName: "Level", Value: 1 }, { StatisticName: "Exp", Value: 0 }, { StatisticName: "SkillPoints", Value: 0 }, { StatisticName: "WalkSpeed", Value: 5 }, { StatisticName: "JumpForce", Value: 10 }, { StatisticName: "ExtraJumps", Value: 1 }, { StatisticName: "Defence", Value: 0 }, { StatisticName: "FinalOutput", Value: 0 }] }); }
and in my runtime script, I use ExecuteCloudScript to call the UpdatePlayerStatistic
public void UpdateUserStatisticSS() { var request = new ExecuteCloudScriptRequest { FunctionName = "UserRegister", GeneratePlayStreamEvent = true, }; PlayFabClientAPI.ExecuteCloudScript(request, null, null); }
then It's work well but it didn't set as a JSON on PlayStream Monitor
and I don't have an idea to get the player statistic so what I'm talking about is if the player successful has the statistic that I set on cloudscript and i want to get it for example i have Statistic [{ StatisticName: "WalkSpeed", Value: 5 }] I want to get the value of the walk speed and set it as a player walk speed on client and if the Player WalkSpeed was changed or let's say the player upgrade is walkspeed it will update the existing WalkSpeed Statistic Value