Hey, how can I play a sound for a player and stop it?
Is there something like
playSound(path)
stopSound(path)
Play sound
Hey there
http://wiki.sourcepython.com/pages/engines.sound#Sound
http://wiki.sourcepython.com/pages/engines.sound#Sound
Syntax: Select all
from engines.sound import Sound
from events import Event
from players.helpers import index_from_userid
sound = Sound("ambient/music/latin.wav")
@Event('player_jump')
def on_player_jump(game_event):
index = index_from_userid(game_event.get_int('userid'))
sound.play(index)
def unload():
sound.stop()
/id/its_iPlayer
My plugins: Map Cycle • Killstreaker • DeadChat • Infinite Jumping • TripMines • AdPurge • Bot Damage • PLRBots • Entity AntiSpam
Hail, Companion. [...] Hands to yourself, sneak thief.
My plugins: Map Cycle • Killstreaker • DeadChat • Infinite Jumping • TripMines • AdPurge • Bot Damage • PLRBots • Entity AntiSpam
Hail, Companion. [...] Hands to yourself, sneak thief.
That information is slightly outdated now. Use the new wiki:
http://build.affecta.net/job/Source.Python%20-%20Documentation/lastSuccessfulBuild/artifact/cstrike/addons/source-python/docs/source-python/build/modules/engines.sound.html#engines.sound.Sound
Also, just a note, but if you use a specific index to emit the sound from, or channel, make sure to pass those values in the stop method if they differ from the Sound instance's values of index/channel.
http://build.affecta.net/job/Source.Python%20-%20Documentation/lastSuccessfulBuild/artifact/cstrike/addons/source-python/docs/source-python/build/modules/engines.sound.html#engines.sound.Sound
Also, just a note, but if you use a specific index to emit the sound from, or channel, make sure to pass those values in the stop method if they differ from the Sound instance's values of index/channel.
Return to “Plugin Development Support”
Who is online
Users browsing this forum: No registered users and 8 guests