1LoL1

Please Help me :(((

Recommended Posts

Hello community, I have the problem that when last I'll turn / restart this script or I will restart the server so all the cars disappear .. did not anyone help? a script to do it imposed cars after restarting and closing script please? Here is the script:

Barracks:

function SpawnDayZBarracks(thePlayer) 
  accountname = getAccountName(getPlayerAccount(thePlayer)) 
  if isObjectInACLGroup("user." .. accountname, aclGetGroup("Admin")) then 
    do 
      local x, y, z = getElementPosition(thePlayer) 
      veh = createVehicle(433, x + 5, y, z) 
      vehCol = createColSphere(x + 5, y, z, 4) 
      attachElements(vehCol, veh, 0, 0, 0) 
      setElementData(vehCol, "parent", veh) 
      setElementData(veh, "parent", vehCol) 
      setElementData(vehCol, "vehicle", true) 
      setElementData(vehCol, "MAX_Slots", 64) 
      local tires, engine, parts = getVehicleAddonInfos(getElementModel(veh)) 
      setElementData(vehCol, "Tire_inVehicle", 6) 
      setElementData(vehCol, "Engine_inVehicle", 1) 
      setElementData(vehCol, "Parts_inVehicle", 1) 
      setElementData(vehCol, "spawn", { 
        433, 
        x, 
        y, 
        z 
      }) 
      setElementData(vehCol, "fuel", 140) 
      setTimer(outputChatBox, 50, 1, "", thePlayer, 171, 205, 239, true) 
    end 
  else 
    outputChatBox("", thePlayer, 171, 205, 239, true) 
  end 
end 
addCommandHandler("/barown", SpawnDayZBarracks) 
vehicleAddonsInfo = { 
  { 
    433, 
    6, 
    1, 
    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 
vehicleFuelInfo = { 
  {433, 0.5} 
} 
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 = { 
  {433, 140} 
} 
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) 
    return 
  end 
end 

Bike:

function SpawnDayZBike(thePlayer) 
  accountname = getAccountName(getPlayerAccount(thePlayer)) 
  if isObjectInACLGroup("user." .. accountname, aclGetGroup("Admin")) then 
    do 
      local x, y, z = getElementPosition(thePlayer) 
      veh = createVehicle(509, x + 5, y, z) 
      vehCol = createColSphere(x + 5, y, z, 4) 
      attachElements(vehCol, veh, 0, 0, 0) 
      setElementData(vehCol, "parent", veh) 
      setElementData(veh, "parent", vehCol) 
      setElementData(vehCol, "vehicle", true) 
      setElementData(vehCol, "MAX_Slots", 0) 
      local tires, engine, parts = getVehicleAddonInfos(getElementModel(veh)) 
      setElementData(vehCol, "Tire_inVehicle", 0) 
      setElementData(vehCol, "Engine_inVehicle", 0) 
      setElementData(vehCol, "Parts_inVehicle", 0) 
      setElementData(vehCol, "spawn", { 
        509, 
        x, 
        y, 
        z 
      }) 
      setElementData(vehCol, "fuel", 0) 
      setTimer(outputChatBox, 50, 1, "", thePlayer, 171, 205, 239, true) 
    end 
  else 
    outputChatBox("", thePlayer, 171, 205, 239, true) 
  end 
end 
addCommandHandler("/bikeown", SpawnDayZBike) 
vehicleAddonsInfo = { 
  { 
    509, 
    0, 
    0, 
    0 
  } 
} 
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 = { 
  {509, 0} 
} 
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 = { 
  {509, 0} 
} 
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) 
    return 
  end 
end 

Bobcat:

function SpawnDayZBob(thePlayer) 
  accountname = getAccountName(getPlayerAccount(thePlayer)) 
  if isObjectInACLGroup("user." .. accountname, aclGetGroup("Admin")) then 
    do 
      local x, y, z = getElementPosition(thePlayer) 
      veh = createVehicle(422, x + 5, y, z) 
      vehCol = createColSphere(x + 5, y, z, 4) 
      attachElements(vehCol, veh, 0, 0, 0) 
      setElementData(vehCol, "parent", veh) 
      setElementData(veh, "parent", vehCol) 
      setElementData(vehCol, "vehicle", true) 
      setElementData(vehCol, "MAX_Slots", 20) 
      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", { 
        422, 
        x, 
        y, 
        z 
      }) 
      setElementData(vehCol, "fuel", 80) 
      setTimer(outputChatBox, 50, 1, "", thePlayer, 171, 205, 239, true) 
    end 
  else 
    outputChatBox("", thePlayer, 171, 205, 239, true) 
  end 
end 
addCommandHandler("/bobown", SpawnDayZBob) 
vehicleAddonsInfo = { 
  { 
    422, 
    4, 
    1, 
    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 
vehicleFuelInfo = { 
  {422, 0.25} 
} 
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 = { 
  {422, 80} 
} 
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 onPlayerEnterdayZVehBobicle(veh, seat) 
  local col = getElementData(dayZVehBob, "parent") 
  local id = getElementModel(dayZVehBob) 
  if not seat == 1 then 
    return 
  end 
  local tires, engine, parts = getVehicleAddonInfos(id) 
  setVehicleEngineState(dayZVehBob, false) 
  setElementData(dayZVehBob, "maxfuel", getVehicleMaxFuel(col)) 
  setElementData(dayZVehBob, "needtires", tires) 
  setElementData(dayZVehBob, "needengines", engine) 
  setElementData(dayZVehBob, "needparts", parts) 
  if getElementData(col, "Tire_inVehicle") or 0 < tonumber(tires) then 
    setVehicleEngineState(dayZVehBob, false) 
    return 
  end 
  if getElementData(col, "Engine_inVehicle") or 0 < tonumber(engine) then 
    setVehicleEngineState(dayZVehBob, 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) 
    return 
  end 
end 

Boot:

function SpawnDayZBoot(thePlayer) 
  accountname = getAccountName(getPlayerAccount(thePlayer)) 
  if isObjectInACLGroup("user." .. accountname, aclGetGroup("Admin")) then 
    do 
      local x, y, z = getElementPosition(thePlayer) 
      veh = createVehicle(453, x + 5, y, z) 
      vehCol = createColSphere(x + 5, y, z, 4) 
      attachElements(vehCol, veh, 0, 0, 0) 
      setElementData(vehCol, "parent", veh) 
      setElementData(veh, "parent", vehCol) 
      setElementData(vehCol, "vehicle", true) 
      setElementData(vehCol, "MAX_Slots", 30) 
      local tires, engine, parts = getVehicleAddonInfos(getElementModel(veh)) 
      setElementData(vehCol, "Tire_inVehicle", 0) 
      setElementData(vehCol, "Engine_inVehicle", 1) 
      setElementData(vehCol, "Parts_inVehicle", 1) 
      setElementData(vehCol, "spawn", { 
        453, 
        x, 
        y, 
        z 
      }) 
      setElementData(vehCol, "fuel", 60) 
      setTimer(outputChatBox, 50, 1, "", thePlayer, 171, 205, 239, true) 
    end 
  else 
    outputChatBox("", thePlayer, 171, 205, 239, true) 
  end 
end 
addCommandHandler("/fishown", SpawnDayZBoot) 
vehicleAddonsInfo = { 
  { 
    453, 
    0, 
    1, 
    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 
vehicleFuelInfo = { 
  {453, 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 = { 
  {453, 60} 
} 
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) 
    return 
  end 
end 

Coach:

function SpawnDayZCoach(thePlayer) 
  accountname = getAccountName(getPlayerAccount(thePlayer)) 
  if isObjectInACLGroup("user." .. accountname, aclGetGroup("Admin")) then 
    do 
      local x, y, z = getElementPosition(thePlayer) 
      veh = createVehicle(437, x + 5, y, z) 
      vehCol = createColSphere(x + 5, y, z, 4) 
      attachElements(vehCol, veh, 0, 0, 0) 
      setElementData(vehCol, "parent", veh) 
      setElementData(veh, "parent", vehCol) 
      setElementData(vehCol, "vehicle", true) 
      setElementData(vehCol, "MAX_Slots", 56) 
      local tires, engine, parts = getVehicleAddonInfos(getElementModel(veh)) 
      setElementData(vehCol, "Tire_inVehicle", 6) 
      setElementData(vehCol, "Engine_inVehicle", 1) 
      setElementData(vehCol, "Parts_inVehicle", 1) 
      setElementData(vehCol, "spawn", { 
        437, 
        x, 
        y, 
        z 
      }) 
      setElementData(vehCol, "fuel", 140) 
      setTimer(outputChatBox, 50, 1, "", thePlayer, 171, 205, 239, true) 
    end 
  else 
    outputChatBox("", thePlayer, 171, 205, 239, true) 
  end 
end 
addCommandHandler("/busown", SpawnDayZCoach) 
vehicleAddonsInfo = { 
  { 
    437, 
    6, 
    1, 
    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 
vehicleFuelInfo = { 
  {437, 0.5} 
} 
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 = { 
  {437, 140} 
} 
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) 
    return 
  end 
end 

Maverick:

function SpawnDayZMaverick(thePlayer) 
  accountname = getAccountName(getPlayerAccount(thePlayer)) 
  if isObjectInACLGroup("user." .. accountname, aclGetGroup("Admin")) then 
    do 
      local x, y, z = getElementPosition(thePlayer) 
      veh = createVehicle(487, x + 5, y, z) 
      vehCol = createColSphere(x + 5, y, z, 4) 
      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", 0) 
      setElementData(vehCol, "Engine_inVehicle", 1) 
      setElementData(vehCol, "Parts_inVehicle", 1) 
      setElementData(vehCol, "spawn", { 
        487, 
        x, 
        y, 
        z 
      }) 
      setElementData(vehCol, "fuel", 60) 
      setTimer(outputChatBox, 50, 1, "", thePlayer, 171, 205, 239, true) 
    end 
  else 
    outputChatBox("", thePlayer, 171, 205, 239, true) 
  end 
end 
addCommandHandler("/mavown", SpawnDayZMaverick) 
vehicleAddonsInfo = { 
  { 
    487, 
    0, 
    1, 
    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 
vehicleFuelInfo = { 
  {487, 0.25} 
} 
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 = { 
  {487, 60} 
} 
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) 
    return 
  end 
end 

Patriot:

function SpawnDayZPatriot(thePlayer) 
  accountname = getAccountName(getPlayerAccount(thePlayer)) 
  if isObjectInACLGroup("user." .. accountname, aclGetGroup("Admin")) then 
    do 
      local x, y, z = getElementPosition(thePlayer) 
      veh = createVehicle(470, x + 5, y, z) 
      vehCol = createColSphere(x + 5, y, z, 4) 
      attachElements(vehCol, veh, 0, 0, 0) 
      setElementData(vehCol, "parent", veh) 
      setElementData(veh, "parent", vehCol) 
      setElementData(vehCol, "vehicle", true) 
      setElementData(vehCol, "MAX_Slots", 38) 
      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", { 
        487, 
        x, 
        y, 
        z 
      }) 
      setElementData(vehCol, "fuel", 100) 
      setTimer(outputChatBox, 50, 1, "", thePlayer, 171, 205, 239, true) 
    end 
  else 
    outputChatBox("", thePlayer, 171, 205, 239, true) 
  end 
end 
addCommandHandler("/LLpatriot", SpawnDayZPatriot) 
vehicleAddonsInfo = { 
  { 
    470, 
    4, 
    1, 
    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 
vehicleFuelInfo = { 
  {470, 0.25} 
} 
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, 60} 
} 
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) 
    return 
  end 
end 

Police Maverick:

function SpawnDayZPMaverick(thePlayer) 
  accountname = getAccountName(getPlayerAccount(thePlayer)) 
  if isObjectInACLGroup("user." .. accountname, aclGetGroup("Admin")) then 
    do 
      local x, y, z = getElementPosition(thePlayer) 
      veh = createVehicle(497, x + 5, y, z) 
      vehCol = createColSphere(x + 5, y, z, 4) 
      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", 0) 
      setElementData(vehCol, "Engine_inVehicle", 1) 
      setElementData(vehCol, "Parts_inVehicle", 1) 
      setElementData(vehCol, "spawn", { 
        497, 
        x, 
        y, 
        z 
      }) 
      setElementData(vehCol, "fuel", 60) 
      setTimer(outputChatBox, 50, 1, "", thePlayer, 171, 205, 239, true) 
    end 
  else 
    outputChatBox("", thePlayer, 171, 205, 239, true) 
  end 
end 
addCommandHandler("/pmavown", SpawnDayZPMaverick) 
vehicleAddonsInfo = { 
  { 
    497, 
    0, 
    1, 
    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 
vehicleFuelInfo = { 
  {497, 0.25} 
} 
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 = { 
  {497, 60} 
} 
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) 
    return 
  end 
end 

Sanchez:

function SpawnDayZSanchez(thePlayer) 
  accountname = getAccountName(getPlayerAccount(thePlayer)) 
  if isObjectInACLGroup("user." .. accountname, aclGetGroup("Admin")) then 
    do 
      local x, y, z = getElementPosition(thePlayer) 
      veh = createVehicle(468, x + 5, y, z) 
      vehCol = createColSphere(x + 5, y, z, 4) 
      attachElements(vehCol, veh, 0, 0, 0) 
      setElementData(vehCol, "parent", veh) 
      setElementData(veh, "parent", vehCol) 
      setElementData(vehCol, "vehicle", true) 
      setElementData(vehCol, "MAX_Slots", 6) 
      local tires, engine, parts = getVehicleAddonInfos(getElementModel(veh)) 
      setElementData(vehCol, "Tire_inVehicle", 2) 
      setElementData(vehCol, "Engine_inVehicle", 1) 
      setElementData(vehCol, "Parts_inVehicle", 1) 
      setElementData(vehCol, "spawn", { 
        468, 
        x, 
        y, 
        z 
      }) 
      setElementData(vehCol, "fuel", 30) 
      setTimer(outputChatBox, 50, 1, "", thePlayer, 171, 205, 239, true) 
    end 
  else 
    outputChatBox("", thePlayer, 171, 205, 239, true) 
  end 
end 
addCommandHandler("/sanchezown", SpawnDayZls) 
vehicleAddonsInfo = { 
  { 
    468, 
    2, 
    1, 
    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 
vehicleFuelInfo = { 
  {468, 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 = { 
  {468, 80} 
} 
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) 
    return 
  end 
end 

and Command_Editor:

addCommandHandler("LLsanchez",SpawnDayZSanchez) 
addCommandHandler("LLpmaverick",SpawnDayZPMaverick) 
addCommandHandler("LLpatriot",SpawnDayZPatriot) 
addCommandHandler("LLmadic",SpawnDayZMedic) 
addCommandHandler("LLmaverick",SpawnDayZMaverick) 
addCommandHandler("LLcoac",SpawnDayZCoach) 
addCommandHandler("LLcoach",SpawnDayZCoach) 
addCommandHandler("LLboot",SpawnDayZBoot) 
addCommandHandler("LLbobcat",SpawnDayZBob) 
addCommandHandler("LLbike",SpawnDayZBike) 
addCommandHandler("LLbarracks",SpawnDayZBarracks) 
  

Share this post


Link to post

comment for view

Share this post


Link to post
On 3/23/2014 at 09:20, 1LoL1 said:

Please help someone?

I did not understand what you want to say exactly.

Share this post


Link to post

March 22, 2014 lol

That guy said about car disappearing. His script creates several cars. Restarting this script makes them disappear and he asked about saving those vehicles. On my opinion, it's impossible without additional resources

Share this post


Link to post

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.