Hello, Guest

By registering with us, you'll be able to discuss, share and private message with other members of our community.
What's new

SCRIPT Passive Income from RA Businesses

Alexalsaud

Administrative
Staff member
Admin
Joined
Aug 5, 2024
Messages
337
ICoins
1,130
Passive Income from RA Businesses

Instruction:
1) Fill the code into the Main.cs
2) After that, create a timer every 60000ms following the example of the SAVEDB timer.

C#:
BIZ SYSTEM REDAGE
          private void BizPayment()
        {
            try
            {
                DateTime now = DateTime.Now;
                if (now.Hour == 21 && now.Minute == 30) //Тут мы ставим время выдачи
                {
                    var res = MySQL.QueryRead($"SELECT * FROM `businesses`");
                    var checkplayer = "null";
                    if (res == null || res.Rows.Count == 0)
                    {
                        Log.Write("Резов нет пиздец!", nLog.Type.Warn);
                        return;
                    }
                    foreach (DataRow Row in res.Rows)
                    {
                        string tested = Convert.ToString(Row["owner"]);
                        if (tested != "Государство")
                        {
                            checkplayer = tested;
                            Log.Write(tested, nLog.Type.Success);
                            BizPayments(checkplayer);
                        }


                    }
                }
            }
            catch (Exception e) { Log.Write("EXCEPTION AT \"CMD\":\n" + e.ToString(), nLog.Type.Error); }
        }
        private void BizPayments(string play)
        {
            try
            {
                {
                    var money = 0;
                    var res2 = MySQL.QueryRead($"SELECT * FROM `businesses` WHERE `owner`='{play}'");
                    if (res2 == null || res2.Rows.Count == 0)
                    {
                        Log.Write("Резов нет пиздец!2", nLog.Type.Warn);
                        return;
                    }
                    foreach (DataRow Row in res2.Rows)
                    {
                        int cash = Convert.ToInt32(Row["sellprice"]);
                        money = cash / 100 * 2;// тут мы ставим процент
                        Log.Write("Кеш " + money, nLog.Type.Success);
                        BizPayments2(play, money);
                    }
                }
            }
            catch (Exception e) { Log.Write("EXCEPTION AT \"CMD\":\n" + e.ToString(), nLog.Type.Error); }
        }
        public void BizPayments2(string play, int money)
        {
            try
            {
                Log.Write(play + " " + money);
                string[] split = play.Split('_');
                List<Player> players = NAPI.Pools.GetAllPlayers();
                if (players.Count != 0)
                {
                    foreach (var p in players)
                    {
                        if (p != null && p.Name == play)
                        {
                            var iz = Convert.ToInt32(Main.Players[p].Money);
                            if (money + iz >= 200000000) return;
                            Log.Write("Игрок онлайн плеерКеш " + money, nLog.Type.Success);
                            MoneySystem.Wallet.Change(p, money);
                            return;
                        }
                        else
                        {
                            Log.Write("Так-же " + split[0] + " " + split[1] + " " + money, nLog.Type.Success);
                            MySQL.Query($"UPDATE characters SET money=money+{money} WHERE firstname='{split[0]}' AND lastname='{split[1]}'");
                            return;
                        }
                    }
                }
                else
                {
                    Log.Write("Так-же " + split[0] + " " + split[1] + " " + money, nLog.Type.Success);
                    MySQL.Query($"UPDATE characters SET money=money+{money} WHERE firstname='{split[0]}' AND lastname='{split[1]}'");
                    return;
                }


            }
            catch (Exception e) { Log.Write("EXCEPTION AT \"CMD\":\n" + e.ToString(), nLog.Type.Error); }
        }
 
Back
Top