domez_z Posted October 9, 2016 Share Posted October 9, 2016 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
Mr.Loki Posted October 9, 2016 Share Posted October 9, 2016 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
domez_z Posted October 10, 2016 Author Share Posted October 10, 2016 Thanks for the post, but i didnt get it. Im new with it and can you guide me a bit? Please. Since it was pretty rando mthat i setuped up my server, please:) Link to comment
Gravestone Posted October 10, 2016 Share Posted October 10, 2016 (edited) 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 // Edited October 10, 2016 by Gravestone 1 Link to comment
domez_z Posted October 10, 2016 Author Share Posted October 10, 2016 Yeah, but i dont know where to put that command. Link to comment
Gravestone Posted October 10, 2016 Share Posted October 10, 2016 12 minutes ago, domez_z said: Yeah, but i dont know where to put that command. You just have to add this code client sided and declare the file in the meta.xml of the resource. Start the resource and type /getpos. If I didn't understand you well, please explain 'put' a bit more. Link to comment
domez_z Posted October 10, 2016 Author Share Posted October 10, 2016 (edited) 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 : 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' should i paste it in dayz? vehicles. lua? or where? Edited October 10, 2016 by domez_z Link to comment
Gravestone Posted October 10, 2016 Share Posted October 10, 2016 If the vehicles.lua file is client sided, then yeah, paste this code in there. Link to comment
domez_z Posted October 10, 2016 Author Share Posted October 10, 2016 I guess it doesnt work. Can i do it somehow different? Dunno where to paste it ,when not in vehicles.lua. And dont know what client sided means. Link to comment
Gravestone Posted October 10, 2016 Share Posted October 10, 2016 Before starting off with your server, I suggest you to have a better understanding of lua and MTA coding. Visit lua website and MTA Wik. Link to comment
domez_z Posted October 10, 2016 Author Share Posted October 10, 2016 Everything to me was explained. And i did pretty good job. :-< And this is the last step to have it complete. Link to comment
Gravestone Posted October 10, 2016 Share Posted October 10, 2016 Client and server sided description Link to comment
domez_z Posted October 10, 2016 Author Share Posted October 10, 2016 i did it and it looks like this = https://ctrlv.cz/CUvB you can see the last patriot, but it didnt spawn, whats wrong then? (GETPOS WORKS, BTW!) BUT I NEED TO SPAWN THEM NOW! Link to comment
Gravestone Posted October 11, 2016 Share Posted October 11, 2016 9 hours ago, domez_z said: i did it and it looks like this = https://ctrlv.cz/CUvB you can see the last patriot, but it didnt spawn, whats wrong then? (GETPOS WORKS, BTW!) BUT I NEED TO SPAWN THEM NOW! Post the full code. Link to comment
domez_z Posted October 11, 2016 Author Share Posted October 11, 2016 (edited) 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 October 11, 2016 by domez_z Link to comment
Gravestone Posted October 11, 2016 Share Posted October 11, 2016 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
domez_z Posted October 11, 2016 Author Share Posted October 11, 2016 it didnt help, my cars just were gone, so i had to backup my vehicles basically. so its okay now and some1 told me that it will spawn after item respawn, can i somehow change it to do it faster? (the loot respawn - and where if possible) Link to comment
Gravestone Posted October 12, 2016 Share Posted October 12, 2016 You mean respawning the vehicle after exploding? If so, use setVehicleRespawnDelay. Link to comment
Mr.Loki Posted October 12, 2016 Share Posted October 12, 2016 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
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now