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() -- 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

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

第二个提示:代码被适当地缩进,所以很明显if语句的缩进级别没有结束。

第三个提示:需要end的关键字比需要end的关键字多。

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

最后你会发现if IsControlJustPressed(1, 51) then没有终点。。。

小贴士:如果你脑子里不能做到这一点,删除所有语法正确的东西,直到你发现不正确的东西。

最新更新