Adding a Resource to your Server

So, you've created your first resource! Now you need to tell the server to load it. You can do this by opening your server.cfg

name: "TestServer",
host: "0.0.0.0", # Leave this alone. 4 0's binds to ANY IP ADDRESS.
port: 7788,
players: 1024,
#password: "verysecurepassword",
announce: false,
#token: no-token,
gamemode: "Freeroam",
website: "test.com",
language: "en",
description: "test",
debug: true, # Make sure this is set to true.
modules: [
  "js-module",
],
resources: [
  example # We put the name of our resouce we created here
],
tags: ["Freeroam"],

Inside of resources: [] we put the name of our resource, which we created in the previous article. We used example so will put that in above.

The name needs to match what your called your resource or it will not work!

Turn on Debug Mode

If you are developing your server you will always want to turn on debug mode inside of your server.cfg. This can be done by adding debug: true to your server.cfg. You may see an example of this in the above code block.

Verifiying the Resource Loaded

We now need to check the resource loaded correctly. We can do this by simply running the server as explained here.

The console in the image above outputted Hello from server, this confirms to us that the server has loaded the resource correctly and the resource is working as it should.

If the console did not output anything, retry the previous step and try again!

Connecting

You can connect to your server at any time by opening alt:V and then putting in 127.0.0.1:7788 to connect to your local server. 127.0.0.1 means localhost for most computers. 7788 is the default port for alt:V Servers.

Written by Stuyk & Alexa

results matching ""

    No results matching ""