Page 1 of 2

[HL2:DM] sound

Posted: Thu Apr 27, 2017 12:50 pm
by Painkiller
Since the newest update works the game_text, overlay and the download adder in it no longer.

Can anybody help for repair please?

Syntax: Select all

from events import Event
from players.entity import Player
from filters.players import PlayerIter
from path import path as Path
import sys
from messages import HudMsg
from colors import Color
import os
from configobj import ConfigObj
import core
from messages import SayText2
cfg_list = []
from stringtables.downloads import Downloadables
from listeners.tick import Delay

downloads = Downloadables()

def show_message(index, message):
HudMsg(
message=message,
x=-1.0,
y= 0.3,
color1=Color(255,255,0),
color2=Color(205,0,0),
effect=2,
fade_in=0.01,
fade_out=1.5,
hold_time=8,
fx_time=1.0,
channel=1
).send(index)



def get_addon_path():
path = os.path.dirname(os.path.abspath(__file__))
return path

def play_sound(sound):
for player in PlayerIter("all"):
player.play_sound(sound,1.0,0.0, download=True)

def create_overlay(index, overlay, duration):
player = Player(index)
player.client_command('r_screenoverlay %s' % overlay)
player.delay(duration, remove_overlay, (index))


def remove_overlay(index):
player = Player(index)
player.client_command('r_screenoverlay 0')


#Ini Class
class InI(object):
def __init__(self):
self.path = get_addon_path()

self.config = os.path.join(self.path, 'config', 'config.ini')

@property
def getConfigs(self):
return ConfigObj(self.config)

ini = InI()
for x in ini.getConfigs:
cfg_list.append(x)
file = ini.getConfigs[x]['overlay']
if file != "":
file_vtf = file.replace('.vmt', '.vtf')
downloads.add('materials/' + file)
downloads.add('materials/' + file_vtf)


@Event('player_say')
def player_say(ev):
text = ev['text']
txt = text.lower()
player = Player.from_userid(ev['userid'])
for x in cfg_list:
if set (txt.split()) & set(x.split()):
cfg = ini.getConfigs
if cfg[txt]['gametext'] == "1":
for play in PlayerIter("all"):
if play.index != player.index:
show_message(play.index, "%s: %s" % (player.name, text))
play_sound(cfg[txt]['file'])
if cfg[txt]['overlay'] != "":
for play in PlayerIter("all"):
if play.index != player.index:
create_overlay(play.index, cfg[txt]['overlay'], 3.0)


Syntax: Select all

