Optional extension dependency:
SMFFMPEG
Used to toggle sound files based on their duration rather than a static timeout.
Video demo:
https://www.youtube.com/watch?v=n_MHcXqiD-8
Usage:
Players should have cl_customsounds 1 and cl_soundfile "path/to/some.wav" set.
Features:
Meleeing a player's spray will play that player's cl_soundfile (only for the player who hit it.)
Meleeing the spray again will toggle the sound off, depending on SMFFMPEG availability.
Fallback sound used if the meleeing player doesn't have custom sounds enabled.
Commands:
!sprays
Reapplies all sprays that exist (fixes invisible sprays for clients who had not downloaded them at the time they were sprayed)
Rechecks client's cl_customsounds value
Admin commands:
!sprays global
Same as the above, except for every player on the server
CVARS:
sm_Rociar_SprayDistanceLimit 75.0
Minimum allowed distance in hammer units between two sprays (as a sphere, not a square/cube)
sm_Rociar_SpraySoundToggleTime 5
Without smffmpeg:
Time in seconds that meleeing a spray will toggle the sound off/on rather than replay
With smffmpeg:
0 = Disable toggle
>0 = Enable toggle for the duration of the sound file
sm_Rociar_CustomsoundsDisabled_Inform 1
Inform the player if cl_customsounds is disabled when meleeing a spray
0 = Do nothing
1 = Tell them to use cl_customsounds 1, and the !sprays command to update
sm_Rociar_CustomsoundsDisabled_Mode 1
What to do if the player has cl_customsounds 0 and melees a spray
0 = Nothing
1 = Play the fallback sound
2 = Attempt to play the customsound anyway
3 = Play the fallback sound and attempt to play the customsound
sm_Rociar_CustomsoundsDisabled_FallbackFile "ui/hitsound_retro2.wav"
Which file to play if the player has cl_customsounds 0
sm_Rociar_SpraycanNoiseFrequency 10
Spraycan Noise Frequency
0 = Disable noise entirely
>0 = Wait N seconds between spraycan noise
decalfrequency is used internally because the Player Decal event is hooked before it executes to prevent the spray sound from being spammed
Version 1.1.6:
Toggle time no longer set if the selected fallback mode doesn't result in (attempting to) play the jingle.
Version 1.1.5:
Fixed bug with StopSound not being able to target specific clients
Added messages telling the player when a spray they've meleed does or does not have a jingle. Also tells the player how to give their own spray a jingle if they melee it without one.
Added plugin tag to chat messages.
Set chat spam timer to 0 as it likely isn't needed.
Sounds now emit from the player's eye location to avoid sounds being muffled from within walls.
Now includes prebuilt smx as I assumed an optional include would compile without. Oops.