Raised This Month: $ Target: $400
 0% 

play sound


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
JeweL`
Member
Join Date: Oct 2009
Location: Turkey/Kocaeli
Old 12-26-2009 , 06:32   play sound
Reply With Quote #1

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
JeweL` is offline
Send a message via MSN to JeweL` Send a message via Skype™ to JeweL`
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 12-26-2009 , 06:54   Re: play sound
Reply With Quote #2

Try :

Code:
register_clcmd( "!zzz", "ClientCommand_EnemyDied" );
+
Code:
public ClientCommand_EnemyDied ( const player ) {     client_cmd( player, "spk events/enemy_died" ); }
__________________
Arkshine is offline
JeweL`
Member
Join Date: Oct 2009
Location: Turkey/Kocaeli
Old 12-26-2009 , 06:55   Re: play sound
Reply With Quote #3

thank you vm Arkshine ;)
JeweL` is offline
Send a message via MSN to JeweL` Send a message via Skype™ to JeweL`
Hasler
BANNED
Join Date: Jul 2009
Location: Argentina, Rosario
Old 12-26-2009 , 07:33   Re: play sound
Reply With Quote #4

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)    

Hasler is offline
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 12-26-2009 , 08:07   Re: play sound
Reply With Quote #5

Remove the "sound/".
__________________

Last edited by hleV; 12-26-2009 at 08:24.
hleV is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 12-26-2009 , 08:09   Re: play sound
Reply With Quote #6

No need to precache.
__________________
Arkshine is offline
Mxnn
Veteran Member
Join Date: Aug 2009
Location: AT MY HOME
Old 12-26-2009 , 12:17   Re: play sound
Reply With Quote #7

I have a question arkshine. You doesn't have to put ".wav" in the end of the file name?
Mxnn is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 12-26-2009 , 12:28   Re: play sound
Reply With Quote #8

Yes, but it doesn't matter you write it or not.
__________________
Arkshine is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 12-26-2009 , 12:32   Re: play sound
Reply With Quote #9

He wants to play to all players, so id should be 0, and admin acces should be checked.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod 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 04:07.


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