seelrd Posted September 18, 2018 Posted September 18, 2018 (edited) Hello, As you can see on the following image, RageMP server thinks it is started twice (or more times) using a nodejs module called threads.js: Click here to view the image. const spawn = require('threads').spawn; spawn("test.js"); Run the code above in a package with something in the test.js file and RageMP will behave in a quite strange way. Edited September 18, 2018 by seelrd
seelrd Posted September 18, 2018 Author Posted September 18, 2018 When I do it on the clientside, GTA V crashes.
seelrd Posted September 19, 2018 Author Posted September 19, 2018 Information The reason why threads.js would be good is the following: server developers would be able to start and stop resources (JS files) while running the server, so they wouldn't need to restart the server to replace the scripts. This makes installing updates (like bugfixes) possible with players on the server (without kicking them). I want to create a system like Multi Theft Auto (San Andreas) where you can dynamically start and stop resources.
ragempdev Posted September 19, 2018 Posted September 19, 2018 20 hours ago, seelrd said: As you can see on the following image, RageMP server thinks it is started twice (or more times) It doesn't just think so, threads.js actually starts multiple process instances.
seelrd Posted September 19, 2018 Author Posted September 19, 2018 (edited) Isn't it possible to have multiple nodejs children processes having only the main one directly attached to RageMP? (Or it would also be awesome to have some other way to restart packages/scripts without restarting the server like with thread.kill().) Edited September 19, 2018 by seelrd
seelrd Posted September 19, 2018 Author Posted September 19, 2018 For example, the most popular Grand Theft Auto multiplayer modification, Multi Theft Auto (San Andreas) has resources (with server developers' scripts) that can be started and stopped any time while the server is running. That's why we wanted something like that in RageMP. Thank you for your answers.
ragempdev Posted September 19, 2018 Posted September 19, 2018 5 minutes ago, seelrd said: has resources (with server developers' scripts) that can be started and stopped any time while the server is running. That's why we wanted something like that in RageMP. What does it have with threads.js? Use shouldn't use it for this purpose as it's for different kind of things.
seelrd Posted September 19, 2018 Author Posted September 19, 2018 (edited) It seemed to be the easiest solution of completely shutting down a running script. Deleting the cache of a script loaded with require() doesn't stop (for example) the timers and event handlers in the loaded script. Another way can be if all of the scripts loaded with require() have a function that has to be called to stop/unload everything, but doing that takes much more time (of the developers' time). Do you have some idea how to do that? Edited September 19, 2018 by seelrd
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