PDA

View Full Version : Sending plugin-specific resources to players



w00tguy123
25-01-2016, 01:57 PM
I made a few custom sounds for a server plugin, but these sounds aren't transferred to clients when they join. Is there some sort of server-wide or plugin-specific .res file where you can list resources like these?

KliPPy
25-01-2016, 02:50 PM
Try precaching it, not sure if possible with AS because there is no scripting reference yet (EDIT: just found out that there is, uploaded ~1 hour ago). Anyway, the prototype looks as such (taken from HLSDK):


int (*pfnPrecacheSound) (const char* s);

Takes only 1 argument, path to the sound file.
Try g_EngineFuncs.PrecacheSound in PluginInit (possibly MapInit?). It should be relative to $moddir/sound folder.

w00tguy123
25-01-2016, 03:06 PM
I should have mentioned I was already precaching the sounds in MapInit() using this function:

g_SoundSystem.PrecacheSound(soundPath);

Edit: I should also probably mention that I'm testing this on a LAN listen server.

Solokiller
25-01-2016, 03:26 PM
You cannot force plugin resources to be downloaded to players. If and when we allow this, players will have the option not to allow it to prevent plugins from downloading loads of content.

KliPPy
25-01-2016, 03:34 PM
You cannot force plugin resources to be downloaded to players. If and when we allow this, players will have the option not to allow it to prevent plugins from downloading loads of content.

What's the reason behind not allowing plugins to precache models and sounds? "to prevent plugins from downloading loads of content" doesn't seem reasonable if you ask me. There are other hackish ways of accomplishing it anyway. If someone doesn't want their server to have loads of models/sounds precached, they just won't install that plugin, simple as that.

Solokiller
25-01-2016, 03:37 PM
It's not up to the server operator to decide whether players should be downloading content unrelated to maps. That choice should be left up to the player.

w00tguy123
25-01-2016, 03:45 PM
My first reaction is place these files in every map .res file on my server, but that would bypass that possible future option.

If I posted a tool that does this automatically, would it be removed? I don't want to be a scumbag, but I'm sure others will want to use custom sounds/models/etc. like with metamod/AMX plugins.

Solokiller
25-01-2016, 03:51 PM
We are considering making res files obsolete. The idea is that map precaches are always sent, plugin precaches are sent only if the player wants it. Right now, it only gets sent if the res file specifies it.

w00tguy123
25-01-2016, 04:01 PM
Alright, that makes sense. I'll just modify the .res files for the time being.