[aaa]
file = "exae/player/aaa.mp3"
chat = "1"
gametext = "1"
overlay = "exae/bully.vmt"
[abschaum]
file = "exae/player/abschaum.wav"
chat = "1"
gametext = "1"
overlay = "0"
[affe]
file = "exae/player/affe.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[afk]
file = "exae/player/afk.wav"
chat = "1"
gametext = "1"
overlay = "0"
[aie]
file = "exae/player/aie.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[aie2]
file = "exae/player/aie2.wav"
chat = "1"
gametext = "1"
overlay = "0"
[aio]
file = "exae/player/aio.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[alkohol]
file = "exae/player/alkohol.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[arsch]
file = "exae/player/arsch.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[aua]
file = "exae/player/aua.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[aura]
file = "exae/player/aura.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[baby]
file = "exae/player/baby.mp3"
chat = "1"
gametext = "1"
overlay = "trigger/love.vmt"
[bb]
file = "exae/player/bb.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[beine]
file = "exae/player/beine.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[bekloppt]
file = "exae/player/bekloppt.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[bitte]
file = "exae/player/bitte.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[blamage]
file = "exae/player/blamage.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[blau]
file = "exae/player/blau.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[bleispucker]
file = "exae/player/bleispucker.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[blicken]
file = "exae/player/blicken.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[blitz]
file = "exae/player/blitz.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[buh]
file = "exae/player/buh.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[bums]
file = "exae/player/bums.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[burste]
file = "exae/player/burste.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[cheater]
file = "exae/player/cheater.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[clint]
file = "exae/player/clint.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[cry]
file = "exae/player/cry.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[cu]
file = "exae/player/cu.wav"
chat = "1"
gametext = "1"
overlay = "0"
[cya]
file = "exae/player/cya.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[danke]
file = "exae/player/danke.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[deitscher]
file = "exae/player/deitscher.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[doch]
file = "exae/player/doch.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[drogen]
file = "exae/player/drogen.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[drs]
file = "exae/player/drs.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[eier]
file = "exae/player/eier.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[eisprung]
file = "exae/player/eisprung.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[endstress]
file = "exae/player/endstress.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[erster]
file = "exae/player/erster.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[fack]
file = "exae/player/fack.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[furtz]
file = "exae/player/fart_01.wav"
chat = "1"
gametext = "1"
overlay = "0"
[faxen]
file = "exae/player/faxen.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[fds]
file = "exae/player/fds.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[fehlt]
file = "exae/player/fehlt.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[feierabend]
file = "exae/player/feierabend.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[fencheltee]
file = "exae/player/fencheltee.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[flieg]
file = "exae/player/flieg.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[fresse]
file = "exae/player/fresse.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[freund]
file = "exae/player/freund.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[froh]
file = "exae/player/froh.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[fu]
file = "exae/player/fu.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[fuchs]
file = "exae/player/fuchs.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[fuck]
file = "exae/player/fuck.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[gb]
file = "exae/player/gb.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[gehf]
file = "exae/player/gehf.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[geklaut]
file = "exae/player/geklaut.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[genau]
file = "exae/player/genau.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[gg]
file = "exae/player/gg.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[gr]
file = "exae/player/gr.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[grr]
file = "exae/player/grr.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[gute_nacht]
file = "exae/player/gute_nacht.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[hacker]
file = "exae/player/hacker.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[haha]
file = "exae/player/haha.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[hallo]
file = "exae/player/hallo.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[hehe]
file = "exae/player/hehe.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[hello]
file = "exae/player/hello.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[heul]
file = "exae/player/heul.wav"
chat = "1"
gametext = "1"
overlay = "0"
[hi]
file = "exae/player/hi.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[hihi]
file = "exae/player/hihi.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[hirn]
file = "exae/player/hirn.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[hoho]
file = "exae/player/hoho.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[inr]
file = "exae/player/inr.wav"
chat = "1"
gametext = "1"
overlay = "0"
[ja]
file = "exae/player/ja.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[jaja]
file = "exae/player/jaja.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[jaw]
file = "exae/player/jaw.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[jep]
file = "exae/player/jep.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[juhu]
file = "exae/player/juhu.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[ka]
file = "exae/player/ka.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[kackbratze]
file = "exae/player/kackbratze.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[kacken]
file = "exae/player/kacken.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[kacker]
file = "exae/player/kacker.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[kbad]
file = "exae/player/kbad.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[kippe]
file = "exae/player/kippe.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[komm]
file = "exae/player/komm.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[kommischwein]
file = "exae/player/kommischwein.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[kotzen]
file = "exae/player/kotzen.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[krampe]
file = "exae/player/krampe.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[krieg]
file = "exae/player/krieg.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[lauf]
file = "exae/player/lauf.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[leben]
file = "exae/player/leben.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[leistung]
file = "exae/player/leistung.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[list]
file = "exae/player/list.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[lmaa]
file = "exae/player/lmaa.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[lol]
file = "exae/player/lol.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[lool]
file = "exae/player/lool.wav"
chat = "1"
gametext = "1"
overlay = "0"
[lsd]
file = "exae/player/lsd.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[lucker]
file = "exae/player/lucker.wav"
chat = "1"
gametext = "1"
overlay = "0"
[liste]
file = "exae/player/liste.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[memme]
file = "exae/player/memme.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[mf]
file = "exae/player/mf.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[minen]
file = "exae/player/minen.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[moin]
file = "exae/player/moin.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[moo]
file = "exae/player/moo.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[morning]
file = "exae/player/morning.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[n1]
file = "exae/player/n1.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[nabend]
file = "exae/player/nabend.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[nach]
file = "exae/player/nach.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[nachwuchs]
file = "exae/player/nachwuchs.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[nein]
file = "exae/player/nein.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[nice]
file = "exae/player/nice.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[np]
file = "exae/player/np.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[ns]
file = "exae/player/ns.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[ns1]
file = "exae/player/ns1.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[ns2]
file = "exae/player/ns2.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[ns3]
file = "exae/player/ns3.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[ok]
file = "exae/player/ok.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[olm]
file = "exae/player/olm.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[omg]
file = "exae/player/omg.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[pissen]
file = "exae/player/pissen.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[pump]
file = "exae/player/pump.wav"
chat = "1"
gametext = "1"
overlay = "0"
[ramba]
file = "exae/player/ramba.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[richtig]
file = "exae/player/richtig.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[richtung]
file = "exae/player/richtung.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[rofl]
file = "exae/player/rofl.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[sack]
file = "exae/player/sackdu.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[sag]
file = "exae/player/sag.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[sani]
file = "exae/player/sani.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[sau]
file = "exae/player/sau.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[sau2]
file = "exae/player/sau2.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[schei]
file = "exae/player/schei.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[schlafen]
file = "exae/player/schlafen.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[schuss]
file = "exae/player/schuss.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[schwein]
file = "exae/player/schwein.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[schweine]
file = "exae/player/schweine.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[send]
file = "exae/player/send.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[soo]
file = "exae/player/soo.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[spass]
file = "exae/player/spass.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[spawn]
file = "exae/player/spawn.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[spray]
file = "exae/player/spray.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[sry]
file = "exae/player/sry.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[studi]
file = "exae/player/studi.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[thx]
file = "exae/player/thx.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[ty]
file = "exae/player/ty.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[ty1]
file = "exae/player/ty1.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[type]
file = "exae/player/type.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[ups]
file = "exae/player/ups.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[uncool]
file = "exae/player/uncool.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[viva]
file = "exae/player/viva.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[vp]
file = "exae/player/vp.wav"
chat = "1"
gametext = "1"
overlay = "0"
[wall]
file = "exae/player/wallhacker.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[wanna]
file = "exae/player/wannahavefun.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[wer]
file = "exae/player/wer.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[werlacht]
file = "exae/player/werlacht.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[win]
file = "exae/player/win.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[wo]
file = "exae/player/wo.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[wtf]
file = "exae/player/wtf.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[wtf1]
file = "exae/player/wtf1.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[wtf2]
file = "exae/player/wtf2.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[wtf3]
file = "exae/player/wtf3.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[yes]
file = "exae/player/yes.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[zaehne]
file = "exae/player/zaehne.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[zigi]
file = "exae/player/zigipause.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[bein]
file = "exae/player/bein.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[bett]
file = "exae/player/bett.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[bew]
file = "exae/player/bew.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[bier]
file = "exae/player/bier.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[bla]
file = "exae/player/bla.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[bob]
file = "exae/player/bob.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[ecke]
file = "exae/player/ecke.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[heim]
file = "exae/player/heim.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[hund]
file = "exae/player/hund.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[jamm]
file = "exae/player/jamm.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[kack]
file = "exae/player/kack.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[orga]
file = "exae/player/orga.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[tot]
file = "exae/player/tot.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[uelm]
file = "exae/player/uelm.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[wie]
file = "exae/player/wie.mp3"
chat = "1"
gametext = "1"
overlay = "0"
[dsl]
file = "vo/npc/female01/sorry03.wav"
chat = "1"
gametext = "1"
overlay = "0"
[hmm]
file = "vo/k_lab/al_moveon01.wav"
chat = "1"
gametext = "1"
overlay = "trigger/headshot.vmt"

