Page 1 of 1

[HL2:DM] Welcome Sound

Posted: Sun May 14, 2017 7:22 pm
by Painkiller
Hello community,

Someone could make me a welcome sound plugin?

-Welcome sound (https://forums.alliedmods.net/showthread.php?t=63161)

Re: [HL2:DM] Welcome Sound

Posted: Fri May 19, 2017 10:57 am
by Painkiller
No one idea please?

Re: [HL2:DM] Welcome Sound

Posted: Tue Oct 03, 2017 2:19 pm
by Painkiller
I have find this.
Load ok but no work.

Can anybody help?



Syntax: Select all

from core import GAME_NAME
from engines.sound import Sound
from events import Event
from players.entity import Player
from stringtables import string_tables
from stringtables.downloads import Downloadables


SOUND_PATH = "exae/rocks3.mp3"


class GenericSound(Sound):
def precache(self):
"""Precache the sample."""
if GAME_NAME in ("csgo", ): # Probably more games: L4D2 etc
string_tables.soundprecache.add_string(self.sample, self.sample)
else:
engine_sound.precache_sound(self.sample)

@property
def sample(self):
"""Return the filename of the Sound instance."""
if GAME_NAME in ("csgo", ):
return "*/{}".format(self._sample)

return self._sample


my_sound = GenericSound(SOUND_PATH)
downloadables = Downloadables()
downloadables.add("sound/{}".format(SOUND_PATH))


@Event('player_spawn')
def on_player_spawn(game_event):
player = Player.from_userid(game_event['userid'])
my_sound.play(player.index)