AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   How to add sound? (https://forums.alliedmods.net/showthread.php?t=126336)

eNz0 05-08-2010 11:17

How to add sound?
 
hi, i have a question. How can i add sound, when player uses a chat command. For example: he says: /shout, and then everybody hears shouting sound comming from him. Sound should be heard not just by the player who used the command, and other should hear if close enought (not same voice)

Mxnn 05-08-2010 15:18

Re: How to add sound?
 
You can use
PHP Code:

public plugin_init()
register_clcmd("say /shoot""cmdSound")

public 
cmdSound(id
client_cmd(0"spk weapons/deagle-1.wav"

deagle-1.wav is the shoot's sound of deagle weapon (it's an example). You can change the sound.
NOTE: The initial (or directory) folder is "sound".
If you want to put a sound that is on sound/yourfolder you have to code:
PHP Code:

client_cmd(0"spk yourfolder/yoursound.wav"


fysiks 05-08-2010 16:27

Re: How to add sound?
 
Code:

emit_sound()

eNz0 05-09-2010 03:37

Re: How to add sound?
 
if i use:
PHP Code:

emit_sound(0,.....) 

doesn't "0" means that sound will be heard by everybody, with the same voice?

should i use "id" then?

PHP Code:

client_cmd(0"spk yourfolder/yoursound.wav"



is "spk" command heard by everyone? (not the same voice)

I need all this stuff for leap plugin. When player does leap, he shouts.

Mxnn 05-09-2010 13:15

Re: How to add sound?
 
"spk(speak) [sound]" command plays the sound that you want.
The sound is the same volume to everyone.

fysiks 05-09-2010 14:23

Re: How to add sound?
 
Quote:

Originally Posted by eNz0 (Post 1175223)
if i use:
PHP Code:

emit_sound(0,.....) 

doesn't "0" means that sound will be heard by everybody, with the same voice?

should i use "id" then?

PHP Code:

client_cmd(0"spk yourfolder/yoursound.wav"

is "spk" command heard by everyone? (not the same voice)

I need all this stuff for leap plugin. When player does leap, he shouts.

You would use emit_sound(12, . . .). This will emit the sound from the player in slot 12. Only people close enough to player 12 will be able to hear it.

eNz0 05-11-2010 10:24

Re: How to add sound?
 
Thanks


All times are GMT -4. The time now is 03:52.

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