Search the Community
Showing results for tags 'server error'.
Found 1 result
-
Hello guys, I am trying to make a function that returns if a player is located around a marker/position at a certain radius. The first solution in my mind was to set an interval in which it checks every 5 sec or so if the player is inside the radius of a position. But if I put the json/object inside the setInterval function, the server crashes when this function is called. I know for sure the json is the problem, beacuse if i just put a console.log inside the setInterval, it works fine. Error: async hook stack has become corrupted (actual: 10, expected: 11) There's other code going on than just this piece, I thought this might be enough to see what's going. Many thanks in advance for your help. Have a great day! Erwin let positions = require('./positions.json'); function startCheckingCaps(player){ setInterval(function(){ positions.cap.forEach(function(v,i){ if (inRadius(v)){ //inRadius checks if player.position is inside the radius of the current position 'v' player.notify("capturing " + v.name); } else { player.notify("not capturing"); } }); //console.log("if its just this in setInterval, it works just fine."); }, 5000); } mp.events.add('playerJoin', (player) => { startCheckingCaps(player); //<------------------------- this is the one from above });
- 1 reply
-
- javascript
- server error
-
(and 1 more)
Tagged with:
