Jump to content

DAYZ VEHICLES AUTO SPAWN (vehicles.lua)


domez_z

Recommended Posts

Hello guys, i recently setuped up my own dayz server, but i need to add like more vehicles i have some vehicles.lua and there are cars adn ther x,y,z i guess its spawn how can i add more? or can some1 just give me some pre-scripted vehicles.lua so i dont have to type it or something? i want more cars on my server basicaly , which players can find and get :)

Link to comment
function position()
    local x,y,z = getElementPosition(localPlayer)
    outputChatBox(x..", "..y..", "..z+.5, 0, 255, 0)
    setClipboard(x..", "..y..", "..z+.5)
    outputChatBox("Position has been copied to your clipboard.", 0, 255, 0)
end
addCommandHandler("getpos",position)

To get more spawn positions just go where u want a vehicle to spawn and use the command and paste it into when vehicle table.

Don't forget to add the vehicle ID before the first comma so it should look like: {vehicleID, x, y, z}

Link to comment

Here's the same function with comments.

function position()
	local x,y,z = getElementPosition(localPlayer) -- this will get the position of the player in 'x, y, z' who types the /getpos command
	outputChatBox(x..", "..y..", "..z+.5, 0, 255, 0) -- this will output the position to the chatbox
	setClipboard(x..", "..y..", "..z+.5) -- this will copy the position to the player's clipboard
	outputChatBox("Position has been copied to your clipboard.", 0, 255, 0) -- this will output another text to the chatbox 
end -- end the function
addCommandHandler("getpos", position) -- attach a command to the function '/getpos'

 

19 hours ago, loki2143 said:

Don't forget to add the vehicle ID before the first comma so it should look like: {vehicleID, x, y, z}

By saying this he meant that you'll have to define vehicle ID before 'x, y, z' arguments since the first argument of createVehicle is the model ID of the vehicle to be created and after that the x, y, z argument come. So it would have to be like {Vehicle model, x, y, z}. Example: {520, 0, 0, 4} <-- this will create a hydra in the middle of the GTA's map.

// Hope I was enough understandable :D //

Edited by Gravestone
  • Like 1
Link to comment

Well idk where to like put the whole script.

Should i put it in vehicles.lua to DAYZ? or where? Where do i copy and paste it?

 

This : 

  1. function position()
  2. local x,y,z = getElementPosition(localPlayer) -- this will get the position of the player in 'x, y, z' who types the /getpos command
  3. outputChatBox(x..", "..y..", "..z+.5, 0, 255, 0) -- this will output the position to the chatbox
  4. setClipboard(x..", "..y..", "..z+.5) -- this will copy the position to the player's clipboard
  5. outputChatBox("Position has been copied to your clipboard.", 0, 255, 0) -- this will output another text to the chatbox
  6. end -- end the function
  7. addCommandHandler("getpos", position) -- attach a command to the function '/getpos'

 should i paste it in dayz? vehicles. lua? or where?

Edited by domez_z
Link to comment
Quote

    --[[Bobcat]]
    {422, -2479.6240234375,2223.6669921875,4.84375},
    {422, -92.9951171875,2823.0908203125,76.721649169922},
    {422, -2448.99609375,-1335.8662109375,310.97662353516},
    {422, -173.2470703125,-2635.5341796875,26.608192443848},
    {422, 2108.447265625,-1600.916015625,13.552597045898},
    {422, 2452.7392578125,1607.9833984375,10.8203125},
    {422, -1800.8984375,-1950.9736328125,93.561332702637},
    {422, -102.14576721191, 55.276020050049, 3.609395980835},
    {422, 2008.3050537109, 2249.0886230469, 24.736904144287},
    {422, -222.03587341309, 996.23352050781, 20.101808547974},

 

Edited by domez_z
Link to comment
bobcats = {
  	{422, -2479.6240234375,2223.6669921875,4.84375},
    {422, -92.9951171875,2823.0908203125,76.721649169922},
    {422, -2448.99609375,-1335.8662109375,310.97662353516},
    {422, -173.2470703125,-2635.5341796875,26.608192443848},
    {422, 2108.447265625,-1600.916015625,13.552597045898},
    {422, 2452.7392578125,1607.9833984375,10.8203125},
    {422, -1800.8984375,-1950.9736328125,93.561332702637},
    {422, -102.14576721191, 55.276020050049, 3.609395980835},
    {422, 2008.3050537109, 2249.0886230469, 24.736904144287},
    {422, -222.03587341309, 996.23352050781, 20.101808547974}
}

for i, v in ipairs(bobcats) do
  createVehicle(unpack(v))
end  

 

Link to comment
18 hours ago, Gravestone said:

You mean respawning the vehicle after exploding? If so, use setVehicleRespawnDelay.

Dayz has its own respawning system

 

On 10/11/2016 at 0:33 PM, domez_z said:

can i somehow change it to do it faster? (the loot respawn - and where if possible)

if you want the dayz vehicles to respawn faster there are 2 things you can do

Delete the backkup database in tools/database.db

or make a command to call the function "spawnDayZVehicles"


addCommandHander("spawnvehicles",function()
  spawnDayZVehicles()
end)

also if you want the vehicles to respawn faster look for the onVehicleExplode event

there should be a timer in that function with 1800000 miliseconds = 30 minutes

change it to whatever time you want but keep it over 1 minute to be safe.

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...