赴爱 发表于 2025-3-27 02:29:36

汉化


exports('Notify', Notify)
RegisterNetEvent("ESX:Notify", Notify)

if Debug then
    RegisterCommand("oldnotify", function()
      ESX.ShowNotification('No Waypoint Set.', true, false, 140)
    end)

    RegisterCommand("notify", function()
      ESX.ShowNotification("You Recived ~br~ 1x ball~s~!", "success", 3000)
    end)

    RegisterCommand("notify1", function()
      ESX.ShowNotification("Well ~g~Done~s~!", "success", 3000)
    end)

    RegisterCommand("notify2", function()
      ESX.ShowNotification("Information Recived", "info", 3000)
    end)

    RegisterCommand("notify3", function()
      ESX.ShowNotification("You Did something ~r~WRONG~s~!", "error", 3000)
    end)
end


ChatGPT 发表于 2025-3-27 02:30:23

以下是代码的汉化版本,并添加了注释:


-- 导出 Notify 函数
exports('Notify', Notify)

-- 注册 ESX:Notify 事件
RegisterNetEvent("ESX:Notify", Notify)

-- 如果开启了调试模式
if Debug then
    -- 注册命令 oldnotify,用于显示没有设置路标的通知
    RegisterCommand("oldnotify", function()
      ESX.ShowNotification('没有设置路标。', true, false, 140)
    end)

    -- 注册命令 notify,用于显示收到通知的脚本
    RegisterCommand("notify", function()
      ESX.ShowNotification("你收到了 ~br~ 1个球~s~!", "success", 3000)
    end)

    -- 注册命令 notify1,用于显示完成的通知
    RegisterCommand("notify1", function()
      ESX.ShowNotification("做得很好 ~g~!~s~", "success", 3000)
    end)

    -- 注册命令 notify2,用于显示信息接收的通知
    RegisterCommand("notify2", function()
      ESX.ShowNotification("信息已接收", "info", 3000)
    end)

    -- 注册命令 notify3,用于显示错误的通知
    RegisterCommand("notify3", function()
      ESX.ShowNotification("你做错了 ~r~!~s~", "error", 3000)
    end)
end


### 代码说明:
- `exports('Notify', Notify)`:将 Notify 函数导出,以供其他资源使用。
- `RegisterNetEvent("ESX:Notify", Notify)`:注册一个网络事件,这个事件会在 ESX 中触发 Notify 函数。
- `if Debug then`:如果调试模式开启,则注册一系列命令用于测试通知功能。
- 使用 `RegisterCommand` 注册的命令可以在游戏中通过聊天输入执行,来测试不同的通知效果。

这些代码主要放在 `client.lua` 中,因为它涉及到前端的用户界面通知。
页: [1]
查看完整版本: 汉化