赴爱 发表于 2025-6-12 00:37:11

注释


Config = {
    Lan = "cn", -- Pick your language here
    System = {
      Debug = false, -- enable debug mode

      Menu = "ox",            -- "qb", "ox", "gta"
      ProgressBar = "gta",    -- "qb", "ox", "gta"
      Notify = "gta",         -- "qb", "ox", "gta"
      drawText = "gta"            -- "qb", "ox", "gta"

    },
    General = {
      JimShops = false,       -- Set this to true if using jim-shops for the shops
      DrillSound = true,      -- enable/disable drill sounds

      K4MB1Prop = false,      -- Enable this to make use of K4MB1's ore props provided with their Mining Cave MLO

      AltMining = false,      -- Enables Alternate mining (enhanced with k4mb1's mining ore props)
                              -- Changes system to one based on rarity of ores specified in setMiningTable below
                              -- Every ore that spawns will give specific ores

      K4MB1Cart = false,      -- If using k4mb1's shaftcave mlo + caveprops
                              -- Allow players to use a minecart to get to the chambers faster
                              -- Add's target option to the store ped at the mine shaft

      requiredJob = nil,

    },
    Crafting = {
      craftCam = false,
      MultiCraft = true,      -- Enable multicraft
    },

    Timings = { -- Time it takes to do things
      Cracking = { 15000, 25000 }, -- 15 - 25 seconds
      Washing = { 15000, 25000 }, -- 15 - 25 seconds
      Panning = { 45000, 50000 },-- 45 - 50 seconds
      Pickaxe = { 30000, 45000 }, --30 - 45 seconds
      Mining = { 45000, 50000 }, -- 45 - 50 seconds
      Laser = { 7000, 10000 },
      OreRespawn = math.random(55000, 75000),
      Crafting = 5000, -- 5 seconds
    },

    PoolAmounts = {
      Mining = {
            AmountPerSuccess = { 1, 3 }   -- Per success, this will give 1 - 3 of the selected item
      },
      Cracking = {
            AmountPerSuccess = { 1, 3 }   -- Per success, this will give 1 - 3 of the selected item
      },
      Panning = {
            Successes = { 1, 2 },         -- When complete, default will give 1 or 2 items
            AmountPerSuccess = { 1, 3 }   -- Per success, this will give 1 - 3 of the selected item
      },
      Washing = {
            Successes = { 1, 2 },         -- When complete, default will give 1 or 2 items
            AmountPerSuccess = { 1, 3 }   -- Per success, this will give 1 - 3 of the selected item
      },

    },

    CrackPool = { -- Rewards from cracking stone
      { item = "carbon", rarity = "70",},
      { item = "copperore",rarity = "10",},
      { item = "ironore", rarity = "10",},
      { item = "metalscrap", rarity = "90",},
    },

    WashPool = {    -- Rewards from washing stone
      { item = "goldore", rarity = "10",},
      { item = "copperore",rarity = "80",},
      { item = "uncut_ruby", rarity = "50" },
      { item = "uncut_emerald", rarity = "50"},
      { item = "uncut_diamond", rarity = "10"},
      { item = "uncut_sapphire", rarity = "50"},
    },

    PanPool = {   -- Rewards from panning
      { item = "can", rarity = "90", },
      { item = "goldore", rarity = "10", },
      { item = "bottle", rarity = "10", },
      { item = "stone", rarity = "90", },
      { item = "silverore", rarity = "10", },
    },

    setMiningTable = {-- Set rarity of ore spawn for AltMining
      { name = "carbon", rarity = "common", prop = "k4mb1_coal2", },
      { name = "copperore", rarity = "common", prop = "k4mb1_copperore2", },
      { name = "ironore", rarity = "common", prop = "k4mb1_ironore2", },
      { name = "metalscrap", rarity = "common", prop = "k4mb1_leadore2" },
      { name = "goldore", rarity = "rare", prop = "k4mb1_goldore2" },
      { name = "silverore", rarity = "rare", prop = "k4mb1_tinore2" },
      { name = "uncut_ruby", rarity = "ultra_rare", prop = "k4mb1_crystalred" },
      { name = "uncut_emerald", rarity = "ultra_rare", prop = "k4mb1_crystalgreen" },
      { name = "uncut_diamond", rarity = "ultra_rare", prop = "k4mb1_diamond" },
      { name = "uncut_sapphire", rarity = "ultra_rare", prop = "k4mb1_crystalblue" },
      { name = "stone", rarity = "common", prop = "cs_x_rubweec" },
    },

------------------------------------------------------------
--Mining Store Items
    Items = {
      label = "Mining Store",slots = 9,
      items = {
            { name = "water_bottle", price = 2, amount = 100, info = {}, type = "item", slot = 1, },
            { name = "sandwich", price = 2, amount = 250, info = {}, type = "item", slot = 2, },
            { name = "bandage", price = 25, amount = 100, info = {}, type = "item", slot = 3, },
            { name = "weapon_flashlight", price = 75, amount = 100, info = {}, type = "item", slot = 4, },
            { name = "goldpan", price = 25, amount = 100, info = {}, type = "item", slot = 5, },
            { name = "pickaxe", price = 100, amount = 100, info = {}, type = "item", slot = 6, },
            { name = "miningdrill", price = 10000, amount = 50, info = {}, type = "item", slot = 7, },
            { name = "mininglaser", price = 60000, amount = 5, info = {}, type = "item", slot = 8, },
            { name = "drillbit", price = 0, amount = 100, info = {}, type = "item", slot = 9, },
      },
    },
}

function locale(section, string)
    if not string then
      print(section, "string is nil")
    end
    if not Config.Lan or Config.Lan == "" then return print("Error, no langauge set") end
    local localTable = Loc[Config.Lan]
    if not localTable then return "Locale Table Not Found" end
    if not localTable[section] then return "["..section.."] Invalid" end
    if not localTable[section][string] then return "["..string.."] Invalid" end
    return localTable[section][string]
end


ChatGPT 发表于 2025-6-12 00:37:45


Config = {
    Lan = "cn", -- 选择你的语言
    System = {
      Debug = false, -- 启用调试模式
      
      Menu = "ox", -- 菜单类型,可以选择 "qb", "ox", "gta"
      ProgressBar = "gta", -- 进度条类型,可以选择 "qb", "ox", "gta"
      Notify = "gta", -- 通知类型,可以选择 "qb", "ox", "gta"
      drawText = "gta" -- 绘制文本类型,可以选择 "qb", "ox", "gta"
    },
    General = {
      JimShops = false, -- 如果使用jim-shops,请将其设置为true
      DrillSound = true, -- 启用/禁用钻孔声音
      
      K4MB1Prop = false, -- 启用此选项以使用K4MB1提供的矿山洞穴道具
      
      AltMining = false, -- 启用替代采矿(增强版,使用k4mb1的矿石道具)
                            -- 根据下方setMiningTable指定的矿石稀有度改变系统
                            -- 每个生成的矿石都会带来特定的矿石
      
      K4MB1Cart = false, -- 如果使用k4mb1的矿井洞穴MLO + 洞穴道具
                            -- 允许玩家使用矿车更快到达矿室
                            -- 在矿井商人处增加目标选项
      
      requiredJob = nil, -- 需要的工作,设置为nil表示不需要特定工作
    },
    Crafting = {
      craftCam = false, -- 启用 crafting 摄像机
      MultiCraft = true, -- 启用多重制作
    },

    Timings = { -- 执行操作所需的时间
      Cracking = { 15000, 25000 }, -- 裂解需要15 - 25秒
      Washing = { 15000, 25000 }, -- 清洗需要15 - 25秒
      Panning = { 45000, 50000 }, -- 淘金需要45 - 50秒
      Pickaxe = { 30000, 45000 }, -- 用镐子需要30 - 45秒
      Mining = { 45000, 50000 }, -- 采矿需要45 - 50秒
      Laser = { 7000, 10000 }, -- 激光操作需要7 - 10秒
      OreRespawn = math.random(55000, 75000), -- 矿石重生时间
      Crafting = 5000, -- 制作需要5秒
    },

    PoolAmounts = {
      Mining = {
            AmountPerSuccess = { 1, 3 } -- 每次成功采矿将获得1 - 3个所选物品
      },
      Cracking = {
            AmountPerSuccess = { 1, 3 } -- 每次成功裂解将获得1 - 3个所选物品
      },
      Panning = {
            Successes = { 1, 2 }, -- 完成后默认获得1或2个物品
            AmountPerSuccess = { 1, 3 } -- 每次成功将获得1 - 3个所选物品
      },
      Washing = {
            Successes = { 1, 2 }, -- 完成后默认获得1或2个物品
            AmountPerSuccess = { 1, 3 } -- 每次成功将获得1 - 3个所选物品
      },
    },

    CrackPool = { -- 从裂解石头中获得的奖励
      { item = "carbon", rarity = "70", }, -- 碳,稀有度70
      { item = "copperore", rarity = "10", }, -- 铜矿,稀有度10
      { item = "ironore", rarity = "10", }, -- 铁矿,稀有度10
      { item = "metalscrap", rarity = "90", }, -- 金属废料,稀有度90
    },

    WashPool = { -- 从清洗石头中获得的奖励
      { item = "goldore", rarity = "10", }, -- 黄金矿,稀有度10
      { item = "copperore", rarity = "80", }, -- 铜矿,稀有度80
      { item = "uncut_ruby", rarity = "50" }, -- 未切割红宝石,稀有度50
      { item = "uncut_emerald", rarity = "50"}, -- 未切割绿宝石,稀有度50
      { item = "uncut_diamond", rarity = "10"}, -- 未切割钻石,稀有度10
      { item = "uncut_sapphire", rarity = "50"}, -- 未切割蓝宝石,稀有度50
    },

    PanPool = { -- 从淘金中获得的奖励
      { item = "can", rarity = "90", }, -- 易拉罐,稀有度90
      { item = "goldore", rarity = "10", }, -- 黄金矿,稀有度10
      { item = "bottle", rarity = "10", }, -- 瓶子,稀有度10
      { item = "stone", rarity = "90", }, -- 石头,稀有度90
      { item = "silverore", rarity = "10", }, -- 银矿,稀有度10
    },

    setMiningTable = { -- 设置替代采矿的矿石生成稀有度
      { name = "carbon", rarity = "common", prop = "k4mb1_coal2", }, -- 碳,普通稀有度
      { name = "copperore", rarity = "common", prop = "k4mb1_copperore2", }, -- 铜矿,普通稀有度
      { name = "ironore", rarity = "common", prop = "k4mb1_ironore2", }, -- 铁矿,普通稀有度
      { name = "metalscrap", rarity = "common", prop = "k4mb1_leadore2" }, -- 金属废料,普通稀有度
      { name = "goldore", rarity = "rare", prop = "k4mb1_goldore2" }, -- 黄金矿,稀有稀有度
      { name = "silverore", rarity = "rare", prop = "k4mb1_tinore2" }, -- 银矿,稀有稀有度
      { name = "uncut_ruby", rarity = "ultra_rare", prop = "k4mb1_crystalred" }, -- 未切割红宝石,极其稀有
      { name = "uncut_emerald", rarity = "ultra_rare", prop = "k4mb1_crystalgreen" }, -- 未切割绿宝石,极其稀有
      { name = "uncut_diamond", rarity = "ultra_rare", prop = "k4mb1_diamond" }, -- 未切割钻石,极其稀有
      { name = "uncut_sapphire", rarity = "ultra_rare", prop = "k4mb1_crystalblue" }, -- 未切割蓝宝石,极其稀有
      { name = "stone", rarity = "common", prop = "cs_x_rubweec" }, -- 石头,普通稀有度
    },

------------------------------------------------------------
-- 采矿商店物品
    Items = {
      label = "Mining Store",slots = 9, -- 商店标签和槽位数量
      items = {
            { name = "water_bottle", price = 2, amount = 100, info = {}, type = "item", slot = 1, }, -- 水瓶
            { name = "sandwich", price = 2, amount = 250, info = {}, type = "item", slot = 2, }, -- 三明治
            { name = "bandage", price = 25, amount = 100, info = {}, type = "item", slot = 3, }, -- 绷带
            { name = "weapon_flashlight", price = 75, amount = 100, info = {}, type = "item", slot = 4, }, -- 武器手电筒
            { name = "goldpan", price = 25, amount = 100, info = {}, type = "item", slot = 5, }, -- 淘金盘
            { name = "pickaxe", price = 100, amount = 100, info = {}, type = "item", slot = 6, }, -- 镐
            { name = "miningdrill", price = 10000, amount = 50, info = {}, type = "item", slot = 7, }, -- 采矿钻
            { name = "mininglaser", price = 60000, amount = 5, info = {}, type = "item", slot = 8, }, -- 采矿激光
            { name = "drillbit", price = 0, amount = 100, info = {}, type = "item", slot = 9, }, -- 钻头
      },
    },
}

function locale(section, string)
    if not string then
      print(section, "字符串为空")
    end
    if not Config.Lan or Config.Lan == "" then return print("错误:未设置语言") end
    local localTable = LocConfig -- 语言配置表
    if not localTable then return "找不到语言表" end
    if not localTable then return "..section..无效" end
    if not localTable then return "..string..无效" end
    return localTable -- 返回语言字符串
end


这段代码是一个FiveM插件的配置文件,主要用于设置各种配置选项,包括语言、调试模式、商店物品等。该代码应该放在`Config.lua`文件中,而不是`server.lua`或`client.lua`中,因为它主要用于定义全局配置项,而不是处理服务器逻辑或客户端事件。
页: [1]
查看完整版本: 注释