Jump to content

How to run client scripts ?


Recommended Posts

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

ahah ..  Got it :D

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

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