function loadAllVehs(thePlayer)
if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(thePlayer)), aclGetGroup("Admin")) then
local vehFile = xmlLoadFile ("vehicles.xml")
if (vehFile) then
local veh = xmlNodeGetChildren(vehFile)
outputChatBox("Loading of vehicles was initiated!", root, 0, 100, 255)
for i,v in ipairs (veh) 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")
local veh = createVehicle(model, x, y, z)
vehCol = createColSphere(x, y, z, 2)
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", 4)
setElementData(vehCol, "Engine_inVehicle", 1)
setElementData(vehCol, "Parts_inVehicle", 3)
setElementData(vehCol, "spawn", {
model,
x,
y,
z
})
setElementData(vehCol, "fuel", 80)
end
outputChatBox("Vehicles loaded! "..#veh.."!", root, 0, 100, 255)
end
end
end
addCommandHandler("veh-load", loadAllVehs)