Raised This Month: $ Target: $400
 0% 

playing a sound when a player die


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Cheap_Suit
Veteran Member
Join Date: May 2004
Old 03-28-2005 , 21:32   playing a sound when a player die
Reply With Quote #1

how do i play a certain sound when a player die in a certain model?

soo far:

Code:
public fdeath(id) {
	
	new model[33]
	cs_get_user_model(id, model, 32)

	if(equal(model, "model",5)) {

	emit_sound(id, CHAN_VOICE, "misc/die.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
	
	}else{
	
	}
	return PLUGIN_CONTINUE
}

public plugin_init() {
	register_event( "DeathMsg", "fdeath", "a" )
}
but i get this

L 03/28/2005 - 19:09:48: [AMXX] Native error in "cs_get_user_model" on some line (file "test.sma").
L 03/28/2005 - 19:09:48: [CSTRIKE] Player out of range (0)

any help or example would be greatly appreciated
__________________
HDD fried, failed to backup files. Sorry folks, just don't have free time anymore. This is goodbye.
Cheap_Suit is offline
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 03-28-2005 , 22:08  
Reply With Quote #2

a) WTF is the else statement there for? I certainly don't see anything in it. Why is it there?

b) When you registered the event you register it as global ("a"), this means that all players receive it at once, meaning the id is going to be 0, and 0 is not a valid entity so you can't emit a sound from it. You have to use read_data(2) (if I recall correctly) to get the victim.
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
Cheap_Suit
Veteran Member
Join Date: May 2004
Old 03-29-2005 , 00:12  
Reply With Quote #3

can you help me out? I dont know how to use read_data
__________________
HDD fried, failed to backup files. Sorry folks, just don't have free time anymore. This is goodbye.
Cheap_Suit is offline
xeroblood
BANNED
Join Date: Mar 2004
Location: Toronto, Canada
Old 03-29-2005 , 00:13  
Reply With Quote #4

new id = read_data(2)
xeroblood is offline
Send a message via MSN to xeroblood
Cheap_Suit
Veteran Member
Join Date: May 2004
Old 03-29-2005 , 00:36  
Reply With Quote #5

i got this
Code:
public death() {

	new id = read_data(2) 

	new model[33] 
	cs_get_user_model(id, model, 32)
	
	if(equal(model, "F_",2))
   	
	emit_sound(id, CHAN_VOICE, "misc/die.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM) 
	
}
but no it doesnt play the sound. please help me fix it
__________________
HDD fried, failed to backup files. Sorry folks, just don't have free time anymore. This is goodbye.
Cheap_Suit is offline
xeroblood
BANNED
Join Date: Mar 2004
Location: Toronto, Canada
Old 03-29-2005 , 12:26  
Reply With Quote #6

Did you precache the sound file?
xeroblood is offline
Send a message via MSN to xeroblood
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 10:01.


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