public static bool TryGetPlayerBalance(ulong steamID, out long balance) { try { //PlayerId Player = new MyPlayer.PlayerId(steamID); Hangar.Debug("SteamID: " + steamID); long IdentityID = MySession.Static.Players.TryGetIdentityId(steamID); Hangar.Debug("IdentityID: " + IdentityID); balance = MyBankingSystem.GetBalance(IdentityID); return(true); } catch (Exception e) { Hangar.Debug("Unkown keen player error!", e, Hangar.ErrorType.Fatal); balance = 0; return(false); } }
public static bool TryUpdatePlayerBalance(PlayerAccount Account) { try { long IdentityID = MySession.Static.Players.TryGetIdentityId(Account.SteamID); if (IdentityID == 0) { return(false); } if (Account.AccountAdjustment) { MyBankingSystem.ChangeBalance(IdentityID, Account.AccountBalance); return(true); } long OriginalBalance = MyBankingSystem.GetBalance(IdentityID); long BalanceAdjuster = Account.AccountBalance - OriginalBalance; if (BalanceAdjuster == 0) { return(true); } MyBankingSystem.ChangeBalance(IdentityID, BalanceAdjuster); Hangar.Debug("Player " + IdentityID + " account has been updated! "); return(true); } catch { return(false); } }