public static bool AddCredits(long playerId, long creditsToAdd, bool addToFaction = true)
        {
            // Session should be active to continue.
            if (MySession.Static == null)
            {
                return(false);
            }

            // Get player.
            var player = PlayerUtils.GetPlayer(playerId);

            if (player == null)
            {
                return(false);
            }

            // Try to add to the faction first the player has one.
            if (addToFaction)
            {
                var faction = FactionUtils.GetFaction(playerId);
                if (faction != null)
                {
                    faction.RequestChangeBalance(creditsToAdd);
                    return(true);
                }
            }

            player.RequestChangeBalance(creditsToAdd);
            return(true);
        }
        public static long GetFactionBalance(string factionTag)
        {
            long balance = 0;
            var  faction = FactionUtils.GetFaction(factionTag);

            if (faction != null)
            {
                faction.TryGetBalanceInfo(out balance);
            }
            return(balance);
        }
 public static long GetFactionBalance(long factionId)
 {
     return(GetFactionBalance(FactionUtils.GetFaction(factionId)));
 }