Re: [HL2:DM] sound

Posted: Thu Apr 27, 2017 1:32 pm
by iPlayer
Why do I feel like this line

Syntax: Select all

player.delay(duration, remove_overlay, (index))

should be raising exceptions?

Do you get exceptions?

Re: [HL2:DM] sound

Posted: Thu Apr 27, 2017 1:37 pm
by Painkiller
I get no errors and I have not written this script.

What should I do?

Re: [HL2:DM] sound

Posted: Thu Apr 27, 2017 1:41 pm
by iPlayer
Whoever wrote that line in the first place made a mistake. That line cannot be correct.

https://github.com/Source-Python-Dev-Team/Source.Python/blob/0834c5811020b29b10238f1a6e230da3fd639df4/addons/source-python/packages/source-python/entities/_base.py#L691

The third argument should be iterable. While you just pass an integer.

Who wrote that line?

Re: [HL2:DM] sound

Posted: Thu Apr 27, 2017 1:45 pm
by Painkiller
I do not want to embarrass anyone.

Could you fix it?

Re: [HL2:DM] sound

Posted: Thu Apr 27, 2017 1:48 pm
by iPlayer
Nope, sorry. Maybe somebody else.

But I'd recommend you to consult whoever wrote that plugin. Simply because reading somebody else's code is harder than reading your own code. You'd make things easier for everyone.

