Jump to content

Recommended Posts

Posted

Hello, I have a server on localhost that I have been working on for some time, yesterday I uploaded it to a Linux host and everything works fine, except for a serverside package where I get an error.

The package loads, but after the message "[DONE] The server is ready to accept connections." from console, i get crash with below error.

 

TypeError: mp.vehicles.forEach is not a function
    at setVehPosition (/home/container/packages/s_music/index.js:14:17)
    at Timeout._onTimeout (/home/container/packages/s_music/index.js:3:24)
    at listOnTimeout (internal/timers.js:554:17)
    at processTimers (internal/timers.js:497:7)

The code:

setInterval(function(){setVehPosition();},100);

function setVehPosition() {
    mp.vehicles.forEach((veh) => {
......

Basically, I use an interval of 100ms, and the function is the one below, where I apply some variables to the vehicles. Why do I get this error?

Thanks!

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