He$h Posted January 22, 2018 Share Posted January 22, 2018 hi all . how can i make the server to run a .js script as client script ?? for example this code is inside a .js file , and i want it to be run as a client script .. how do i do that ? which folder do i put it in ? should i declare this file as client script in the 'index.js' or does it run automaticly ? mp.events.add('render', () => { mp.game.graphics.drawText('This is called every frame.', [0.5, 0.005], { font: 4, color: [255, 255, 255, 255], scale: [1.0, 1.0], outline: true }); }); Link to comment Share on other sites More sharing options...
JennyMatrix Posted January 24, 2018 Share Posted January 24, 2018 @ragempdev, please, answer to this. I have same problem. If i put my client code in first file (/events.js, for example) it works. If i put same code in second file (/folder/file.js), it doesn't work; Help! Link to comment Share on other sites More sharing options...
stawiara Posted January 24, 2018 Share Posted January 24, 2018 (edited) I solved this so that the basic folder I made the index.js file and put the following code in it require ('folder/index.js'); And then in the folder you can already name the js file Edited January 24, 2018 by stawiara Link to comment Share on other sites More sharing options...
JennyMatrix Posted January 24, 2018 Share Posted January 24, 2018 @stawiara, it works only in server package. The client package folder have .listcache file, where writes all client files (I think). Link to comment Share on other sites More sharing options...
stawiara Posted January 24, 2018 Share Posted January 24, 2018 For me it works normally on the client side and the list itself updates itself probably after the server is started Link to comment Share on other sites More sharing options...
He$h Posted January 25, 2018 Author Share Posted January 25, 2018 ahah .. Got it just like you put .js files and index.js file in packages for the server , you need to create a js file named "index.js" exactly in the 'client_packages' folder .. and you can write your codes in other .js files and require them in 'index.js' . for example : in folder 'client_packages' there is "index.js" and there is "mycode.js" you write your codes in "mycode.js" , and in the "index'js" you write : require("./mycode.js") and it work perfectly .. Link to comment Share on other sites More sharing options...
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