AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [help] play sound at a specific origin (https://forums.alliedmods.net/showthread.php?t=82770)

Dr.G 12-29-2008 15:15

[help] play sound at a specific origin
 
Can anyone give me a heads up how to play a sound at a specific origin?

Arkshine 12-29-2008 15:23

Re: [help] play sound at a specific origin
 
EngFunc_EmitAmbientSound ?

AntiBots 12-29-2008 15:28

Re: [help] play sound at a specific origin
 
PHP Code:

engfunc(EngFunc_EmitAmbientSound0Float:{XXX.XXXX.XXXXX.X}, "here you sound.wav"VOL_NORMATTN_NORM0PITCH_NORM



Float:{XXX.X, XXX.XX, XXX.X} Position

0 the entity. 0 is worldspawn (all map)

Dr.G 12-29-2008 19:53

Re: [help] play sound at a specific origin
 
Thanks lads

Hawk552 12-30-2008 01:36

Re: [help] play sound at a specific origin
 
Or you can just use emit_sound if you don't want to use Fakemeta.

Exolent[jNr] 12-30-2008 01:37

Re: [help] play sound at a specific origin
 
I didn't know emit_sound() had an origin parameter.

Hawk552 12-30-2008 01:39

Re: [help] play sound at a specific origin
 
You can create an ent, set it at that origin, emit the sound, and then delete it. I suppose in this case it would be better to use Fakemeta.

EDIT: Looking through FM stocks, there's also this:
http://www.amxmodx.org/funcwiki.php?go=func&id=953

It would shorten the code a little bit.

Dr.G 12-30-2008 10:02

Re: [help] play sound at a specific origin
 
humm... shouldnt this work?

PHP Code:

 
#define FLYBY  "ambience/fd_flyby1.wav"
 
public plugin_init() 
{
set_task(1188.0,"FlyBy",0,"",0,"b")
}
 
public 
FlyBy()
{
 new 
Float:origin[3]  //origin
 
origin[0] = 275.0
 origin
[1] = 380.0
 origin
[2] = 500.0
 engfunc
(EngFunc_EmitAmbientSound0originFLYBYVOL_NORMATTN_NORM0PITCH_NORM)
 
 return 
PLUGIN_HANDLED  



Hawk552 12-30-2008 14:24

Re: [help] play sound at a specific origin
 
I hope you realize that 1180.0 is 1180 seconds. That means you'll have to wait that long for it to play.

Dores 12-30-2008 14:27

Re: [help] play sound at a specific origin
 
change 1180.0 to approximately the sound's length.
If, for example, the sound is 7 seconds, I would set the task every 8 ~ 15 seconds.


All times are GMT -4. The time now is 09:18.

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