Re: [HL2:DM] sound

Posted: Thu Apr 27, 2017 4:20 pm
by PhantomDancer
broken - since last HL2 update or last SP update? you should probably make it clear..

Re: [HL2:DM] sound

Posted: Thu Apr 27, 2017 4:28 pm
by Painkiller
Last SP Update ^^

The last update of hl2dm was:

Since there was Sourcepython not yet ^ ^

Re: [HL2:DM] sound

Posted: Mon May 01, 2017 2:13 pm
by Painkiller
iPlayer wrote:Nope, sorry. Maybe somebody else.

But I'd recommend you to consult whoever wrote that plugin. Simply because reading somebody else's code is harder than reading your own code. You'd make things easier for everyone.

It will probably no longer be possible.

Perhaps someone else could take it?

Re: [HL2:DM] sound

Posted: Mon May 01, 2017 2:45 pm
by PhantomDancer

Re: [HL2:DM] sound

Posted: Mon May 01, 2017 3:16 pm
by satoon101
Could you paste the config.ini file here, too? Please use [ini][/ini] around the contents when you paste it.

Re: [HL2:DM] sound

Posted: Wed May 03, 2017 5:11 pm
by Painkiller
satoon101 wrote:Could you paste the config.ini file here, too? Please use [ini][/ini] around the contents when you paste it.

Ok i have Edit the First Thraid.

Re: [HL2:DM] sound

Posted: Sun May 07, 2017 2:18 pm
by satoon101
Ok, I cleaned up the code quite a bit, but I have not tested the following:

Syntax: Select all

# =============================================================================
# >> IMPORTS
# =============================================================================
# Python
from collections import defaultdict

# Site-Package
from configobj import ConfigObj
from path import Path

# Source.Python
from colors import Color
from engines.sound import Sound
from events import Event
from filters.players import PlayerIter
from messages import HudMsg
from paths import CFG_PATH
from players.entity import Player
from stringtables.downloads import Downloadables


# =============================================================================
# >> GLOBAL VARIABLES
# =============================================================================
ini = ConfigObj(CFG_PATH / Path(__file__).namebase + '.ini', unrepr=True)

downloads = Downloadables()

text_dict = defaultdict(dict)
for key, value in ini.items():
if value.get('message'):
text_dict[key]['message'] = HudMsg(
message='{name}: ' + key,
x=-1.0,
y= 0.3,
color1=Color(255,255,0),
color2=Color(205,0,0),
effect=2,
fade_in=0.01,
fade_out=1.5,
hold_time=8,
fx_time=1.0,
channel=1
)

sound = value.get('sound')
if sound:
text_dict[key]['sound'] = Sound(
sample=sound,
download=True,
)

overlay = value.get('overlay')
if overlay:
text_dict[key]['overlay'] = overlay
downloads.add('materials/' + overlay)
downloads.add('materials/' + overlay.replace('.vmt', '.vtf'))


# =============================================================================
# >> GAME EVENTS
# =============================================================================
@Event('player_say')
def player_say(game_event):
text = game_event['text'].lower()
group = text_dict.get(text)
if group is None:
return

player = Player.from_userid(game_event['userid'])
recipients = get_recipients(player.index)
message = group.get('message')
if message:
message.send(*recipients, name=player.name)

sound = group.get('sound')
if sound is not None:
sound.play()

