Example #1
0
        public void Execute(IRocketPlayer caller, string[] command)
        {
            if (command.Length != 3)
            {
                UnturnedChat.Say(caller, Plugin.Inst.Translate("rfgarage_command_invalid_parameter", Syntax), Plugin.MsgColor);
                return;
            }

            var    player = (UnturnedPlayer)caller;
            string garage;

            if (command[1].ToLower() != "drown")
            {
                if (!CheckResponse(player, command))
                {
                    return;
                }
                garage = GarageModel.Parse(command[1]).Name;
            }
            else
            {
                garage = "Drown";
            }
            GarageUtil.LoadVgVehicleFromSql(player, garage, command[1].ToLower() != "drown" ? command[2] : "Drowned", out var vehicle, command[0]);
            UnturnedChat.Say(caller, Plugin.Inst.Translate("rfgarage_command_gr_success", vehicle.asset.vehicleName, vehicle.asset.id, garage), Plugin.MsgColor);
        }
        public void Execute(IRocketPlayer caller, string[] command)
        {
            if (command.Length > 2 || command.Length == 0)
            {
                caller.SendChat(Plugin.Inst.Translate("rfgarage_command_invalid_parameter", Syntax), Plugin.MsgColor, Plugin.Conf.AnnouncerIconUrl);
                return;
            }

            var player = (UnturnedPlayer)caller;

            switch (command.Length)
            {
            case 1 when Plugin.Conf.VirtualGarages.Any(g => string.Equals(g.Name, command[0], StringComparison.CurrentCultureIgnoreCase)):
                caller.SendChat(Plugin.Inst.Translate("rfgarage_command_invalid_parameter", Syntax), Plugin.MsgColor, Plugin.Conf.AnnouncerIconUrl);

                return;

            case 1 when !Plugin.Conf.VirtualGarages.Any(g => string.Equals(g.Name, command[0], StringComparison.CurrentCultureIgnoreCase)):
            {
                if (!CheckResponse(player, command))
                {
                    return;
                }
                var garage = Plugin.SelectedGarageDict[player.CSteamID];
                GarageUtil.LoadVgVehicleFromSql(player, garage.Name, command[0], out var vehicle);
                caller.SendChat(Plugin.Inst.Translate("rfgarage_command_gr_success", vehicle.asset.vehicleName, vehicle.asset.id, garage.Name), Plugin.MsgColor, Plugin.Conf.AnnouncerIconUrl);
                return;
            }

            case 1:
                caller.SendChat(Plugin.Inst.Translate("rfgarage_command_gr_invalid_parameter"), Plugin.MsgColor, Plugin.Conf.AnnouncerIconUrl);
                return;

            case 2 when !CheckResponse(player, command):
                return;

            case 2:
            {
                var garage = GarageModel.Parse(command[0]);
                GarageUtil.LoadVgVehicleFromSql(player, garage.Name, command[1], out var vehicle);
                caller.SendChat(Plugin.Inst.Translate("rfgarage_command_gr_success", vehicle.asset.vehicleName, vehicle.asset.id, garage.Name), Plugin.MsgColor, Plugin.Conf.AnnouncerIconUrl);
                return;
            }

            default:
                caller.SendChat(Plugin.Inst.Translate("rfgarage_command_invalid_parameter"), Plugin.MsgColor, Plugin.Conf.AnnouncerIconUrl);
                break;
            }
        }
Example #3
0
        public void Execute(IRocketPlayer caller, string[] command)
        {
            if (command.Length > 0)
            {
                caller.SendChat(Plugin.Inst.Translate("rfgarage_command_invalid_parameter", Syntax), Plugin.MsgColor, Plugin.Conf.AnnouncerIconUrl);
                return;
            }

            var player = (UnturnedPlayer)caller;

            if (command.Length != 0)
            {
                return;
            }
            if (!CheckResponse(player))
            {
                return;
            }
            GarageUtil.LoadVgVehicleFromSql(player, "Drown", "Drowned", out var vehicle);
            player.SendChat(Plugin.Inst.Translate("rfgarage_command_gr_success",
                                                  vehicle.asset.vehicleName, vehicle.asset.id, "Drown"), Plugin.MsgColor, Plugin.Conf.AnnouncerIconUrl);
        }