HL2DM: Winner sound

A place for requesting new Source.Python plugins to be made for your server.

Please request only one plugin per thread.
User avatar
daren adler
Senior Member
Posts: 348
Joined: Sat May 18, 2019 7:42 pm

HL2DM: Winner sound

Postby daren adler » Sun Feb 28, 2021 6:18 am

:wink: Hello game scripters :smile: 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.
cssbestrpg
Senior Member
Posts: 309
Joined: Sun May 17, 2020 7:56 am
Location: Finland
Contact:

Re: HL2DM: Winner sound

Postby cssbestrpg » Sun Feb 28, 2021 10:48 am

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()
User avatar
daren adler
Senior Member
Posts: 348
Joined: Sat May 18, 2019 7:42 pm

Re: HL2DM: Winner sound

Postby daren adler » Sun Feb 28, 2021 5:54 pm

OK, i will give it a try, thank you. :grin: :grin: I checked it and it loads and no errors, but it dont work, i get no sound, thank you for trying.
cssbestrpg
Senior Member
Posts: 309
Joined: Sun May 17, 2020 7:56 am
Location: Finland
Contact:

Re: HL2DM: Winner sound

Postby cssbestrpg » Sun Feb 28, 2021 7:37 pm

Does the game have rounds? i am not familiar to game, i need more details of it when the sound should be played?
User avatar
daren adler
Senior Member
Posts: 348
Joined: Sat May 18, 2019 7:42 pm

Re: HL2DM: Winner sound

Postby daren adler » Sun Feb 28, 2021 8:06 pm

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.
cssbestrpg
Senior Member
Posts: 309
Joined: Sun May 17, 2020 7:56 am
Location: Finland
Contact:

Re: HL2DM: Winner sound

Postby cssbestrpg » Sun Feb 28, 2021 8:13 pm

Try this it plays sound different way than previous version

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.
User avatar
daren adler
Senior Member
Posts: 348
Joined: Sat May 18, 2019 7:42 pm

Re: HL2DM: Winner sound

Postby daren adler » Sun Feb 28, 2021 8:25 pm

Ok will do, thanks again :cool: :cool: update, nope no sound on winnner, again thanks for trying,,there were no errors, but again there is no sound.

Return to “Plugin Requests”

Who is online

Users browsing this forum: No registered users and 6 guests