AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Catching ALL sound events (https://forums.alliedmods.net/showthread.php?t=62125)

-hi- 10-19-2007 05:33

Catching ALL sound events
 
I'm trying to create a plugin that will allow a user to only hear sounds generated by him/herself only. Is there a way to hook the creation of ALL sounds (footsteps, jumping, firing, etc...).

I've tried using Fakemeta to hook the EmitSound function but that only catches certain sounds not ALL sounds.

The basic idea of my plugin is to have a bunch of players in a server. If each player was blind, they would think they were playing alone.

Wilson [29th ID] 10-19-2007 10:16

Re: Catching ALL sound events
 
Do what you're doing by hooking EmitSound and blocking them. That will block emitted sounds.

As for the rest of them, hook FM_PlaybackEvent and block those. This should also block the bullet ricocheting off the wall if I remember correctly.

If blocking all of them blocks a few you don't want to block, you can test the eventindex.

-hi- 10-20-2007 02:54

Re: Catching ALL sound events
 
Yes, thanks Wilson. The PlaybackEvent forward is catching more of the sounds I am trying to block. The problem I'm having now is blocking the sounds. It's easy to completely block the sound using FMRES_SUPERCEDE but I want to only block it from certain players (everyone except the creator of the entity that caused the sound).

Wilson [29th ID] 10-20-2007 15:20

Re: Catching ALL sound events
 
If you block the PlaybackEvent completely, the player who caused the sound will still hear it. He hears it client-sided.

-hi- 10-20-2007 18:19

Re: Catching ALL sound events
 
When I block it I dont see or hear anything. This is for TFC. If I throw a conc I don't hear the sound or see the blast; the grenade just disappears. Here is what I've got so far am I doing everything right?

Code:
#include <amxmodx> #include <fakemeta> #define PLUGIN "Sound Blocker" #define VERSION "1.0" #define AUTHOR "hi" #pragma semicolon 1 public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR);     register_forward(FM_EmitSound, "fwdEmitSound");     register_forward(FM_PlaybackEvent, "fwdPlaybackEvent"); } public fwdEmitSound(ent, iChannel, const szSample[], Float:fVolume, Float:fAttenuation, iFlags, iPitch) {     client_print(0, print_chat, "ent %d chan %d sam %s flags %d pitch %d", ent, iChannel, szSample, iFlags, iPitch);     return FMRES_SUPERCEDE; } public fwdPlaybackEvent(flags, invoker, eventindex, delay, Float:origin[3], Float:angles[3], Float:fparam1, Float:fparam2, iparam1, iparam2, bparam1, bparam2) {     client_print(0, print_chat, "Playback flags %d invoker %d index %d %f %f %d %d %d %d", flags, invoker, eventindex, fparam1, fparam2, iparam1, iparam2, bparam1, bparam2);     return FMRES_SUPERCEDE; }

Wilson [29th ID] 10-20-2007 22:18

Re: Catching ALL sound events
 
Grenades don't use playbackevents - they use emit_sound()

I can't think of a way to only emit_sound() to one person...other than shutting everyone else's volume temporarily or using client_cmd(id,"spk explosion.wav") on the one client..


All times are GMT -4. The time now is 22:29.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.