overlay = group.get('overlay')
if overlay is not None:
for index in recipients:
other = Player(index)
other.client_command(
'r_screenoverlay {overlay}'.format(
overlay=overlay,
)
)
other.delay(
delay=3,
callback=other.client_command,
args=('r_screenoverlay 0', ),
)


# =============================================================================
# >> HELPER FUNCTIONS
# =============================================================================
def get_recipients(index):
index_list = []
for player in PlayerIter('human'):
if player.index != index:
index_list.append(player.index)
return index_list


I also cleaned up the ini file. I did notice that the plugin does not use the "chat" value to send a SayText2 message, so I removed those from the ini file completely. When you add any new ones, only add the "overlay" key/value pair if there is an overlay. Save the following file in your server's ../cfg/source-python/ directory using the exact same name as you use for the plugin itself. As an example, if the plugin is at ../addons/source-python/plugins/test/test.py, the ini file sould be at ../cfg/source-python/test.ini.

Syntax: Select all

[aaa]
sound = "exae/player/aaa.mp3"
message = 1
overlay = "exae/bully.vmt"

[abschaum]
sound = "exae/player/abschaum.wav"
message = 1

[affe]
sound = "exae/player/affe.mp3"
message = 1

[afk]
sound = "exae/player/afk.wav"
message = 1

[aie]
sound = "exae/player/aie.mp3"
message = 1

[aie2]
sound = "exae/player/aie2.wav"
message = 1

[aio]
sound = "exae/player/aio.mp3"
message = 1

[alkohol]
sound = "exae/player/alkohol.mp3"
message = 1

[arsch]
sound = "exae/player/arsch.mp3"
message = 1

[aua]
sound = "exae/player/aua.mp3"
message = 1

[aura]
sound = "exae/player/aura.mp3"
message = 1

[baby]
sound = "exae/player/baby.mp3"
message = 1
overlay = "trigger/love.vmt"

[bb]
sound = "exae/player/bb.mp3"
message = 1

[beine]
sound = "exae/player/beine.mp3"
message = 1

[bekloppt]
sound = "exae/player/bekloppt.mp3"
message = 1

[bitte]
sound = "exae/player/bitte.mp3"
message = 1

[blamage]
sound = "exae/player/blamage.mp3"
message = 1

[blau]
sound = "exae/player/blau.mp3"
message = 1

[bleispucker]
sound = "exae/player/bleispucker.mp3"
message = 1

[blicken]
sound = "exae/player/blicken.mp3"
message = 1

[blitz]
sound = "exae/player/blitz.mp3"
message = 1

[buh]
sound = "exae/player/buh.mp3"
message = 1

[bums]
sound = "exae/player/bums.mp3"
message = 1

[burste]
sound = "exae/player/burste.mp3"
message = 1

[cheater]
sound = "exae/player/cheater.mp3"
message = 1

[clint]
sound = "exae/player/clint.mp3"
message = 1

[cry]
sound = "exae/player/cry.mp3"
message = 1

[cu]
sound = "exae/player/cu.wav"
message = 1

[cya]
sound = "exae/player/cya.mp3"
message = 1

[danke]
sound = "exae/player/danke.mp3"
message = 1

[deitscher]
sound = "exae/player/deitscher.mp3"
message = 1

[doch]
sound = "exae/player/doch.mp3"
message = 1

[drogen]
sound = "exae/player/drogen.mp3"
message = 1

[drs]
sound = "exae/player/drs.mp3"
message = 1

[eier]
sound = "exae/player/eier.mp3"
message = 1

[eisprung]
sound = "exae/player/eisprung.mp3"
message = 1

[endstress]
sound = "exae/player/endstress.mp3"
message = 1

[erster]
sound = "exae/player/erster.mp3"
message = 1

[fack]
sound = "exae/player/fack.mp3"
message = 1

[furtz]
sound = "exae/player/fart_01.wav"
message = 1

[faxen]
sound = "exae/player/faxen.mp3"
message = 1

[fds]
sound = "exae/player/fds.mp3"
message = 1

[fehlt]
sound = "exae/player/fehlt.mp3"
message = 1

[feierabend]
sound = "exae/player/feierabend.mp3"
message = 1

[fencheltee]
sound = "exae/player/fencheltee.mp3"
message = 1

[flieg]
sound = "exae/player/flieg.mp3"
message = 1

[fresse]
sound = "exae/player/fresse.mp3"
message = 1

[freund]
sound = "exae/player/freund.mp3"
message = 1

[froh]
sound = "exae/player/froh.mp3"
message = 1

[fu]
sound = "exae/player/fu.mp3"
message = 1

[fuchs]
sound = "exae/player/fuchs.mp3"
message = 1

[fuck]
sound = "exae/player/fuck.mp3"
message = 1

[gb]
sound = "exae/player/gb.mp3"
message = 1

[gehf]
sound = "exae/player/gehf.mp3"
message = 1

[geklaut]
sound = "exae/player/geklaut.mp3"
message = 1

[genau]
sound = "exae/player/genau.mp3"
message = 1

[gg]
sound = "exae/player/gg.mp3"
message = 1

[gr]
sound = "exae/player/gr.mp3"
message = 1

[grr]
sound = "exae/player/grr.mp3"
message = 1

[gute_nacht]
sound = "exae/player/gute_nacht.mp3"
message = 1

[hacker]
sound = "exae/player/hacker.mp3"
message = 1

[haha]
sound = "exae/player/haha.mp3"
message = 1

[hallo]
sound = "exae/player/hallo.mp3"
message = 1

[hehe]
sound = "exae/player/hehe.mp3"
message = 1

[hello]
sound = "exae/player/hello.mp3"
message = 1

[heul]
sound = "exae/player/heul.wav"
message = 1

[hi]
sound = "exae/player/hi.mp3"
message = 1

[hihi]
sound = "exae/player/hihi.mp3"
message = 1

[hirn]
sound = "exae/player/hirn.mp3"
message = 1

[hoho]
sound = "exae/player/hoho.mp3"
message = 1

[inr]
sound = "exae/player/inr.wav"
message = 1

[ja]
sound = "exae/player/ja.mp3"
message = 1

[jaja]
sound = "exae/player/jaja.mp3"
message = 1

[jaw]
sound = "exae/player/jaw.mp3"
message = 1

[jep]
sound = "exae/player/jep.mp3"
message = 1

[juhu]
sound = "exae/player/juhu.mp3"
message = 1

[ka]
sound = "exae/player/ka.mp3"
message = 1

[kackbratze]
sound = "exae/player/kackbratze.mp3"
message = 1

[kacken]
sound = "exae/player/kacken.mp3"
message = 1

[kacker]
sound = "exae/player/kacker.mp3"
message = 1

[kbad]
sound = "exae/player/kbad.mp3"
message = 1

[kippe]
sound = "exae/player/kippe.mp3"
message = 1

[komm]
sound = "exae/player/komm.mp3"
message = 1

[kommischwein]
sound = "exae/player/kommischwein.mp3"
message = 1

[kotzen]
sound = "exae/player/kotzen.mp3"
message = 1

[krampe]
sound = "exae/player/krampe.mp3"
message = 1

[krieg]
sound = "exae/player/krieg.mp3"
message = 1

[lauf]
sound = "exae/player/lauf.mp3"
message = 1

[leben]
sound = "exae/player/leben.mp3"
message = 1

[leistung]
sound = "exae/player/leistung.mp3"
message = 1

[list]
sound = "exae/player/list.mp3"
message = 1

[lmaa]
sound = "exae/player/lmaa.mp3"
message = 1

[lol]
sound = "exae/player/lol.mp3"
message = 1

[lool]
sound = "exae/player/lool.wav"
message = 1

[lsd]
sound = "exae/player/lsd.mp3"
message = 1

[lucker]
sound = "exae/player/lucker.wav"
message = 1

[liste]
sound = "exae/player/liste.mp3"
message = 1

[memme]
sound = "exae/player/memme.mp3"
message = 1

[mf]
sound = "exae/player/mf.mp3"
message = 1

[minen]
sound = "exae/player/minen.mp3"
message = 1

[moin]
sound = "exae/player/moin.mp3"
message = 1

[moo]
sound = "exae/player/moo.mp3"
message = 1

