搜索
开启左侧

翻译

[复制链接]
乐乐乐 发表于 2024-7-14 20:39:47 | 显示全部楼层 |阅读模式
-- Based on es_carwash by 'EssentialMode 5 CarWash by TheSpartaPT.' --
-- Modified a bit by Calm Producions
-- RECOMMEND-THAT-YOU-DO-NOT-EDIT-BELLOW-THIS-LINE--

Key = 201 -- ENTER

vehicleAutoBodyStation = {
        -- {-327.0, -144.6, 38.3}, -- LSC Burton body spray tent
        {1139.55, -864.30, 52.77}, -- LSC La Mesa body spray tent
        -- {481.7, -1317.4, 28.5}, -- Hayes Bodywork Shop, Little Bighorn Ave.
        -- {288.2, -1729.5, 28.5}, -- Hayes Bodywork Shop, Rancho
        -- {-24.6, -1678.2, 29.0}, -- Mosley Bodywork Service, Strawberry
        -- {-199.0, -1382.0, 30.5}, -- Glass Heroes, Strawberry
        -- {-1166.7, -2013.0, 12.5},        -- LSC by airport body spray tent
        -- {-440.0, -2177.5, 10.0}, -- Otto's Auto Body, LSI Elysin Island
        -- {-1409.0, -459.1, 33.8}, -- Hayes Auto Body Shop, Del Perro
        -- {103.6, 6622.5, 31.1}, -- LSC Paleto Bay body spray tent
        -- {1914.0, 3729.0, 32.0}, -- Otto's Auto Body, Sandy Shores
        -- {1182.7, 2638.4, 37.0} -- 68 Harmony Body spray tent
}

Citizen.CreateThread(function ()
        Citizen.Wait(0)
        for i = 1, #vehicleAutoBodyStation do
                garageCoords = vehicleAutoBodyStation[i]
                stationBlip = AddBlipForCoord(garageCoords[1], garageCoords[2], garageCoords[3])
                SetBlipSprite(stationBlip, 72) -- 72 radar_car_mod_shop
                SetBlipColour(stationBlip, 3) -- 0 White, 1 Red, 2 Green, 3 Blue etc.
                SetBlipAsShortRange(stationBlip, true)
                SetBlipDisplay(stationBlip, 2) -- 0 Doesn't showup ever.
                                                                                --1 Doesn't showup ever anywhere.
                                                                                --2 Shows on both main map and minimap
                                                                                --3&4 Main map only
                                                                                --5 shows on minimap only
                                                                                --6 shows on both
                                                                                --7 Doesn't showup
                                                                                --8 both not selectable
                                                                                --9 minimap only
                                                                                --10 both not selectable
                                                                                --Rockstar seem to only use 0, 2, 3, 4, 5 and 8 in the decompiled scripts.
                BeginTextCommandSetBlipName("STRING")
                AddTextComponentString("Body Shop")
                EndTextCommandSetBlipName(stationBlip)
        end
    return
end)

function cp_auto_body_DrawSubtitleTimed(m_text, showtime)
        SetTextEntry_2('STRING')
        AddTextComponentString(m_text)
        DrawSubtitleTimed(showtime, 1)
end

function cp_auto_body_DrawNotification(m_text)
        SetNotificationTextEntry('STRING')
        AddTextComponentString(m_text)
        DrawNotification(true, false)
end

Citizen.CreateThread(function ()

        while true do
                Citizen.Wait(0)
                if IsPedSittingInAnyVehicle(PlayerPedId()) then
                        for i = 1, #vehicleAutoBodyStation do
                                garageCoords2 = vehicleAutoBodyStation[i]
                                if GetDistanceBetweenCoords(GetEntityCoords(PlayerPedId()), garageCoords2[1], garageCoords2[2], garageCoords2[3], true ) < 20 then
                                        DrawMarker(1, garageCoords2[1], garageCoords2[2], garageCoords2[3], 0, 0, 0, 0, 0, 0, 5.0, 5.0, 2.0, 0, 0, 156, 155, 0, 0, 2, 0, 0, 0, 0)
                                        if GetDistanceBetweenCoords(GetEntityCoords(PlayerPedId()), garageCoords2[1], garageCoords2[2], garageCoords2[3], true ) < 5 then
                                                cp_auto_body_DrawSubtitleTimed("按 [~g~ENTER~s~] 自动维修车身!")
                                                if IsControlJustPressed(1, Key) then
                                                        TriggerServerEvent('cp_auto_body:checkmoney')
                                                end
                                        end
                                end
                        end
                end
        end
end)

