Hey!
I have to know how to get player inventory through Cloud Script, I mean that other player would run this Cloud Script and the second player inventory would be updated and he would see that on his device like this method:
public void GetInventoryItemTime(string id) { var request = new PlayFab.ServerModels.GetUserInventoryRequest { PlayFabId = id, }; PlayFabServerAPI.GetUserInventory(request, OnGetInventoryItemTime, OnError); }
but called by other player through Cloud Script.
I made something like this:
C# (Unity):
public void OnRewardRevokedSuccess(PlayFab.AdminModels.RevokeInventoryResult result) { Debug.Log("Revoked Success"); var request = new ExecuteCloudScriptRequest { FunctionName = "removeItem", FunctionParameter = new { playerID = whatID } }; PlayFabClientAPI.ExecuteCloudScript(request, OnExecuteSuccess, OnExecuteError); }
public void OnExecuteSuccess(PlayFab.ClientModels.ExecuteCloudScriptResult result) { GameObject.Find("objects").GetComponent<objectsScript>().GetInventoryItemTime(result.FunctionResult.ToString()); }
-------------------------------
Cloud Script:
handlers.removeItem = function(args){ var playerID = args.playerID; return playerID; }
But it doesn't works, please help guys, thanks!