Cool thanks, btw hey dogmeat it's me DuckSauce but you may know already lol. I haven't tested it out with multiple players, but here's the code I'm using for the hitsounds in OnTakeDamage: CRecipientFilter filter; // needed to cast since GetAttacker returns the attacker as CBaseEntity, recipient has to take CBasePlayer) filter.AddRecipient( ( CBasePlayer* )inputInfo.GetAttacker() ); filter.MakeReliable();
// send the sound to attacker if the player taking damage is not the attacker(so it doesn't play when someone // hurts himself if ( !inputInfo.GetAttacker() && inputInfo.GetDamage() > 0 ) { //send announcement to play UserMessageBegin( filter, "SendAudio" ); WRITE_STRING( "HitSound.Blip" ); MessageEnd(); } Also now using it for my announcements like this in CHL2MPRules::Think( void ): float flStartSuddenDeathSound = 36.0; if ( GetRoundRemainingTime() > flStartSuddenDeathSound ) { bPreSuddenDeath = false; } else if ( GetRoundRemainingTime() <= flStartSuddenDeathSound && bAlreadyStarted1 != true ) { bAlreadyStarted1 = true; bPreSuddenDeath = true; CBroadcastRecipientFilter filter; // do I need to add all players in a broadcastrecipientfilter?? filter.AddAllPlayers(); filter.MakeReliable(); //send announcement to play UserMessageBegin( filter, "SendAudio" ); WRITE_STRING( "MelonDeathMode.Activated" ); MessageEnd(); } Richard Slaughter wrote: > To play announcement messages to players I've made use of the SendAudio > HUD message, although there are a few tweaks needed to enable it: > > In hud.cpp find > > #ifdef CSTRIKE_DLL > DECLARE_MESSAGE(gHUD, SendAudio); > #endif > > and comment out the #ifdef and #endif, do the same for > > #ifdef CSTRIKE_DLL > HOOK_HUD_MESSAGE( gHUD, SendAudio ); > #endif > > In hl2_usermessages.cpp register a new message: > > usermessages->Register( "SendAudio", -1 ); > > Once that's done you should be able to call it with something like this: > > CRecipientFilter filter; > filter.AddAllPlayers(); > filter.MakeReliable(); > > //send announcement to play > UserMessageBegin( filter, "SendAudio" ); > WRITE_STRING( "Your.Sound" ); > MessageEnd(); > > Then you just need to make sure you have your sound setup in > scripts\game_sounds.txt > > You can also use CBroadcastRecipientFilter to send to all players or > filter.AddRecipientsByTeam() to add a specific team. > > This was on the Orange Box SDK, but I'm fairly sure that EP1 SDK is > similar. No idea if it's suitable for what you want to use it for, might > be better to look at doing it on the client as it's a regular occurence, > and should be predictable anyway. > > - Rich > > Jorge Rodriguez wrote: > >> On Mon, Feb 16, 2009 at 12:00 PM, Yorg Kuijs <yorg.ku...@home.nl> wrote: >> >> >> >>> 1. Does anybody know if it's possible to have a sound be emitted that >>> only the player it was meant for can hear? As far as I know all sounds >>> are emitted into the world. I might be making a hitbleep system similar >>> to quake, wet, et:qw and dystopia, roughly I think it would look like >>> this in the ontakedamage class: >>> pAttacker->PlayAttackerHearableSoundOnly( "soundname" ); >>> or >>> pInflictor->PlayInflictorHearableSoundOnly( "soundname" ); >>> >>> well the function is bogus ofcourse since it doesn't exist. So does >>> anybody know? >>> >>> >>> >> You can emit the sound on the client, or you can call the sound with a >> single recipient filter instead of a pas filter. >> _______________________________________________ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders