hdesk Posted July 14, 2021 Posted July 14, 2021 Hello, I want some vehicles to be streamed across the map when the server starts. These vehicles are going to be the ones players will be using to get around, therefore I not only want them to be streamed but every 30 minutes or so respawned to where they were if they are unoccupied. How do I do that? So far, this is what I have (attempt with one vehicle first): mp.events.add('packagesLoaded', () => { console.log('Loading Cars...'); mp.vehicles.new(mp.joaat('prairie'), carSpawns[0]); }); I am wondering if this is the best way to do this? Eventually there will be a for loop to loop through all vehicles and carSpawn points. Is there a way to stream the vehicles across the map like on SAMP?
pervik2k Posted July 20, 2021 Posted July 20, 2021 var fs = require("fs"); let file = "cars.json"; var data = fs.readFileSync(file); var json = JSON.parse(data); json.forEach((e) => { let car = mp.vehicles.new(e.name,e.pos, { numberPlate: e.plate, color: [[255,255,255],[0,0,0]], locked: true, engine: false }); });
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