Raised This Month: $ Target: $400
 0% 

[help] play sound at a specific origin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Dr.G
Senior Member
Join Date: Nov 2008
Old 12-29-2008 , 15:15   [help] play sound at a specific origin
Reply With Quote #1

Can anyone give me a heads up how to play a sound at a specific origin?
__________________
Dr.G is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 12-29-2008 , 15:23   Re: [help] play sound at a specific origin
Reply With Quote #2

EngFunc_EmitAmbientSound ?
Arkshine is offline
AntiBots
Veteran Member
Join Date: May 2008
Location: Brazil
Old 12-29-2008 , 15:28   Re: [help] play sound at a specific origin
Reply With Quote #3

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)
__________________
AntiBots is offline
Send a message via ICQ to AntiBots Send a message via MSN to AntiBots Send a message via Skype™ to AntiBots
Dr.G
Senior Member
Join Date: Nov 2008
Old 12-29-2008 , 19:53   Re: [help] play sound at a specific origin
Reply With Quote #4

Thanks lads
__________________
Dr.G is offline
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 12-30-2008 , 01:36   Re: [help] play sound at a specific origin
Reply With Quote #5

Or you can just use emit_sound if you don't want to use Fakemeta.
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 12-30-2008 , 01:37   Re: [help] play sound at a specific origin
Reply With Quote #6

I didn't know emit_sound() had an origin parameter.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 12-30-2008 , 01:39   Re: [help] play sound at a specific origin
Reply With Quote #7

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.
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
Dr.G
Senior Member
Join Date: Nov 2008
Old 12-30-2008 , 10:02   Re: [help] play sound at a specific origin
Reply With Quote #8

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  

__________________
Dr.G is offline
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 12-30-2008 , 14:24   Re: [help] play sound at a specific origin
Reply With Quote #9

I hope you realize that 1180.0 is 1180 seconds. That means you'll have to wait that long for it to play.
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
Dores
Veteran Member
Join Date: Jun 2008
Location: You really don't wanna k
Old 12-30-2008 , 14:27   Re: [help] play sound at a specific origin
Reply With Quote #10

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.
__________________
O o
/Ż________________________
| IMMA FIRIN' MAH LAZOR!!!
\_ŻŻŻ
Dores is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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