[morning]
sound = "exae/player/morning.mp3"
message = 1

[n1]
sound = "exae/player/n1.mp3"
message = 1

[nabend]
sound = "exae/player/nabend.mp3"
message = 1

[nach]
sound = "exae/player/nach.mp3"
message = 1

[nachwuchs]
sound = "exae/player/nachwuchs.mp3"
message = 1

[nein]
sound = "exae/player/nein.mp3"
message = 1

[nice]
sound = "exae/player/nice.mp3"
message = 1

[np]
sound = "exae/player/np.mp3"
message = 1

[ns]
sound = "exae/player/ns.mp3"
message = 1

[ns1]
sound = "exae/player/ns1.mp3"
message = 1

[ns2]
sound = "exae/player/ns2.mp3"
message = 1

[ns3]
sound = "exae/player/ns3.mp3"
message = 1

[ok]
sound = "exae/player/ok.mp3"
message = 1

[olm]
sound = "exae/player/olm.mp3"
message = 1

[omg]
sound = "exae/player/omg.mp3"
message = 1

[pissen]
sound = "exae/player/pissen.mp3"
message = 1

[pump]
sound = "exae/player/pump.wav"
message = 1

[ramba]
sound = "exae/player/ramba.mp3"
message = 1

[richtig]
sound = "exae/player/richtig.mp3"
message = 1

[richtung]
sound = "exae/player/richtung.mp3"
message = 1

[rofl]
sound = "exae/player/rofl.mp3"
message = 1

[sack]
sound = "exae/player/sackdu.mp3"
message = 1

[sag]
sound = "exae/player/sag.mp3"
message = 1

[sani]
sound = "exae/player/sani.mp3"
message = 1

[sau]
sound = "exae/player/sau.mp3"
message = 1

[sau2]
sound = "exae/player/sau2.mp3"
message = 1

[schei]
sound = "exae/player/schei.mp3"
message = 1

[schlafen]
sound = "exae/player/schlafen.mp3"
message = 1

[schuss]
sound = "exae/player/schuss.mp3"
message = 1

[schwein]
sound = "exae/player/schwein.mp3"
message = 1

[schweine]
sound = "exae/player/schweine.mp3"
message = 1

[send]
sound = "exae/player/send.mp3"
message = 1

[soo]
sound = "exae/player/soo.mp3"
message = 1

[spass]
sound = "exae/player/spass.mp3"
message = 1

[spawn]
sound = "exae/player/spawn.mp3"
message = 1

[spray]
sound = "exae/player/spray.mp3"
message = 1

[sry]
sound = "exae/player/sry.mp3"
message = 1

[studi]
sound = "exae/player/studi.mp3"
message = 1

[thx]
sound = "exae/player/thx.mp3"
message = 1

[ty]
sound = "exae/player/ty.mp3"
message = 1

[ty1]
sound = "exae/player/ty1.mp3"
message = 1

[type]
sound = "exae/player/type.mp3"
message = 1

[ups]
sound = "exae/player/ups.mp3"
message = 1

[uncool]
sound = "exae/player/uncool.mp3"
message = 1

[viva]
sound = "exae/player/viva.mp3"
message = 1

[vp]
sound = "exae/player/vp.wav"
message = 1

[wall]
sound = "exae/player/wallhacker.mp3"
message = 1

[wanna]
sound = "exae/player/wannahavefun.mp3"
message = 1

[wer]
sound = "exae/player/wer.mp3"
message = 1

[werlacht]
sound = "exae/player/werlacht.mp3"
message = 1

[win]
sound = "exae/player/win.mp3"
message = 1

[wo]
sound = "exae/player/wo.mp3"
message = 1

[wtf]
sound = "exae/player/wtf.mp3"
message = 1

[wtf1]
sound = "exae/player/wtf1.mp3"
message = 1

[wtf2]
sound = "exae/player/wtf2.mp3"
message = 1

[wtf3]
sound = "exae/player/wtf3.mp3"
message = 1

[yes]
sound = "exae/player/yes.mp3"
message = 1

[zaehne]
sound = "exae/player/zaehne.mp3"
message = 1

[zigi]
sound = "exae/player/zigipause.mp3"
message = 1

