View Single Post
Darkhand
Member
Join Date: Sep 2008
Old 09-29-2009 , 21:59   Re: Damage Sound
Reply With Quote #20

Oddly I'm having the same problem on a listenserver when testing it out. It's retaining the very first cvar settings that were used when I first ran the plugin. No matter what I set the default to in the source, it gets changed to what it was when I first ran it. For example, if I set the default for sm_damagesound_pitch to 1 in the source and recompile, and then poll the cvar in game it shows: "sm_damagesound_pitch 0 (def 1)". It's like something is changing the cvar after the fact. Very odd, no other plugins do that, even on a listen server.

Anyway, the mod I'm using this on has very few shots before player death. I couldn't really hear the pitch increasing much before the player died, he was dead before it went up more than a few increments. So I increased the pitch counter to go up by 10 per hit instead of 1. The problem now is that in some very rare cases I'm going above 255 pitch and getting pitch out of bound errors. I tried limiting hitCounter to 255 as below, but not having much luck. Any ideas?

Code:
        if(GetConVarBool(cvar_soundpitch)){
            hitCounter[client][attacker] = hitCounter[client][attacker] + 10;
                
            if(hitCounter[client][attacker] > 255){  // Sanity Check, don't let
                hitCounter[client][attacker] = 255;  // pitch value go above 255
            }
        }
EDIT: I'm a newb. The pitch value is already 100 by default... adding 255 to that gives you 355. I changed 255 in the snippet above to 155 and it works perfectly. You might want to add that pitch sanity check into the default version; you never know if some mod will get the sound up past 255, even if it is just adding to the pitch 1 at a time.

EDIT EDIT: Figured out the listenserver issue as well, I didn't notice it writes its own config file... it's just pulling the original defaults that were first created in moddir/cfg/sourcemod/damagesound.cfg. I'm definitely a newb. Strikerman, modify or delete the config file and you'll be good.

One feature I'd like to request is the ability for users to enable or disable the sound for themselves, possibly through a clientpref? So far, most users are thrilled with the mod, but a few find it annoying.

Last edited by Darkhand; 09-30-2009 at 00:25.
Darkhand is offline