Raised This Month: $51 Target: $400
 12% 

Help!!


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Grovliom
Member
Join Date: Mar 2020
Location: somewhere in Serbia
Old 04-20-2020 , 18:18   Help!!
Reply With Quote #1

how do i play a specific sound from this with client_cmd

PHP Code:
new drums[][] = 
{
    
"drums/kick.wav"
"drums/snare.wav"
"drums/hat.wav" ,
"drums/crash.wav" ,
"drums/ride1.wav" ,
"drums/ride2.wav" ,
"drums/ride3.wav" 

thanks for your time!
Grovliom is offline
Nutu_
AlliedModders Donor
Join Date: Mar 2016
Location: Germany
Old 04-20-2020 , 18:21   Re: Help!!
Reply With Quote #2

PHP Code:
client_cmd (id"spk soundname"
__________________
a simple act of caring creates an endless ripple.
Nutu_ is offline
Grovliom
Member
Join Date: Mar 2020
Location: somewhere in Serbia
Old 04-20-2020 , 18:21   Re: Help!!
Reply With Quote #3

Quote:
Originally Posted by Nutu_ View Post
PHP Code:
client_cmd (id"spk soundname"
okay that was pretty easy
Grovliom is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 04-20-2020 , 19:06   Re: Help!!
Reply With Quote #4

But not very good for a full release. You should keep the sounds on one and only one place in the code. In case you need to change them later, you will be able to do it only with 1 line of code rather than searching for all other instances.

Code:
client_cmd(id, "spk %s", drums[num])

Where "num" is an index from the array. For example, putting 0 will play the first sound from the list.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
Grovliom
Member
Join Date: Mar 2020
Location: somewhere in Serbia
Old 04-21-2020 , 06:48   Re: Help!!
Reply With Quote #5

Quote:
Originally Posted by OciXCrom View Post
But not very good for a full release. You should keep the sounds on one and only one place in the code. In case you need to change them later, you will be able to do it only with 1 line of code rather than searching for all other instances.

Code:
client_cmd(id, "spk %s", drums[num])

Where "num" is an index from the array. For example, putting 0 will play the first sound from the list.
Wow this is even better! Thanks OciXCrom!
Grovliom 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 20:48.


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