我在尝试运行一个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,
}
答案 0 :(得分:1)
heistP[1]
和heistP[2]
应为heistP[1]()
和heistP[2]()
。我假设heistP[2]()
被定义在其他地方,如果没有,你需要定义它。