Example #1
0
        public void Execute(IRocketPlayer caller, string[] command)
        {
            var player = (UnturnedPlayer)caller;
            int money  = Convert.ToInt32(command[0]);

            switch (command.Length)
            {
            case 1:
                if (money > 0)
                {
                    if (money < EconomyDB.GetBalance(player) + 1)
                    {
                        EconomyDB.RemoveBalance(player, money);
                        player.Experience = player.Experience + (uint)money;
                        UnturnedChat.Say(caller, string.Format(Economy.Instance.Translate("mexange_success"), money, Economy.Instance.Configuration.Instance.CurrencyName, money));
                    }
                    else
                    {
                        UnturnedChat.Say(caller, Economy.Instance.Translate("no_balance"));
                    }
                }
                else
                {
                    UnturnedChat.Say(caller, Economy.Instance.Translate("err_ammount"));
                }
                break;

            default:
                UnturnedChat.Say(caller, Syntax);
                break;
            }
        }
Example #2
0
        public void Execute(IRocketPlayer caller, string[] command)
        {
            var uplayer = (UnturnedPlayer)caller;

            if (Economy.Instance.Configuration.Instance.MoneyUI == true)
            {
                if (Economy.Instance.Configuration.Instance.XpMode == false)
                {
                    EffectManager.sendUIEffectText(5456, uplayer.CSteamID, true, "Dinero", $"${EconomyDB.GetBalance(uplayer)}");
                }
                else
                {
                    EffectManager.sendUIEffectText(5456, uplayer.CSteamID, true, "Dinero", $"${uplayer.Experience}");
                }
            }
        }
Example #3
0
 private void Instance_OnBalanceUpdated(UnturnedPlayer player, int money)
 {
     EffectManager.sendUIEffectText(5456, player.CSteamID, true, "Dinero", $"${EconomyDB.GetBalance(player)}");
 }
Example #4
0
 private void Events_OnPlayerConnected(UnturnedPlayer player)
 {
     EconomyDB.NewAccount(player, Configuration.Instance.InitialMoney);
     if (EconomyDB.AccountExist(player) == false && Configuration.Instance.XpMode == true)
     {
         player.Experience = player.Experience + (uint)Configuration.Instance.InitialMoney;
     }
     if (Configuration.Instance.MoneyUI == true)
     {
         EffectManager.sendUIEffect(Configuration.Instance.UIID, 5456, player.CSteamID, true);
         if (Configuration.Instance.XpMode == false)
         {
             EffectManager.sendUIEffectText(5456, player.CSteamID, true, "Dinero", $"${EconomyDB.GetBalance(player)}");
         }
         else
         {
             EffectManager.sendUIEffectText(5456, player.CSteamID, true, "Dinero", $"${player.Experience}");
         }
     }
 }
Example #5
0
        public void Execute(IRocketPlayer caller, string[] command)
        {
            var player = (UnturnedPlayer)caller;

            switch (command.Length)
            {
            case 1:
                UnturnedChat.Say(caller, Syntax);
                break;

            case 2:
                UnturnedPlayer player2 = UnturnedPlayer.FromName(command[0]);
                if (player2 != null)
                {
                    if (player2.Id == player.Id)
                    {
                        UnturnedChat.Say(caller, Economy.Instance.Translate("pay_nopoint"));
                    }
                    else
                    {
                        int money = Convert.ToInt32(command[1]);
                        if (money > 0)
                        {
                            if (Economy.Instance.Configuration.Instance.XpMode == false)
                            {
                                if (money < EconomyDB.GetBalance(player) + 1)
                                {
                                    EconomyDB.RemoveBalance(player, money);
                                    EconomyDB.AddBalance(player2, money);
                                    UnturnedChat.Say(caller, string.Format(Economy.Instance.Translate("pay_success"), money, Economy.Instance.Configuration.Instance.CurrencyName, player2.DisplayName));
                                    UnturnedChat.Say(player2, string.Format(Economy.Instance.Translate("pay_recieve"), money, Economy.Instance.Configuration.Instance.CurrencyName, player.DisplayName));
                                }
                                else
                                {
                                    UnturnedChat.Say(caller, Economy.Instance.Translate("no_balance"));
                                }
                            }
                            else
                            {
                                if (money < player.Experience + 1)
                                {
                                    player.Experience  = player.Experience - (uint)money;
                                    player2.Experience = player.Experience + (uint)money;
                                    UnturnedChat.Say(caller, string.Format(Economy.Instance.Translate("xppay_success"), money, player2.DisplayName));
                                    UnturnedChat.Say(player2, string.Format(Economy.Instance.Translate("xppay_recieve"), money, player.DisplayName));
                                    Logger.Log(string.Format(Economy.Instance.Translate("c_pay_success"), money, player2.DisplayName, caller.DisplayName));
                                }
                                else
                                {
                                    UnturnedChat.Say(caller, Economy.Instance.Translate("no_balance"));
                                }
                            }
                        }
                        else
                        {
                            UnturnedChat.Say(caller, Economy.Instance.Translate("err_ammount"));
                        }
                    }
                }
                else
                {
                    UnturnedChat.Say(caller, Syntax);
                }
                break;

            default:
                UnturnedChat.Say(caller, Syntax);
                break;
            }
        }
Example #6
0
        public void Execute(IRocketPlayer caller, string[] command)
        {
            UnturnedPlayer unturnedPlayer = UnturnedPlayer.FromName(caller.DisplayName);

            if (Economy.Instance.Configuration.Instance.XpMode == false)
            {
                UnturnedChat.Say(caller, string.Format(Economy.Instance.Translate("balance"), EconomyDB.GetBalance(unturnedPlayer)));
            }
            else
            {
                UnturnedChat.Say(caller, string.Format(Economy.Instance.Translate("balance"), unturnedPlayer.Experience.ToString()));
            }
        }