Lua 脚本在第 448 行出现错误,在脚本末尾,我需要添加什么来结束脚本?

我在这个 Lua 脚本的末尾出现了一个错误,我不知道该如何结束这个脚本,错误信息如下

[脚本错误] https://i.stack.imgur.com/7BU2x.png

这里是从第 375 行到脚本末尾的内容。我不明白我应该如何结束这个脚本。我很新于编程,Lua 是我尝试学习的第一种语言。我会编辑免费脚本,以符合我的 FiveM GTA RP 服务器的需要,但我不知道如何结束这一切。感谢任何帮助,非常感激!:)

if dist <= 1 and not isProcessing then
            sleep = 5
            DrawText3D(process.x, process.y, process.z, '~b~E~w~ - Process Meth')
            if IsControlJustPressed(1, 51) then
                isProcessing = true
                RegisterNetEvent('qb-coke:MakeMeth',function()
                    QBCore.Functions.TriggerCallback("qb-meth:getMeth",function(mix)
                        if mix then
                            QBCore.Functions.Progressbar('making_meth', 'Making Meth', 15000, false, true, {
                                disableMovement = true,
                                disableCarMovement = true,
                                disableMouse = false,
                                disableCombat = true,
                            }, {}, {}, {}, function()
                                TriggerServerEvent('qb-meth:processed')
                                ClearPedTasks(PlayerPedId())
                            end, function() -- 取消
                                TriggerEvent('inventory:client:busy:status', false)
                                QBCore.Functions.Notify("Cancelled..", "error")
                            end)
                        else
                            QBCore.Functions.Notify("You don't have all ingredients!", "error")
                        end
                    end)
                end)

function processing()
    local player = PlayerPedId()
    SetEntityCoords(player, process.x,process.y,process.z-1, 0.0, 0.0, 0.0, false)
    SetEntityHeading(player, 160.84)
    FreezeEntityPosition(player, true)
    playAnim("anim@amb@clubhouse@tutorial@bkr_tut_ig3@", "machinic_loop_mechandplayer", 30000)

    QBCore.Functions.Progressbar("meth-", "Making Meth", 0000, false, true, {
        disableMovement = true,
        disableCarMovement = true,
        disableMouse = false,
        disableCombat = true,
    }, {}, {}, {}, function() -- 完成
        FreezeEntityPosition(player, false)
        LocalPlayer.state:set("inv_busy", false, true)
        TriggerServerEvent('qb-meth:processed')
        isProcessing = false
    end, function() -- 取消
        isProcessing = false
        ClearPedTasksImmediately(player)
        FreezeEntityPosition(player, false)
    end)

end

function cooldown()
    Citizen.Wait(200)
    TriggerServerEvent('qb-meth:updateTable', false)
end

function playAnimPed(animDict, animName, duration, buyer, x,y,z)
    RequestAnimDict(animDict)
    while not HasAnimDictLoaded(animDict) do
      Citizen.Wait(0)
    end
    TaskPlayAnim(pilot, animDict, animName, 1.0, -1.0, duration, 49, 1, false, false, false)
    RemoveAnimDict(animDict)
end

    function playAnim(animDict, animName, duration)
        RequestAnimDict(animDict)
        while not HasAnimDictLoaded(animDict) do
          Citizen.Wait(0)
        end
     TaskPlayAnim(PlayerPedId(), animDict, animName, 1.0, -1.0, duration, 49, 1, false, false, false)
        RemoveAnimDict(animDict)
    end
end

原文链接 https://stackoverflow.com/questions/70359451

点赞
stackoverflow用户2858170
stackoverflow用户2858170

第一提示:错误信息。在这里唯一想到的 if 语句是 if IsControlJustPressed(1, 51) then

第二提示:代码有正确的缩进,所以很明显在该 if 语句的缩进级别下没有结束。

第三提示:你有更多需要 end 的关键字,而你没有与之匹配的 end

检查你是否能够找到每个关键字的匹配 end。从最内部的作用域开始检查。

最后你会发现你没有为 if IsControlJustPressed(1, 51) then 编写结束语句...

提示:如果你不能在脑中完成这个过程,请删除所有符合语法的代码,直到找到一个不符合语法的代码。

2021-12-15 07:39:06