.lua错误'然后'预计在'其他'附近

时间:2017-08-27 01:28:37

标签: lua

我遇到此错误,无法找到错误。

    local choice_revive = {function(player,choice)
  local user_id = vRP.getUserId(player)
  if user_id ~= nil then
    vRPclient.getNearestPlayer(player,{10},function(nplayer)
      local nuser_id = vRP.getUserId(nplayer)
      if nuser_id ~= nil then
        vRPclient.isInComa(nplayer,{}, function(in_coma)
          if in_coma then
            if vRP.tryGetInventoryItem(user_id,"medkit",1,true) else
            vRP.tryGetInventoryItem(user_id,"smartwatch",1,true)
            io.write("Smartwatch: Tilkalder Ambulance")
                then
              vRPclient.playAnim(player,{false,revive_seq,false}) -- anim
              SetTimeout(15000, function()
                vRPclient.varyHealth(nplayer,{50}) -- heal 50
              end)
            end
          else
            vRPclient.notify(player,{lang.emergency.menu.revive.not_in_coma()})
          end
        end)
      else
        vRPclient.notify(player,{lang.common.no_player_near()})
      end
    end)
  end
end,lang.emergency.menu.revive.description()}

我试图制作,并寻找错误,但没有运气。 - 如果有人可以解决,请告诉我。

1 个答案:

答案 0 :(得分:1)

if语句,函数和for语句必须以结束结束。

此代码必须像那样

--Settings--
local Tunnel = module("vrp", "lib/Tunnel")
local Proxy = module("vrp", "lib/Proxy")

vRP = Proxy.getInterface("vRP")
vRPclient = Tunnel.getInterface("vRP","vRP_smartwatch")

if in_coma then
    vRP.tryGetInventoryItem(user_id,"smartwatch",1,true)
    io.write("Smartwatch: Tilkalder Ambulance")
end
function vRP.sendServiceAlert(sender, emergency,x,y,z, msg)
  local service = services[service_name]
  local answered = false
  if service then
    local players = {}
    for k,v in pairs(vRP.rusers) do
      local player = vRP.getUserSource(tonumber(k))
      -- check user
      if vRP.hasPermission(k,service.alert_permission) and player ~= nil then
        table.insert(players,player)
      end
    end
  end
end