Rust Banking System

Discussion in 'Plugin Requests' started by tomhud, Nov 20, 2017.

  1. I searched,only Bank system on here was on for storing peoples stuff in a vault.
    Can anyone make a bank system that works with Economics and gives the player a % Interest or even withdrawal fee based on what will be set in the config file ?

    Maybe do a toplist of the high end earners in the bank as well.
    Im willing to chip in some money for this plugin if anyone else is willing.
     
  2. Calytic

    Calytic Community Admin Community Mod

    Code:
    using System;
    using System.Text;
    using UnityEngine;
    using Oxide.Core;
    using Oxide.Core.Plugins;namespace Oxide.Plugins
    {
        [Info("EconomicsInterest", "Calytic", "0.0.1")]
        class EconomicsInterest : RustPlugin
        {
            [PluginReference]
            Plugin Economics;        public void Loaded()
            {
                if (!plugins.Exists("Economics"))
                {
                    PrintWarning("Economics not found! EconomicsInterest disabled. Cannot use clanShare without this plugin. http://oxidemod.org/plugins/economics.717/");
                    return;
                }            Initialize();
            }        protected override void LoadDefaultConfig()
            {
                Config["VERSION"] = Version.ToString();            Config["AccumulateMinutes"] = 60;
                Config["InterestPercent"] = 1.5f;
            }        void Initialize()
            {
                float accumulateMinutes = (float)Config["AccumulateMinutes"];
                timer.Every(accumulateMinutes * 60, AccumulateInterest);
            }        void AccumulateInterest()
            {
                float interestPercent;            if(!float.TryParse(Config["InterestPercent"].ToString(), out interestPercent)) {
                    return;
                }
               
                foreach (var player in covalence.Players.All)
                {
                    double balance = Economics.Call<double>("Balance", player.Id);                if(balance > 0) {
                        var interest = Math.Round(balance * interestPercent / 100, 2);
                        Economics.Call("Deposit", player.Id, (double)interest);
                    }
                }
            }        [ChatCommand("eco_test_interest")]
            void cmdTestInterest(BasePlayer player, string command, string[] args)
            {
                if (!player.IsAdmin) return;
                AccumulateInterest();
            }
        }
    }
    
    Here is a small plugin to get you started. Will accumulate 1.5% interest every hour for every player who has a balance above zero (regardless of activity).
     
  3. thanks will test this Calytic