RegisterNetEvent('cp_auto_body:success')
AddEventHandler('cp_auto_body:success', function (price)
        player = PlayerPedId()
        playerVehicle = GetVehiclePedIsUsing(player)
        local GVEH = GetVehicleEngineHealth(playerVehicle)
        SetVehicleBodyHealth(playerVehicle, 1000.0)
        SetVehiclePetrolTankHealth(playerVehicle, 1000.0)
--        SetVehicleWheelHealth(playerVehicle, 1000.0)
--        SetVehicleUndriveable(playerVehicle, false)
--        SetVehicleEngineHealth(playerVehicle, 1000.0)
        RemoveDecalsFromVehicle(playerVehicle)
        SetVehicleDeformationFixed(playerVehicle)
        SetVehicleFixed(playerVehicle)
        SetVehicleEngineHealth(playerVehicle, GVEH)
        Citizen.Wait(1000)
        cp_auto_body_DrawNotification("Your vehicle's body was ~y~repaired~s~! ~g~-$" .. price .. "~s~!")
end)

RegisterNetEvent('cp_auto_body:notenoughmoney')
AddEventHandler('cp_auto_body:notenoughmoney', function (moneyleft)
        cp_auto_body_DrawNotification("~h~~r~You don't have enough money! $" .. moneyleft .. " left!")
end)

RegisterNetEvent('cp_auto_body:free')
AddEventHandler('cp_auto_body:free', function ()
        player = PlayerPedId()
        playerVehicle = GetVehiclePedIsUsing(player)
        local GVEH = GetVehicleEngineHealth(playerVehicle)
        SetVehicleBodyHealth(playerVehicle, 1000.0)
        SetVehiclePetrolTankHealth(playerVehicle, 1000.0)
--        SetVehicleWheelHealth(playerVehicle, 1000.0)
--        SetVehicleUndriveable(playerVehicle, false)
--        SetVehicleEngineHealth(playerVehicle, 1000.0)
        RemoveDecalsFromVehicle(playerVehicle)
        SetVehicleDeformationFixed(playerVehicle)
        SetVehicleFixed(playerVehicle)
        SetVehicleEngineHealth(playerVehicle, GVEH)
        Citizen.Wait(1000)
        cp_auto_body_DrawNotification("Your vehicle's body was ~y~repaired~s~ for free!")
end)


回复 论坛版权

使用道具 举报

ChatGPT 发表于 2024-7-23 12:03:10 | 显示全部楼层
以下是您提供代码的中文翻译:
-- 基于 es_carwash 由 'EssentialMode 5 CarWash by TheSpartaPT.' --
-- Calm Productions 对其进行了稍微修改
-- 建议您不要编辑此行以下内容 --

Key = 201 -- ENTER(回车键)

vehicleAutoBodyStation = {
    -- {-327.0, -144.6, 38.3}, -- LSC Burton 车身喷漆帐篷
    {1139.55, -864.30, 52.77}, -- LSC La Mesa 车身喷漆帐篷
    -- {481.7, -1317.4, 28.5}, -- Hayes 车身维修店, Little Bighorn Ave.
    -- {288.2, -1729.5, 28.5}, -- Hayes 车身维修店, Rancho
    -- {-24.6, -1678.2, 29.0}, -- Mosley 车身维修服务, Strawberry
    -- {-199.0, -1382.0, 30.5}, -- Glass Heroes, Strawberry
    -- {-1166.7, -2013.0, 12.5}, -- LSC 机场附近的车身喷漆帐篷
    -- {-440.0, -2177.5, 10.0}, -- Otto's Auto Body, LSI Elysin Island
    -- {-1409.0, -459.1, 33.8}, -- Hayes 车身维修店, Del Perro
    -- {103.6, 6622.5, 31.1}, -- LSC Paleto Bay 车身喷漆帐篷
    -- {1914.0, 3729.0, 32.0}, -- Otto's Auto Body, Sandy Shores
    -- {1182.7, 2638.4, 37.0} -- 68 Harmony 车身喷漆帐篷
}

Citizen.CreateThread(function ()
    Citizen.Wait(0)
    for i = 1, #vehicleAutoBodyStation do
        garageCoords = vehicleAutoBodyStation
        stationBlip = AddBlipForCoord(garageCoords, garageCoords, garageCoords)
        SetBlipSprite(stationBlip, 72) -- 72 radar_car_mod_shop(雷达车修改商店)
        SetBlipColour(stationBlip, 3) -- 0 白色, 1 红色, 2 绿色, 3 蓝色等
        SetBlipAsShortRange(stationBlip, true)
        SetBlipDisplay(stationBlip, 2) -- 0 从不显示
                                        -- 1 从不在任何地方显示
                                        -- 2 在主地图和小地图上显示
                                        -- 3&4 仅在主地图上
                                        -- 5 仅在小地图上显示
                                        -- 6 同时显示在两者上
                                        -- 7 不显示
                                        -- 8 两者都不可选择
                                        -- 9 仅小地图上
                                        -- 10 两者都不可选择
                                        -- Rockstar 似乎只在反编译的脚本中使用 0, 2, 3, 4, 5 和 8。
        BeginTextCommandSetBlipName("STRING")
        AddTextComponentString("车身修理店")
        EndTextCommandSetBlipName(stationBlip)
    end
    return
end)

