AlliedModders

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

JeweL` 12-26-2009 06:32

play sound
 
hey, im new on scripting

i want to play a sound to all players when i use a command

e.g. when i say !zzz > play sound valve/cstrike/sound/events/enemy_died.wav
can you teach me, how i can do this..

& sorry, my english isnt very well :)

Arkshine 12-26-2009 06:54

Re: play sound
 
Try :

Code:
register_clcmd( "!zzz", "ClientCommand_EnemyDied" );
+
Code:
public ClientCommand_EnemyDied ( const player ) {     client_cmd( player, "spk events/enemy_died" ); }

JeweL` 12-26-2009 06:55

Re: play sound
 
thank you vm Arkshine ;)

Hasler 12-26-2009 07:33

Re: play sound
 
PHP Code:

#include <amxmodx>

new const sound[] = { "sound/events/enemy_died.wav" }

public 
plugin_init() {
    
register_plugin("sound""1.5""Hasler")
    
    
register_clcmd("!zzz","Died")
    
}
public 
plugin_precache()
{
precache_sound(sound)
}

public 
Died(id){
    
client_cmd(id"spk %s"sound)    



hleV 12-26-2009 08:07

Re: play sound
 
Remove the "sound/".

Arkshine 12-26-2009 08:09

Re: play sound
 
No need to precache.

Mxnn 12-26-2009 12:17

Re: play sound
 
I have a question arkshine. You doesn't have to put ".wav" in the end of the file name?

Arkshine 12-26-2009 12:28

Re: play sound
 
Yes, but it doesn't matter you write it or not.

ConnorMcLeod 12-26-2009 12:32

Re: play sound
 
He wants to play to all players, so id should be 0, and admin acces should be checked.


All times are GMT -4. The time now is 04:07.

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