Raised This Month: $ Target: $400
 0% 

Problem with end round sound


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Milki
New Member
Join Date: May 2013
Old 05-17-2013 , 05:32   Problem with end round sound
Reply With Quote #1

Hello!
I have this code:
PHP Code:
#include <amxmodx>

public plugin_init() 

  
register_plugin("RoundSound","1.0","FastPanel")
  
register_event("SendAudio""t_win""a""2&%!MRAD_terwin")
  
register_event("SendAudio""ct_win""a""2&%!MRAD_ctwin")  
}

public 
t_win()
{
  new 
rand random_num(1,16)

  
client_cmd(0,"stopsound")

  switch(
rand)
  {
    case 
1client_cmd(0,"spk misc/rs4")
    case 
2client_cmd(0,"spk misc/rs5")
    case 
3client_cmd(0,"spk misc/rs6")
  }

  return 
PLUGIN_HANDLED
}

public 
ct_win()
{
  new 
rand random_num(1,16)

  
client_cmd(0,"stopsound")

  switch(
rand)
  {
    case 
1client_cmd(0,"spk misc/rs1")
    case 
2client_cmd(0,"spk misc/rs2")
    case 
3client_cmd(0,"spk misc/rs3")
  }

  return 
PLUGIN_HANDLED
}

public 
plugin_precache() 
{
  
precache_sound("misc/rs1.wav")
  
precache_sound("misc/rs2.wav")
  
precache_sound("misc/rs3.wav")
  
precache_sound("misc/rs4.wav")
  
precache_sound("misc/rs5.wav")
  
precache_sound("misc/rs6.wav")
  return 
PLUGIN_CONTINUE

but the problem is that the music is not plays when round end.
i think that the code try to play the music because there is amputation when "Counter Terrorrist Win" to Sound
Milki is offline
Shooting King
RAAASENGAN
Join Date: Mar 2012
Location: India
Old 05-17-2013 , 06:08   Re: Problem with end round sound
Reply With Quote #2

Change
PHP Code:
new rand random_num(1,16
To
PHP Code:
new rand random_num(1,3
because you have only written code for rand = 1, 2, 3.
What do you think will happen if the rand is not equal to 1, 2, 3 i.e 11, 10, 14 ??
__________________
As every time said, don't ever UNDERESTIMATE me.

Donate - Here

Last edited by Shooting King; 05-17-2013 at 06:13.
Shooting King is offline
Milki
New Member
Join Date: May 2013
Old 05-17-2013 , 06:58   Re: Problem with end round sound
Reply With Quote #3

Quote:
Originally Posted by Shooting King View Post
Change
PHP Code:
new rand random_num(1,16
To
PHP Code:
new rand random_num(1,3
because you have only written code for rand = 1, 2, 3.
What do you think will happen if the rand is not equal to 1, 2, 3 i.e 11, 10, 14 ??
ohhh ty very match! haha i dont have seen
Milki is offline
Milki
New Member
Join Date: May 2013
Old 05-17-2013 , 07:17   Re: Problem with end round sound
Reply With Quote #4

Quote:
Originally Posted by Shooting King View Post
Change
PHP Code:
new rand random_num(1,16
To
PHP Code:
new rand random_num(1,3
because you have only written code for rand = 1, 2, 3.
What do you think will happen if the rand is not equal to 1, 2, 3 i.e 11, 10, 14 ??
sorry for the double, but the sound still not plays..
the new code:
PHP Code:
#include <amxmodx>

public plugin_init() 

  
register_plugin("RoundSound","1.0","FastPanel")
  
register_event("SendAudio""t_win""a""2&%!MRAD_terwin")
  
register_event("SendAudio""ct_win""a""2&%!MRAD_ctwin")  
}

public 
t_win()
{
  new 
rand random_num(1,3)

  
client_cmd(0,"stopsound")

  switch(
rand)
  {
    case 
1client_cmd(0,"spk misc/rs4")
    case 
2client_cmd(0,"spk misc/rs5")
    case 
3client_cmd(0,"spk misc/rs6")
  }

  return 
PLUGIN_HANDLED
}

public 
ct_win()
{
  new 
rand random_num(1,3)

  
client_cmd(0,"stopsound")

  switch(
rand)
  {
    case 
1client_cmd(0,"spk misc/rs1")
    case 
2client_cmd(0,"spk misc/rs2")
    case 
3client_cmd(0,"spk misc/rs3")
  }

  return 
PLUGIN_HANDLED
}

public 
plugin_precache() 
{
  
precache_sound("misc/rs1.wav")
  
precache_sound("misc/rs2.wav")
  
precache_sound("misc/rs3.wav")
  
precache_sound("misc/rs4.wav")
  
precache_sound("misc/rs5.wav")
  
precache_sound("misc/rs6.wav")
  return 
PLUGIN_CONTINUE

ty..
Milki is offline
Shooting King
RAAASENGAN
Join Date: Mar 2012
Location: India
Old 05-19-2013 , 03:43   Re: Problem with end round sound
Reply With Quote #5

Try keeping your plugin at the top of 3rd party plugins or at the top of all plugins in plugins.ini.
__________________
As every time said, don't ever UNDERESTIMATE me.

Donate - Here
Shooting King is offline
oxygen935
Veteran Member
Join Date: Jun 2012
Location: Athens, Greece
Old 05-19-2013 , 16:24   Re: Problem with end round sound
Reply With Quote #6

An other person who have the same problem with me... After the new steam update the client_cmd with wav files don't work... I did it with mp3 files and it works like a charm!
__________________
Quote:
Originally Posted by quark View Post
You're a genius
Stopped any pawn work cause of university for computer science
oxygen935 is offline
Send a message via Skype™ to oxygen935
hornet
AMX Mod X Plugin Approver
Join Date: Mar 2010
Location: Australia
Old 05-20-2013 , 22:55   Re: Problem with end round sound
Reply With Quote #7

Quote:
Originally Posted by oxygen935 View Post
An other person who have the same problem with me... After the new steam update the client_cmd with wav files don't work... I did it with mp3 files and it works like a charm!
There's nothing wrong with client_cmd() and sounds.


Are you sure your sounds are formatted correctly?
__________________
Quote:
vBulletin Tip #42: Not much would be accomplished by merging this item with itself.
hornet is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 05-21-2013 , 00:28   Re: Problem with end round sound
Reply With Quote #8

If players have speak_enabled 0 or MP3Volume 0, it won't work, you should stay on .wav sounds and respect players settings/whishes.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Vitanova
Member
Join Date: May 2013
Old 05-20-2013 , 19:17   Re: Problem with end round sound
Reply With Quote #9

Try blocking "Counter terrorist Win" sounds.
Vitanova is offline
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:21.


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