function cp_auto_body_DrawSubtitleTimed(m_text, showtime)
    SetTextEntry_2('STRING')
    AddTextComponentString(m_text)
    DrawSubtitleTimed(showtime, 1) -- 显示时间
end

function cp_auto_body_DrawNotification(m_text)
    SetNotificationTextEntry('STRING')
    AddTextComponentString(m_text)
    DrawNotification(true, false)
end

Citizen.CreateThread(function ()
    while true do
        Citizen.Wait(0)
        if IsPedSittingInAnyVehicle(PlayerPedId()) then 
            for i = 1, #vehicleAutoBodyStation do
                garageCoords2 = vehicleAutoBodyStation
                if GetDistanceBetweenCoords(GetEntityCoords(PlayerPedId()), garageCoords2, garageCoords2, garageCoords2, true ) < 20 then
                    DrawMarker(1, garageCoords2, garageCoords2, garageCoords2, 0, 0, 0, 0, 0, 0, 5.0, 5.0, 2.0, 0, 0, 156, 155, 0, 0, 2, 0, 0, 0, 0)
                    if GetDistanceBetweenCoords(GetEntityCoords(PlayerPedId()), garageCoords2, garageCoords2, garageCoords2, true ) < 5 then
                        cp_auto_body_DrawSubtitleTimed("按  自动维修车身!")
                        if IsControlJustPressed(1, Key) then
                            TriggerServerEvent('cp_auto_body:checkmoney') -- 检查玩家是否有足够的金额
                        end
                    end
                end
            end
        end
    end
end)

RegisterNetEvent('cp_auto_body:success')
AddEventHandler('cp_auto_body:success', function (price)
    player = PlayerPedId()
    playerVehicle = GetVehiclePedIsUsing(player)
    local GVEH = GetVehicleEngineHealth(playerVehicle)
    SetVehicleBodyHealth(playerVehicle, 1000.0) -- 设置车身健康值
    SetVehiclePetrolTankHealth(playerVehicle, 1000.0) -- 设置油箱健康值
    -- SetVehicleWheelHealth(playerVehicle, 1000.0) -- 设置轮胎健康值(已注释)
    -- SetVehicleUndriveable(playerVehicle, false) -- 设置车辆可驾驶状态(已注释)
    -- SetVehicleEngineHealth(playerVehicle, 1000.0) -- 设置发动机健康值(已注释)
    RemoveDecalsFromVehicle(playerVehicle) -- 移除车辆上的贴花
    SetVehicleDeformationFixed(playerVehicle) -- 修复车辆变形
    SetVehicleFixed(playerVehicle) -- 修复车辆
    SetVehicleEngineHealth(playerVehicle, GVEH) -- 恢复发动机原有健康值
    Citizen.Wait(1000)
    cp_auto_body_DrawNotification("您的车辆车身已 ~y~修复~s~! ~g~-$" .. price .. "~s~!")
end)

RegisterNetEvent('cp_auto_body:notenoughmoney')
AddEventHandler('cp_auto_body:notenoughmoney', function (moneyleft)
    cp_auto_body_DrawNotification("~h~~r~您没有足够的钱! $" .. moneyleft .. " 剩余未用!")
end)

RegisterNetEvent('cp_auto_body:free')
AddEventHandler('cp_auto_body:free', function ()
    player = PlayerPedId()
    playerVehicle = GetVehiclePedIsUsing(player)
    local GVEH = GetVehicleEngineHealth(playerVehicle)
    SetVehicleBodyHealth(playerVehicle, 1000.0) -- 设置车身健康值
    SetVehiclePetrolTankHealth(playerVehicle, 1000.0) -- 设置油箱健康值
    -- SetVehicleWheelHealth(playerVehicle, 1000.0) -- 设置轮胎健康值(已注释)
    -- SetVehicleUndriveable(playerVehicle, false) -- 设置车辆可驾驶状态(已注释)
    -- SetVehicleEngineHealth(playerVehicle, 1000.0) -- 设置发动机健康值(已注释)
    RemoveDecalsFromVehicle(playerVehicle) -- 移除车辆上的贴花
    SetVehicleDeformationFixed(playerVehicle) -- 修复车辆变形
    SetVehicleFixed(playerVehicle) -- 修复车辆
    SetVehicleEngineHealth(playerVehicle, GVEH) -- 恢复发动机原有健康值
    Citizen.Wait(1000)
    cp_auto_body_DrawNotification("您的车辆车身已 ~y~免费修复~s~!")
end)

这个翻译保留了代码结构,并将注释与文本翻译成了中文。希望这可以帮助您理解代码的功能!如果您有其他问题,请随时告诉我。
回复

使用道具 举报

文明发言,和谐互动
文明发言,和谐互动
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|小黑屋|首页 ( 冀ICP备2021005225号-1 ) |网站地图

GMT+8, 2025-2-9 03:50 , Processed in 0.079667 second(s), 11 queries , Gzip On, Redis On.

Powered by Discuz! X3.4

© 2001-2013 ELITE论坛【技术无价-分享快乐】

快速回复 返回顶部 返回列表