Advertisement
Guest User

Untitled

a guest
Sep 23rd, 2017
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.82 KB | None | 0 0
  1. import es
  2. import os
  3. import random
  4.  
  5. # CONFIG
  6.  
  7. # ab dem sound/ ordner
  8. pfad_der_sounds = 'meine_sounds/'
  9.  
  10.  
  11. # ENDE CONFIG
  12.  
  13. gamedir = es.ServerVar('eventscripts_gamedir')
  14.  
  15.  
  16.  
  17. custom_path = pfad_der_sounds.replace('/', os.sep)
  18. sounddir = os.path.join(str(gamedir), 'sound')
  19. soundfiledir = os.path.join(sounddir, custom_path)
  20.  
  21. def updatefiles():
  22.     global soundfiles
  23.     soundfiles = filter(lambda temp: temp.lower().endswitth('.mp3') or temp.lower().endswitth('.wav'), os.listdir(soundfiledir))
  24.  
  25. def download():
  26.     updatefiles()
  27.     for s in soundfiles:
  28.         es.stringtable('downloadables', os.path.join(soundfiledir, s))
  29.  
  30. def es_map_start(ev):
  31.     download()
  32.  
  33. def round_start(ev):
  34.     rs = random.choice(soundfiles)
  35.     for player in es.getUseridList():
  36.         es.playsound(player, os.path.join(custom_path, rs), 1.0)
  37.            
  38.            
  39. download()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement