Example #1
0
        private static bool CheckResponse(UnturnedPlayer player)
        {
            GarageUtil.GarageCheck(player, GarageModel.Parse("Drown"), out var responseType, true);
            if (!Plugin.DbManager.IsVehicleExist(player.CSteamID.m_SteamID.ToString(), "Drown", "Drowned"))
            {
                responseType = EResponseType.DONT_HAVE_VEHICLE;
            }
            switch (responseType)
            {
            case EResponseType.DONT_HAVE_VEHICLE:
                player.SendChat(Plugin.Inst.Translate("rfgarage_command_garage_no_vehicle", "Drown"), Plugin.MsgColor, Plugin.Conf.AnnouncerIconUrl);
                return(false);

            case EResponseType.GARAGE_NOT_FOUND:
                player.SendChat(Plugin.Inst.Translate("rfgarage_command_garage_not_found"), Plugin.MsgColor, Plugin.Conf.AnnouncerIconUrl);
                return(false);

            case EResponseType.GARAGE_NO_PERMISSION:
                player.SendChat(Plugin.Inst.Translate("rfgarage_command_garage_no_permission", "Drown", "garage.drown"), Plugin.MsgColor, Plugin.Conf.AnnouncerIconUrl);
                return(false);

            case EResponseType.SUCCESS:
                return(true);

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
        private static bool CheckResponse(UnturnedPlayer player, GarageModel garageModel)
        {
            GarageUtil.GarageCheck(player, garageModel, out var responseType, true);
            switch (responseType)
            {
            case EResponseType.GARAGE_NOT_FOUND:
                player.SendChat(Plugin.Inst.Translate("rfgarage_command_garage_not_found"), Plugin.MsgColor, Plugin.Conf.AnnouncerIconUrl);
                return(false);

            case EResponseType.GARAGE_NO_PERMISSION:
                player.SendChat(Plugin.Inst.Translate("rfgarage_command_garage_no_permission", garageModel.Name, garageModel.Permission), Plugin.MsgColor, Plugin.Conf.AnnouncerIconUrl);
                return(false);

            case EResponseType.SUCCESS:
                return(true);

            default:
                player.SendChat(responseType.ToString(), Plugin.MsgColor, Plugin.Conf.AnnouncerIconUrl);
                return(false);
            }
        }