![](/img/trans.png)
[英]lua - main.lua:18: 'end' expected (to close 'function' at line 12) near 'elseif'
[英]Lua expected = near elseif
嘗試運行elseif時,要求我在elseif附近放置=,但返回錯誤,但是我之前使用過相同的方法,並且沒有返回問題。
if ((GAMEPLAY.GET_DISTANCE_BETWEEN_COORDS( -629.99, -236.542, 38.05 , location.x, location.y, location.z, true ) < 2 )) then
setMessage("Press E to start the heist.")
--SelectPart(1) --start
heistP[1]
elseif ((startH == true) and (jewelPart == false) and (escape == false) and (dropoffP == false)) then
heistP[2]
--SelectPart(2) --loadBlips
elseif ((jewelPart == true) and (escape == false) and (dropoffP == false)) then
--SelectPart(3) -- Jewels
elseif ((escape == true) and (dropoffP == false)) then
setMessage("Escape the cops!")
--SelectPart(4) --EscapeC
elseif (dropoffP == true) then
--SelectPart(5) --DropOff
end
heistP = {
[1] = function()
local playerPed = PLAYER.PLAYER_PED_ID()
local location = ENTITY.GET_ENTITY_COORDS(playerPed, nil)
if(get_key_pressed(Keys.E))then
PLAYER.SET_PLAYER_WANTED_LEVEL(PLAYER.GET_PLAYER_PED(playerPed),3,false)
--PLAYER.SET_PLAYER_WANTED_LEVEL_NOW(PLAYER.GET_PLAYER_PED(playerPed),false)
PED.SET_PED_COMPONENT_VARIATION(playerPed, 9, 1, 0, 0)
startH = true
end
end,
}
heistP[1]
和heistP[2]
應該分別是heistP[1]()
和heistP[2]()
。 我假設heistP[2]()
在其他地方定義,如果沒有定義,則需要定義它。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.