AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Play sound problem help please. (https://forums.alliedmods.net/showthread.php?t=168098)

bilalpro 09-24-2011 06:37

Play sound problem help please.
 
PHP Code:

public plugin_precache()
{
 
precache_sound("misc/bonusxp.wav");
 
}
 
public 
EventDeathMsg()
{
 new 
killer read_data(1);
 new 
victim read_data(2);
 
 if( (
g_first_client <= killer <= g_max_clients) && victim != killer )
 {
  if( 
IsUserAuthorized(killer) )
  {
   
// regular kill
   
new xp get_pcvar_num(cvar_xp_kill);
   
   
   
g_xp[killer] += xp;
   
set_hudmessage(255255255, -1.0, -0.706.04.0);
   
show_hudmessage(killer"+100"MESSAGE_TAGxp);
   
emit_sound(killer"misc/bonusxp.wav");
   
   
Save(killer);
  }
 }
 else if( 
IsUserAuthorized(victim) )
 {
  
// victim died of map causes or killed self
  
new xp get_pcvar_num(cvar_xp_suicide);
  
  
g_xp[victim] -= xp;
  
  
ColorChat(victimGREY"^x04%s^x03 You lost^x04 %i XP^x03 for suicide!"MESSAGE_TAGxp);
  
  
Save(victim);
 }


This is not the full code because the plugin is private, i need help with playing the sound it wont play the error is: argument mismatch 2

.Dare Devil. 09-24-2011 07:00

Re: Play sound problem help please.
 
PHP Code:

emit_sound(killerCHAN_STATIC"misc/bonusxp.wav"VOL_NORMATTN_NORM0PITCH_NORM); 


bilalpro 09-24-2011 07:19

Re: Play sound problem help please.
 
Compiled good, but still doesnt play the sound :S

.Dare Devil. 09-24-2011 07:30

Re: Play sound problem help please.
 
Quote:

Originally Posted by bilalpro (Post 1562077)
Compiled good, but still doesnt play the sound :S

Mayby sound dont have a correct format.

wav must be a 176 bit rate.

test it, write in your consoole
PHP Code:

spk misc/bonusxp.wav 

or
PHP Code:

spk sound/misc/bonusxp.wav 

if it play then say it :)

bilalpro 09-24-2011 07:40

Re: Play sound problem help please.
 
it plays, it is 176 bit rate but theres something wrong in the code i dont know what but i hope u got the solution.

.Dare Devil. 09-24-2011 07:51

Re: Play sound problem help please.
 
Try to use this in your code :

PHP Code:

client_cmd(killer"spk misc/bonusxp.wav"


bilalpro 09-24-2011 07:53

Re: Play sound problem help please.
 
Quote:

Originally Posted by .Dare Devil. (Post 1562116)
Try to use this in your code :

PHP Code:

client_cmd(killer"spk misc/bonusxp.wav"


as precache or emit_sound?

.Dare Devil. 09-24-2011 07:54

Re: Play sound problem help please.
 
Quote:

Originally Posted by bilalpro (Post 1562119)
as precache or emit_sound?

delete emit_sound and add my client_cmd spk here

bilalpro 09-24-2011 07:57

Re: Play sound problem help please.
 
i've added it still doesn't work i think theres something wrong because it doesnt even download the song on connect. ( i dont got it in my cstrike map either )

.Dare Devil. 09-24-2011 08:03

Re: Play sound problem help please.
 
Quote:

Originally Posted by bilalpro (Post 1562124)
i've added it still doesn't work i think theres something wrong because it doesnt even download the song on connect. ( i dont got it in my cstrike map either )

mayby file is not there in your server.
I mean that folder where this file must be


All times are GMT -4. The time now is 19:38.

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