Raised This Month: $ Target: $400
 0% 

Sound won't play


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
BigDontCry
Member
Join Date: Nov 2007
Location: Sweden
Old 11-07-2007 , 18:37   Sound won't play
Reply With Quote #1

I want to play a sound file (wav) for a client when he gains XP in a mod I'm working on... But the sound won't play (or atleast I can't hear it)...

Here's my hook_death code:
PHP Code:
public hook_death() {
 new 
Killer read_data(1)
 new 
Victim read_data(2)
 
 new 
KillerName[32], VictimName[32]
 
get_user_name(KillerKillerName31)
 
get_user_name(VictimVictimName31)
 
 if(
is_user_connected(Killer) && !is_user_alive(Victim)) {
  
p_xp[Killer] += XP_PER_KILL
  client_print
(Killerprint_chat"[%s] %s recieved %d XP for killing %s"MODKillerNameXP_PER_KILLVictimName)
 
  
emit_sound(Killer,CHAN_ITEM"sound/mymod/gainxp.wav"1.0ATTN_NORM0PITCH_NORM)
 } 
...and yeah, the wav file exist... ;)
__________________
Big Men Don't Cry

Quote:
[20:23] [email protected]: I don't know how
[20:23] [email protected]: I'm only 15
[20:23] [email protected]: I don't know anything
BigDontCry is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 11-07-2007 , 18:46   Re: Sound won't play
Reply With Quote #2

"sound/mymod/gainxp.wav"

No need to specify 'sound/' folder with *.wav sounds.

Code:
emit_sound(Killer,CHAN_ITEM, "mymod/gainxp.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
__________________
Arkshine is offline
BigDontCry
Member
Join Date: Nov 2007
Location: Sweden
Old 11-07-2007 , 18:54   Re: Sound won't play
Reply With Quote #3

Quote:
Originally Posted by arkshine View Post
"sound/mymod/gainxp.wav"

No need to specify 'sound/' folder with *.wav sounds.


Code:
</p><p>emit_sound(Killer,CHAN_ITEM, "mymod/gainxp.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)</p><p>
I've tried that also, same result... no error messages in console or anything like that...
I'm thinking set_task(0.5, "play_gainxp_sound", Killer) or something?
__________________
Big Men Don't Cry

Quote:
[20:23] [email protected]: I don't know how
[20:23] [email protected]: I'm only 15
[20:23] [email protected]: I don't know anything
BigDontCry is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 11-07-2007 , 19:20   Re: Sound won't play
Reply With Quote #4

Try using CHAN_AUTO.

Also, be sure that the sound gainxp.wav exists in sound/mymod/ folder.
__________________
Arkshine is offline
BigDontCry
Member
Join Date: Nov 2007
Location: Sweden
Old 11-07-2007 , 19:39   Re: Sound won't play
Reply With Quote #5

Quote:
Originally Posted by arkshine View Post
Try using CHAN_AUTO.
Yep, that worked... Thanks alot!
__________________
Big Men Don't Cry

Quote:
[20:23] [email protected]: I don't know how
[20:23] [email protected]: I'm only 15
[20:23] [email protected]: I don't know anything
BigDontCry is offline
BigDontCry
Member
Join Date: Nov 2007
Location: Sweden
Old 11-08-2007 , 16:48   Re: Sound won't play
Reply With Quote #6

I have another question about this...
First of all, why can't I use CHAN_ITEM? It should work... The next thing is; if I want to play a sound from the Valve/sound directory it won't work either, why is that?

I'm playing and coding for CZ btw...
__________________
Big Men Don't Cry

Quote:
[20:23] [email protected]: I don't know how
[20:23] [email protected]: I'm only 15
[20:23] [email protected]: I don't know anything
BigDontCry 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 01:14.


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