[bein]
sound = "exae/player/bein.mp3"
message = 1

[bett]
sound = "exae/player/bett.mp3"
message = 1

[bew]
sound = "exae/player/bew.mp3"
message = 1

[bier]
sound = "exae/player/bier.mp3"
message = 1

[bla]
sound = "exae/player/bla.mp3"
message = 1

[bob]
sound = "exae/player/bob.mp3"
message = 1

[ecke]
sound = "exae/player/ecke.mp3"
message = 1

[heim]
sound = "exae/player/heim.mp3"
message = 1

[hund]
sound = "exae/player/hund.mp3"
message = 1

[jamm]
sound = "exae/player/jamm.mp3"
message = 1

[kack]
sound = "exae/player/kack.mp3"
message = 1

[orga]
sound = "exae/player/orga.mp3"
message = 1

[tot]
sound = "exae/player/tot.mp3"
message = 1

[uelm]
sound = "exae/player/uelm.mp3"
message = 1

[wie]
sound = "exae/player/wie.mp3"
message = 1

[dsl]
sound = "vo/npc/female01/sorry03.wav"
message = 1

[hmm]
sound = "vo/k_lab/al_moveon01.wav"
message = 1
overlay = "trigger/headshot.vmt"


Again, this is untested, so please let me know what does/doesn't work when you have tested it out yourself.

Re: [HL2:DM] sound

Posted: Mon May 08, 2017 2:00 pm
by Painkiller
Ok i have tested and become this error:

15:59:02 sp plugin reload sound_trigger
15:59:02 [SP] Unloading plugin 'sound_trigger'...
[SP] Unable to unload plugin 'sound_trigger' as it is not currently loaded.
[SP] Loading plugin 'sound_trigger'...

[SP] Caught an Exception:
Traceback (most recent call last):
File "../addons/source-python/packages/source-python/plugins/command.py", line 162, in load_plugin
plugin = self.manager.load(plugin_name)
File "../addons/source-python/packages/source-python/plugins/manager.py", line 193, in load
plugin._load()
File "../addons/source-python/packages/source-python/plugins/instance.py", line 74, in _load
self.module = import_module(self.import_name)
File "../addons/source-python/plugins/sound_trigger/sound_trigger.py", line 31
if value.get('message')
^

SyntaxError: invalid syntax


[SP] Plugin 'sound_trigger' was unable to be loaded.

Re: [HL2:DM] sound

Posted: Mon May 08, 2017 2:05 pm
by satoon101
Like I said, I that is untested, so there could be more of those errors, as well. I fixed that error above.

Re: [HL2:DM] sound

Posted: Mon May 08, 2017 2:15 pm
by Painkiller
Edit 1:

Ok my mistake.

Ok i see the game_text and listen sound.
But show: {name}:lol not {Painkiller}:lol and i see no overlay.

Edit 2:
Image

Re: [HL2:DM] sound

Posted: Fri May 12, 2017 8:04 am
by Painkiller
satoon101 wrote:Like I said, I that is untested, so there could be more of those errors, as well. I fixed that error above.


Hey Satoon,
Would you please look at it again?

Re: [HL2:DM] sound

Posted: Fri May 12, 2017 11:56 am
by satoon101
We're working on a fix for the message, so look for that to be corrected in an SP update here soon. As far as the overlay, there are only 3 commands in your original .ini file that actually have one, and "lol" is not one of those 3. The 3 are "baby", "hmm", and "aaa".

Re: [HL2:DM] sound

Posted: Fri May 12, 2017 12:41 pm
by Painkiller
Thank you for the info.

Yes I tested hmm, baby and aaa but it does not indicate anything.

I also noticed that the overlay is not downloaded.
I tried different and grabbed this also in the client folder to test it.

There seems to be no overlay.

Edit:
I found this:

Code: Select all

signed>" say "aaa"
Spawn/Chat Protection;  FireGameEvent handle PlayerSay, name = 'player_say'

Re: [HL2:DM] sound

Posted: Fri May 12, 2017 1:11 pm
by satoon101
The next SP update should fix the name issue. For the overlays, what directory are they in on the server? Do you have a fast-download server?