Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import es
- import os
- import random
- # CONFIG
- # ab dem sound/ ordner
- pfad_der_sounds = 'meine_sounds/'
- # ENDE CONFIG
- gamedir = es.ServerVar('eventscripts_gamedir')
- custom_path = pfad_der_sounds.replace('/', os.sep)
- sounddir = os.path.join(str(gamedir), 'sound')
- soundfiledir = os.path.join(sounddir, custom_path)
- def updatefiles():
- global soundfiles
- soundfiles = filter(lambda temp: temp.lower().endswitth('.mp3') or temp.lower().endswitth('.wav'), os.listdir(soundfiledir))
- def download():
- updatefiles()
- for s in soundfiles:
- es.stringtable('downloadables', os.path.join(soundfiledir, s))
- def es_map_start(ev):
- download()
- def round_start(ev):
- rs = random.choice(soundfiles)
- for player in es.getUseridList():
- es.playsound(player, os.path.join(custom_path, rs), 1.0)
- download()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement