How to emit sound??

Please post any questions about developing your plugin here. Please use the search function before posting!
Predz
Senior Member
Posts: 158
Joined: Wed Aug 08, 2012 9:05 pm
Location: Bristol, United Kingdom

Postby Predz » Sun Oct 05, 2014 2:11 pm

It seems to work for me in a custom path. However I am playing the sound to everyone on the server. Does it make a difference?

This is what I am using.

Syntax: Select all

import random
from engines.sound import Sound
from engines.sound import SOUND_FROM_WORLD
from stringtables.downloads import Downloadables

WCL_DOWNLOADS = Downloadables()
WCL_SOUNDS = ['WCL/DoubleKill1.mp3', 'WCL/DoubleKill2.mp3', 'WCL/TripleKill1.mp3', 'WCL/TripleKill2.mp3', 'WCL/QuadraKill.mp3', 'WCL/PentaKill1.mp3', 'WCL/FirstBlood.mp3', 'WCL/Shutdown.mp3']
WCL_DOUBLE_KILL = Sound((), SOUND_FROM_WORLD, random.choice(['WCL/DoubleKill1.mp3', 'WCL/DoubleKill2.mp3']))
WCL_TRIPLE_KILL = Sound((), SOUND_FROM_WORLD, random.choice(['WCL/TripleKill1.mp3', 'WCL/TripleKill2.mp3']))
WCL_QUADRA_KILL = Sound((), SOUND_FROM_WORLD, 'WCL/QuadraKill.mp3')
WCL_PENTA_KILL = Sound((), SOUND_FROM_WORLD, 'WCL/PentaKill1.mp3')
WCL_FIRST_KILL = Sound((), SOUND_FROM_WORLD, 'WCL/FirstBlood.mp3')
WCL_SHUT_DOWN = Sound((), SOUND_FROM_WORLD, 'WCL/Shutdown.mp3')
for sound in WCL_SOUNDS:
WCL_DOWNLOADS.add('sound/'+sound)


Then use:

Syntax: Select all

WCL_DOUBLE_KILL.play()
## etc
User avatar
L'In20Cible
Project Leader
Posts: 1536
Joined: Sat Jul 14, 2012 9:29 pm
Location: Québec

Postby L'In20Cible » Sun Oct 05, 2014 8:46 pm

Are you testing on CS:GO?
User avatar
satoon101
Project Leader
Posts: 2703
Joined: Sat Jul 07, 2012 1:59 am

Postby satoon101 » Mon Oct 06, 2014 6:59 pm

Finally had some time to do some research and found this:
https://wiki.alliedmods.net/CSGO_Quirks#Playing_Custom_Sounds
Image

Return to “Plugin Development Support”

Who is online

Users browsing this forum: Bing [Bot] and 128 guests