HL2DM: Winner sound
- daren adler
- Senior Member
- Posts: 348
- Joined: Sat May 18, 2019 7:42 pm
HL2DM: Winner sound
Hello game scripters I would like to have a script/sound for a winner on my server. The sound i will be using would be (x/chat/badboys/badboys_001.mp3). Thank You and have a great weekend.
-
- Senior Member
- Posts: 309
- Joined: Sun May 17, 2020 7:56 am
- Location: Finland
- Contact:
Re: HL2DM: Winner sound
Hi, try this script its untested since i don't own this game.
Syntax: Select all
from events import Event
from engines.sound import Sound
from stringtables.downloads import Downloadables
WINNER_SOUND = Sound('x/chat/badboys/badboys_001.mp3')
def load():
dl = Downloadables()
dl.add('sound/x/chat/badboys/badboys_001.mp3')
@Event('game_end')
def game_end(args):
if args['winner'] > 1:
WINNER_SOUND.play()
- daren adler
- Senior Member
- Posts: 348
- Joined: Sat May 18, 2019 7:42 pm
Re: HL2DM: Winner sound
OK, i will give it a try, thank you. I checked it and it loads and no errors, but it dont work, i get no sound, thank you for trying.
-
- Senior Member
- Posts: 309
- Joined: Sun May 17, 2020 7:56 am
- Location: Finland
- Contact:
Re: HL2DM: Winner sound
Does the game have rounds? i am not familiar to game, i need more details of it when the sound should be played?
- daren adler
- Senior Member
- Posts: 348
- Joined: Sat May 18, 2019 7:42 pm
Re: HL2DM: Winner sound
No rounds, it goes through the maps every 20 min with a map end sound, i need a sound when a player gets 172 score and ends the game before time runs out.
-
- Senior Member
- Posts: 309
- Joined: Sun May 17, 2020 7:56 am
- Location: Finland
- Contact:
Re: HL2DM: Winner sound
Try this it plays sound different way than previous version
Edit:
- Added missing def client_command
Syntax: Select all
from events import Event
from players.helpers import edict_from_userid
from filters.players import PlayerIter
from engines.server import engine_server
from stringtables.downloads import Downloadables
def load():
dl = Downloadables()
dl.add('sound/x/chat/badboys/badboys_001.mp3')
@Event('game_end')
def game_end(args):
if args['winner']:
for i in getUseridList():
playgamesound(i, 'sound/x/chat/badboys/badboys_001.mp3')
def getUseridList():
for i in PlayerIter.iterator():
yield i.userid
def playgamesound(userid, _sound):
client_command(userid, 'play %s' % _sound)
def client_command(userid, __cmd__):
engine_server.client_command(edict_from_userid(userid), __cmd__)
Edit:
- Added missing def client_command
Last edited by cssbestrpg on Sun Feb 28, 2021 8:28 pm, edited 1 time in total.
- daren adler
- Senior Member
- Posts: 348
- Joined: Sat May 18, 2019 7:42 pm
Re: HL2DM: Winner sound
Ok will do, thanks again update, nope no sound on winnner, again thanks for trying,,there were no errors, but again there is no sound.
Who is online
Users browsing this forum: No registered users and 6 guests