AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   emit_sound (https://forums.alliedmods.net/showthread.php?t=274369)

yan1255 11-06-2015 21:17

emit_sound
 
1 Attachment(s)
I am trying to emit a sound from a player and I just can't seem to be making it work..
I have no Idea why... so I was wondering if someone could help me fix my code or make me a new one where this will work...
I have attached the .wav file and the .mp3 file (the .mp3 file is the originals I just converted the file to wav via some website)

This is my code
Code:

#include < amxmodx >

public plugin_init()
{
        register_plugin( "Plugin", "1.0", "Rejack" );
       
        register_clcmd( "say /emit", "cmdEmit" );
}

public plugin_precache()
{
        precache_sound( "slash_hit_emit.wav" );
}

public cmdEmit( const client )
{
        emit_sound( client, CHAN_AUTO, "slash_hit_emit.wav", 1.0, ATTN_NORM, 0, PITCH_NORM )
       
        client_print( client, print_chat, "emitted sound." );
}


Chihuahuax 11-07-2015 00:48

Re: emit_sound
 
Quote:

Originally Posted by simanovich (Post 2269801)
If it doesn't play in-game but plays normally outgame (like Windows Media Player), then the files are out of the engine's limit so the engine cann't read them.

For example, a MP3 file with 320 bit rate cann't be played in game because the engine doesn't support above 192 (I think) bit rate.

Click Me!

CrazY. 11-07-2015 07:12

Re: emit_sound
 
1 Attachment(s)
The problem is the code and your sound, try:

Code:
#include < amxmodx > public plugin_init() {     register_plugin( "Plugin", "1.0", "Rejack" );         register_clcmd( "say /emit", "cmdEmit" );     register_clcmd( "say_team /emit", "cmdEmit" ); } public plugin_precache() {     precache_sound( "slash_hit_emit.wav" ); } public cmdEmit( const client ) {     client_cmd( client, "spk sound/slash_hit_emit.wav" );         client_print( client, print_chat, "emitted sound." ); }

yan1255 11-07-2015 07:20

Re: emit_sound
 
Quote:

Originally Posted by Chihuahuax (Post 2360638)

I knew there was a problem with the files themselves thank you for helping me!

Quote:

Originally Posted by CrazY. (Post 2360700)
The problem is the code and your sound, try:

Code:
#include < amxmodx > public plugin_init() {     register_plugin( "Plugin", "1.0", "Rejack" );         register_clcmd( "say /emit", "cmdEmit" );     register_clcmd( "say_team /emit", "cmdEmit" ); } public plugin_precache() {     precache_sound( "slash_hit_emit.wav" ); } public cmdEmit( const client ) {     client_cmd( client, "spk sound/slash_hit_emit.wav" );         client_print( client, print_chat, "emitted sound." ); }

Actually I don't think client_cmd will do the trick here because I could have used it myself but the sound need to come from a certain player to those who are near him thats why I used emit_sound...
Totaly works now btw :D

Chihuahuax 11-07-2015 10:35

Re: emit_sound
 
Quote:

Originally Posted by CrazY. (Post 2360700)
The problem is the code and your sound, try:

Code:
#include < amxmodx > public plugin_init() {     register_plugin( "Plugin", "1.0", "Rejack" );         register_clcmd( "say /emit", "cmdEmit" );     register_clcmd( "say_team /emit", "cmdEmit" ); } public plugin_precache() {     precache_sound( "slash_hit_emit.wav" ); } public cmdEmit( const client ) {     client_cmd( client, "spk sound/slash_hit_emit.wav" );         client_print( client, print_chat, "emitted sound." ); }

Valve has blocked client_cmd

CrazY. 11-07-2015 12:34

Re: emit_sound
 
Quote:

Originally Posted by yan1255
Actually I don't think client_cmd will do the trick here because I could have used it myself but the sound need to come from a certain player to those who are near him thats why I used emit_sound...
Totaly works now btw

Glad to know I helped :D

Quote:

Originally Posted by Chihuahuax
Valve has blocked client_cmd

I tested this method and worked without problems.

wickedd 11-07-2015 12:42

Re: emit_sound
 
Quote:

Originally Posted by Chihuahuax (Post 2360760)
Valve has blocked client_cmd

No they didn't.


All times are GMT -4. The time now is 18:05.

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