# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # Bonbon's Server Mute Control with mutelib # # Requires: # # Eventscripts 2.0 # # # # # # add the line es_load bmute to your autoexec.cfg # # # # Thank you to: # # # # # # # # If you have any questions e-mail me at: # # drunkenmousehide@hotmail.com # # or use the PMS on the eventscripts formums # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # import es, gamethread, os.path, popuplib, playerlib, pickle mute_info = {} admins = ('STEAM_0:0:11089864', 'STEAM_0:0:0000000') def load(): global mute_info es.msg('#multi', '#green[#lightgreenBMute#green]: Loaded') if not es.exists('saycommand', '!mute'): es.regsaycmd('!mute', 'bmute/mute', 'Mute a player') if not es.exists('saycommand', '!unmute'): es.regsaycmd('!unmute', 'bmute/unmute', 'Unmute a player') mute_data = es.getAddonPath('bmute') + '/muted.db' if os.path.isfile(mute_data): mute_players_restore = open(mute_data) mute_info = pickle.load(mute_players_restore) mute_players_restore.close() def unload(): es.msg('#multi', '#green[#lightgreenBMute#green]: Unloaded') if es.exists('saycommand', '!mute'): es.unregsaycmd('!mute') if es.exists('saycommand', '!unmute'): es.unregsaycmd('!unmute') mute_players_restore = open(es.getAddonPath('bmute') + '/muted.db', 'w') pickle.dump(mute_info, mute_players_restore) mute_players_restore.close() def player_activate(event_var): checkmute(event_var['es_steamid']) def round_end(event_var): mute_players_restore = open(es.getAddonPath('bmute') + '/muted.db', 'w') pickle.dump(mute_info, mute_players_restore) mute_players_restore.close() def mute(): global mute_info userid = es.getcmduserid() if playerlib.getPlayer(userid).get('steamid') in admins: steamid = es.getargv(1) + es.getargv(2) + es.getargv(3) + es.getargv(4) + es.getargv(5) mute_info[steamid] = {} muted_time = es.getargv(6) reason = es.getargs().replace(steamid, '').replace(muted_time, '') mute_info[steamid]['reason'] = reason mute_info[steamid]['time'] = muted_time menu = popuplib.easymenu('You are Muted', '_popup_choice', muted_menuselect) menu.addoption(muted_menuselect, 'Time: %s'%mute_info[steamid]['time']) menu.addoption(muted_menuselect, 'Reason: %s'%mute_info[steamid]['reason']) if steamid.startswith('STEAM_0:0:') or steamid.startswith('STEAM_0:1:'): if es.getargc() >= 7: es.server.queuecmd('ma_mute "%s" 1'%steamid) for userid2 in playerlib.getUseridList('#all'): if playerlib.getPlayer(userid2).attributes['steamid'] == steamid: popuplib.send('You are Muted', userid2) else: es.tell(userid, '#multi', '#green[#lightgreenBMute#green]: Invalid syntax') es.tell(userid, '#multi', '#green[#lightgreenBMute#green]: Syntax = !mute