简体   繁体   中英

Lua expected = near elseif

I am getting an error being returned when trying to run an elseif requiring me to put a = near elseif but I have used the same method before and no problem as been returned.

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] and heistP[2] should be heistP[1]() and heistP[2]() . I'm assuming heistP[2]() is defined somewhere else, if not, you need to define it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM