Syntax: Select all
from events import Event
from players.entity import PlayerEntity
from players.helpers import index_from_userid
from engines.sound import EngineSound
from engines.sound import Channels
from engines.sound import VOL_NORM
from engines.sound import Attenuations
from engines.sound import SoundFlags
from engines.sound import PitchTypes
from filters.recipients import RecipientFilter
from listeners import LevelInitListenerManager
from listeners import ServerActivateListenerManager
sound_path = 'doors/default_locked.wav'
def load():
EngineSound.precache_sound(sound_path, False, False)
ServerActivateListenerManager.register_listener(_server_activate)
def _server_activate(edicts, edict_count, client_max):
EngineSound.precache_sound(sound_path, False, False)
@Event
def player_say(event):
userid = event.get_int('userid')
index = index_from_userid(userid)
text = event.get_string('text')
player = PlayerEntity(index)
if text == 'run':
filter = RecipientFilter(index)
EngineSound.emit_sound(filter, 1, Channels.AUTO, sound_path, VOL_NORM, Attenuations.NORMAL, SoundFlags.NOFLAGS, PitchTypes.NORMAL, player.m_vecOrigin)
Also, I'm not sure what I need to provide in second arg (entity_index) of emit_sound.
Or can I call client-side play command somehow (like cexec in Mani/ES)?
Can someone provide me an example of using effects in SP? Especially I'm intrested in TempEntities.
CS:S, Windows, May 14 build