0

我在这个 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() -- Cancel
                                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() -- Done
        FreezeEntityPosition(player, false)
        LocalPlayer.state:set("inv_busy", false, true)
        TriggerServerEvent('qb-meth:processed')
        isProcessing = false
    end, function() -- Cancel
        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
4

1 回答 1

1

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

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

第三个提示:需要 a 的关键词end比需要ends 的关键词多。

检查您是否找到每个关键字的匹配端。从最里面的范围开始执行此操作。

到最后你会发现你没有尽头if IsControlJustPressed(1, 51) then...

提示:如果您无法在脑海中执行此操作,请删除所有语法正确的内容,直到找到不正确的内容。

于 2021-12-15T07:39:06.483 回答