Raised This Month: $ Target: $400
 0% 

Attach a sound?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
DotNetJunkie
Senior Member
Join Date: May 2005
Location: In front of my pc
Old 05-09-2005 , 05:01   Attach a sound?
Reply With Quote #1

How do attach a sound to a paticular player that all the other
players can hear when near that paticular player?

I tried emit_sound but it doesn't seem to work

Thanks for any help!
__________________
DotNetJunkie is offline
Send a message via ICQ to DotNetJunkie Send a message via AIM to DotNetJunkie Send a message via MSN to DotNetJunkie Send a message via Yahoo to DotNetJunkie
sambro
Member
Join Date: May 2005
Old 05-10-2005 , 01:47  
Reply With Quote #2

emit_sound should work...

I use the voice channel (CHAN_VOICE) with normal attenuation and pitch. For e.g:

emit_sound(id, CHAN_VOICE, "bleedsample.wav", 1.0, ATTN_NORM, 0, PITCH_NORM);

Make sure you precache your sound first though, in the plugin_precache callback.

precache_sound("bleedsample.wav");
sambro is offline
Send a message via MSN to sambro
DotNetJunkie
Senior Member
Join Date: May 2005
Location: In front of my pc
Old 05-10-2005 , 03:07  
Reply With Quote #3

What about new players (who've just joined the game) being unable to
hear the sound until the given player dies?

I've heard this is a problem but I don't know much about it.
__________________
DotNetJunkie is offline
Send a message via ICQ to DotNetJunkie Send a message via AIM to DotNetJunkie Send a message via MSN to DotNetJunkie Send a message via Yahoo to DotNetJunkie
DotNetJunkie
Senior Member
Join Date: May 2005
Location: In front of my pc
Old 05-13-2005 , 01:55  
Reply With Quote #4

Quote:
Originally Posted by sambro
emit_sound should work...

I use the voice channel (CHAN_VOICE) with normal attenuation and pitch. For e.g:

emit_sound(id, CHAN_VOICE, "bleedsample.wav", 1.0, ATTN_NORM, 0, PITCH_NORM);

Make sure you precache your sound first though, in the plugin_precache callback.

precache_sound("bleedsample.wav");
I hate to say this, but it doesn't seem to work.
It appears that only the sound that the player is attached to can hear it.

I want everybody near the player to be able to hear it.
__________________
DotNetJunkie is offline
Send a message via ICQ to DotNetJunkie Send a message via AIM to DotNetJunkie Send a message via MSN to DotNetJunkie Send a message via Yahoo to DotNetJunkie
sambro
Member
Join Date: May 2005
Old 05-13-2005 , 03:33  
Reply With Quote #5

I used that exact code in my jetpack revamp plugin mate. Everyone can hear it.

Perhaps you're doing something else wrong? I dunno
sambro is offline
Send a message via MSN to sambro
DotNetJunkie
Senior Member
Join Date: May 2005
Location: In front of my pc
Old 05-13-2005 , 09:13  
Reply With Quote #6

well here is my code

Code:
policeradio_resetall() {
	new query[256], players[32], num
	get_players(players,num,"ac")
	for(new i = 0; i < num; i++) {
		if(is_user_connected(players[i])) {
			if(is_user_alive(players[i])) {
				new name[33], authid[32]
				get_user_name(players[i],name,sizeof(name))
				get_user_authid(players[i],authid,31)
    			format( query, 255, "SELECT JobID FROM money WHERE steamid='%s'", authid )
    			result = dbi_query(dbc,query) 
				if( dbi_nextrow( result ) > 0 )
				{ 
	 				new job[32], JobID
	 				dbi_field( result, 1, job, 31) 
	 				dbi_free_result(result)
	 				JobID = str_to_num(job)
	 				if((JobID >= mcpdjobs[0] && JobID <= mcpdjobs[1]))
	 				{
		 				if(policeradio[players[i]]>0) {
			 				policeradio_reset(players[i])
		 				}
	 				}
 				}
 				dbi_free_result(result)
			}
		}
	}
	return 0
}

policeradio_reset(id) {
	policeradio_off(id)
	if(policeradioindex[id]==0) {
		emit_sound(id, CHAN_VOICE, "harburp/policeradiochatter_0.wav", 1.0, ATTN_NORM, SND_PLAY, PITCH_NORM)
	}	
	if(policeradioindex[id]==1) {
		emit_sound(id, CHAN_VOICE, "harburp/policeradiochatter_1.wav", 1.0, ATTN_NORM, SND_PLAY, PITCH_NORM)
	}
	return 0
}

policeradio_off(id) {
	if(policeradioindex[id]==0) {
		emit_sound(id, CHAN_VOICE, "harburp/policeradiochatter_0.wav", 0.0, ATTN_NORM, SND_STOP, PITCH_NORM)
	}
	if(policeradioindex[id]==1) {
		emit_sound(id, CHAN_VOICE, "harburp/policeradiochatter_1.wav", 0.0, ATTN_NORM, SND_STOP, PITCH_NORM)
	}
	return 0
}

policeradio_on(id) {
	policeradio_off(id)
	new policeindex = random_num(0,1)
	if(policeindex==0) {
		emit_sound(id, CHAN_VOICE, "harburp/policeradiochatter_0.wav", 1.0, ATTN_NORM, SND_PLAY, PITCH_NORM)
	}
	if(policeindex==1) {
		emit_sound(id, CHAN_VOICE, "harburp/policeradiochatter_1.wav", 1.0, ATTN_NORM, SND_PLAY, PITCH_NORM)
	}
	policeradioindex[id] = policeindex
	return 0
}
Whenever a player spawns for the first time, policeradio_resetall is called
so they can hear it.
__________________
DotNetJunkie is offline
Send a message via ICQ to DotNetJunkie Send a message via AIM to DotNetJunkie Send a message via MSN to DotNetJunkie Send a message via Yahoo to DotNetJunkie
sambro
Member
Join Date: May 2005
Old 05-13-2005 , 11:19  
Reply With Quote #7

Hmm.

Have you precached the sound files?

If so, attach the full plugin and I'll take a look for you.
sambro is offline
Send a message via MSN to sambro
Reply



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 16:44.


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