AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Emitting Sounds From Player (https://forums.alliedmods.net/showthread.php?t=143901)

GXLZPGX 11-26-2010 13:42

Emitting Sounds From Player
 
How can I emitt a sound from a specific player. And while the sound is emitting, I want it to follow the player.

Meaning I don't want it to just emit from where he was standing when the sound started, I want it to be attached to him somewhat, so that while he's moving, it gives the effect that he's making the sound.

Flipper_SPb 11-26-2010 14:05

Re: Emitting Sounds From Player
 
emit_sound(id, CHAN_AUTO, "xxx/xxx.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)

http://www.amxmodx.org/funcwiki.php?...ound&go=search

GXLZPGX 11-26-2010 14:26

Re: Emitting Sounds From Player
 
Quote:

Originally Posted by Flipper_SPb (Post 1357244)
emit_sound(id, CHAN_AUTO, "xxx/xxx.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)

http://www.amxmodx.org/funcwiki.php?...ound&go=search

I guess I should learn to use funcwiki more often. Thanks!

Edit: Wait, that will only emitt the sound to that one person. I want everyone to be able to hear it, but have the sound emit from that one player. They would have to be near him of course.

nikhilgupta345 11-26-2010 14:37

Re: Emitting Sounds From Player
 
I guess you could see if two people are close enough to each other to hear the sound, with get_distance? and then get their origins with get_user_origin.

Never used emit_sound, so idk.

Flipper_SPb 11-26-2010 15:03

Re: Emitting Sounds From Player
 
Quote:

as I know, it can be non-player entity
I just tried it :) it works well

GXLZPGX 11-26-2010 15:09

Re: Emitting Sounds From Player
 
Quote:

Originally Posted by nikhilgupta345 (Post 1357260)
I guess you could see if two people are close enough to each other to hear the sound, with get_distance? and then get their origins with get_user_origin.

Never used emit_sound, so idk.

Lol, emit_sound is the best way to play wav sounds with depth. If I use spk the sound would stay the same. Emit_sound depends on how close you are where the sound was emitted. It gives a more realistic effect.

Flipper_SPb 11-26-2010 15:16

Re: Emitting Sounds From Player
 
Quote:

Originally Posted by GXLZPGX (Post 1357251)
Wait, that will only emitt the sound to that one person.

No.. Just try. Player with id will emit sound. Other players can hear it.

Flipper_SPb 11-26-2010 15:18

Re: Emitting Sounds From Player
 
Oh, sorry. I have a trouble with editing of my post

wrecked_ 11-26-2010 16:39

Re: Emitting Sounds From Player
 
Check the multiple plugins that already do this.


All times are GMT -4. The time now is 11:28.

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