[HL2:DM] problems with admin join sound

Please post any questions about developing your plugin here. Please use the search function before posting!
User avatar
Painkiller
Senior Member
Posts: 725
Joined: Sun Mar 01, 2015 8:09 am
Location: Germany
Contact:

[HL2:DM] problems with admin join sound

Postby Painkiller » Sat Apr 27, 2019 2:54 pm

The plugin loads without problems.
I think it is missing the downloadable in the script.

So I added by hand sound files to the client but even then the sound did not play.

I do not know where that problem lies.


PLUGIN:

Syntax: Select all

import os
from configobj import ConfigObj
from events import Event
from players.helpers import index_from_userid
from players.entity import Player
from engines.sound import Sound
from filters.recipients import RecipientFilter
from filters.players import PlayerIter
from listeners.tick import Delay

admin_list = []

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

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

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

def getAdmin(self, steamid):
return self.admins[steamid]

@property
def getAdmins(self):
return ConfigObj(self.admins)
ini = InI()

def load():
alladmins = ini.getAdmins
for steamid in alladmins:
admin_list.append(steamid)
print(admin_list)


def play_sound(sound):
if sound != "":
for player in PlayerIter():
Sound(sound).play(player.index)

@Event('player_activate')
def _player_activate(event):
player = Player(index_from_userid(event.get_int('userid')))
steamid = player.steamid.strip('[')
steamid = steamid.strip(']')
if steamid in admin_list:
all_admins = ini.getAdmins
admin_info = all_admins[steamid]
join_sound = admin_info['join_sound']
Delay(35, play_sound, join_sound)

@Event('player_disconnect')
def _player_disconnect(event):
player = Player(index_from_userid(event.get_int('userid')))
steamid = player.steamid.strip('[')
steamid = steamid.strip(']')
if steamid in admin_list:
all_admins = ini.getAdmins
admin_info = all_admins[steamid]
disconnect_sound = admin_info['disconnect_sound']
Delay(35, play_sound, disconnect_sound)



CONFIG:

Code: Select all

[U:1:43907303]
   join_sound = "/connect/personal.mp3"
   disconnect_sound = "/connect/see you.mp3"
User avatar
Painkiller
Senior Member
Posts: 725
Joined: Sun Mar 01, 2015 8:09 am
Location: Germany
Contact:

Re: [HL2:DM] problems with admin join sound

Postby Painkiller » Mon Apr 29, 2019 1:35 pm

nobody can help ?
User avatar
Painkiller
Senior Member
Posts: 725
Joined: Sun Mar 01, 2015 8:09 am
Location: Germany
Contact:

Re: [HL2:DM] problems with admin join sound

Postby Painkiller » Mon May 13, 2019 10:11 am

No one a solution why it doesn't work ?

Errors are also not in the logs.

Return to “Plugin Development Support”

Who is online

Users browsing this forum: Bing [Bot] and 39 guests