Jump to content

Problem


Tekken

Recommended Posts

Hi i have a problem

In debugscript 3 i get this

bad argument #1 to 'ipairs' (table expected got nil)

Here is the script

function loadAllVehs(thePlayer) 
if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(thePlayer)), aclGetGroup("Admin")) then 
  local vehFile = xmlLoadFile ("vehs.xml") 
  if (vehFile) then 
    local vehs = xmlNodeGetChildren(vehsFile) 
    for i,v in ipairs (vehs) do 
    local model = xmlNodeGetAttribute (v, "model") 
    local x = xmlNodeGetAttribute (v, "x") 
    local y = xmlNodeGetAttribute (v, "y") 
    local z = xmlNodeGetAttribute (v, "z") 
    local rotx = xmlNodeGetAttribute (v, "rotx") 
    local roty = xmlNodeGetAttribute (v, "roty") 
    local rotz = xmlNodeGetAttribute (v, "rotz") 
    vehCol = createColSphere(x, y, z, rotx, roty, rotz) 
      attachElements(vehCol, veh, 0, 0, 0) 
      setElementData(vehCol, "parent", veh) 
      setElementData(veh, "parent", vehCol) 
      setElementData(vehCol, "vehicle", true) 
      setElementData(vehCol, "MAX_Slots", 10) 
      local tires, engine, parts = getVehicleAddonInfos(getElementModel(veh)) 
      setElementData(vehCol, "Tire_inVehicle", 4) 
      setElementData(vehCol, "Engine_inVehicle", 1) 
      setElementData(vehCol, "Parts_inVehicle", 1) 
      setElementData(vehCol, "spawn", { 
        model, 
        x, 
        y, 
        z 
      }) 
      setElementData(vehCol, "fuel", 100)-- 
function getVehicleAddonInfos(id) 
  for i, veh in ipairs(vehicleAddonsInfo) do 
    if veh[1] == id then 
      return veh[2], veh[3], veh[4] 
    end 
  end 
end 
vehicleFuelInfo = { 
  {470, 0.1} 
} 
function getVehicleAddonInfos(id) 
  for i, veh in ipairs(vehicleAddonsInfo) do 
    if veh[1] == id then 
      return veh[2], veh[3], veh[4] 
    end 
  end 
end 
vehicleFuelTable = { 
  {470, 100} 
} 
function getVehicleMaxFuel(loot) 
  local modelID = getElementModel(getElementData(loot, "parent")) 
  for i, vehicle in ipairs(vehicleFuelTable) do 
    if modelID == vehicle[1] then 
      return vehicle[2] 
    end 
  end 
  return false 
end 
function onPlayerEnterDayzVehicle(veh, seat) 
  local col = getElementData(dayZVeh, "parent") 
  local id = getElementModel(dayZVeh) 
  if not seat == 1 then 
    return 
  end 
  local tires, engine, parts = getVehicleAddonInfos(id) 
  setVehicleEngineState(dayZVeh, false) 
  setElementData(dayZVeh, "maxfuel", getVehicleMaxFuel(col)) 
  setElementData(dayZVeh, "needtires", tires) 
  setElementData(dayZVeh, "needengines", engine) 
  setElementData(dayZVeh, "needparts", parts) 
  if getElementData(col, "Tire_inVehicle") or 0 < tonumber(tires) then 
    setVehicleEngineState(dayZVeh, false) 
    return 
  end 
  if getElementData(col, "Engine_inVehicle") or 0 < tonumber(engine) then 
    setVehicleEngineState(dayZVeh, false) 
    return 
  end 
  if not getElementData(col, "Parts_inVehicle") then 
    setElementData(col, "Parts_inVehicle", math.random(0, parts)) 
  end 
  if getElementData(col, "fuel") or 1 >= 0 and not getElementModel(dayZVehBob) == 509 then 
    triggerClientEvent(source, "displayClientInfo", source, "Vehicle", "No tank left in this vehicle!", 22, 255, 0) 
    setVehicleEngineState(dayZVehBob, false) 
    outputChatBox("Toate vehiculele ao fost REINCARCATE!", thePlayer, 0, 100, 255) 
    return 
  end   
end 
end 
end 
end       
end 
     
addCommandHandler("loadvehs", loadAllVehs) 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...