Getting Started
Let me first show you how to install resourcemod on your CS2 server.
Install resourcemod
- Install Metamod:Source.
- Install NodeJS.
- Open
cmd
and navigate toyour_server_path/addons
folder. - Type
npx create-resourcemod-app@latest .
Done! Now start the server and enjoy javascript plugins.
Install plugin
The original idea of ResourceMod was that you do not have to install plugins by dragging and dropping files on your server. Since we were able to use a full-fledged nodejs runtime, we decided that the ideal solution would be to use npm packages as plugins for your server.
- Find a plugin. They can be here
- Run
npm i {plugin_name}
insideaddons/resourcemod/
folder. - Every plugin must have an entry point, usually a constant-anonymous function to be specified in the resourcemod.config.js file. For example like this:
resourcemod.config.js
const {useWelcomeMessages} = require('welcome-messages-plugin')
...
plugins: [
useWelcomeMessages({
prefix: "Server >",
connect: true,
disconnect: true
}),
],
Create your own plugin
Javascript is a fun language to create anything you want. ResourceMod will help you turn your idea into reality using the Source2 engine.
- Create an empty folder.
- Run
npm init
inside of it. - Create an entrypoint file (index.js by default).
- Create a single entrypoint const that server creators will call inside resourcemod.config.js file. Just like
useWelcomeMessages
from the example above. - Now you can code your own logic on top of Source 2 engine.
Before publishing the plugin to the registry, I advise you to watch a video tutorial about it.
You can also check out the example plugin, and just copy what you need from there.