public static void SetBalanceForUser(string uid, int value) { MySettings settings = Instance.Settings; CheckUserHasData(uid); value = Math.Max(0, Math.Min(settings.EcoHardBalanceLimit, value)); settings.UserBalances[uid] = value; settings.DelayedSave(); }
private static void CheckUserHasData(string uid) { MySettings settings = Instance.Settings; if (!settings.UserBalances.ContainsKey(uid)) { settings.UserBalances.Add(uid, 0); settings.DelayedSave(); } }