Precache resources
In Source2 you need to "pre-cache" assets like models or music in order to use them on the server.
To do this, we made an array of paths to models in the resourcemod.config.js
configuration file that you need to add to set to the players.
Example of player.setModel
- Put model into csgo/models folder.
- Add model to Saido fastDL or use any other fastdl tool (like workshop).
- Open
resourcemod.config.js
file - Put a model path into
precache
array.
module.exports = {
...
precache: ['models/characters/your_model.vmdl']
}
- Set the model to player
event.onPlayerSpawn((event) => {
event.player.setModel('models/characters/your_model.vmdl')
})
Sounds
If you use Saido FastDL, then you do not need to specify a precache for sounds; you can play the sound on the client like this:
event.onPlayerSpawn((event) => {
event.player.playSound('name/repository/file.vsnd') // will play sound 'sounds/name/repository/file.vsnd_c'
})
Read more about Saido FastDL here: https://saido.dev/docs/server-assets/sounds