Skip to content

Commit

Permalink
Added #mutespectators and #unmutespectators
Browse files Browse the repository at this point in the history
  • Loading branch information
greghaynes committed Nov 10, 2009
1 parent 63de1cd commit 1f326e0
Showing 1 changed file with 29 additions and 1 deletion.
30 changes: 29 additions & 1 deletion src/pyscripts/Mute/mute.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,42 @@
del config
muted_temp = string.Template(muted_temp)
unmuted_temp = string.Template(unmuted_temp)
mute_spectators = [False]

def allowMsg(cn, text):
try:
if mute_spectators[0] == True and player(cn).isSpectator():
sbserver.playerMessage(cn, notice('Spectators are currently muted. No one will recieve your message'))
return False
if player(cn).is_muted:
sbserver.playerMessage(cn, notice('You are currently muted. No one will recieve your messages.'))
sbserver.playerMessage(cn, notice('You are currently muted. No one will recieve your message'))
return False
except (AttributeError, ValueError):
pass
return True

@masterRequired
def onMuteSpectatorsCmd(cn, args):
if args == '':
if mute_spectators[0] == True:
player(cn).message(error('Spectators are arleady muted'))
else:
mute_spectators[0] = True
sbserver.message(notice('Spectators are now muted'))
else:
player(cn).message(error('Usage: #mutespectators'))

@masterRequired
def onUnMuteSpectatorsCmd(cn, args):
if args == '':
if mute_spectators[0] == False:
player(cn).message(error('Spectators are not currently muted'))
else:
mute_spectators[0] = False
sbserver.message(notice('Spectators are no longer muted'))
else:
player(cn).message(error('Usage: #unmutespectators'))

@masterRequired
def onMuteCommand(cn, args):
try:
Expand Down Expand Up @@ -69,6 +95,8 @@ def onUnmuteCommand(cn, args):
sbserver.playerMessage(cn, error('Invalid player cn'))

registerPolicyEventHandler('allow_message', allowMsg)
registerCommandHandler('mutespectators', onMuteSpectatorsCmd)
registerCommandHandler('unmutespectators', onUnMuteSpectatorsCmd)
registerCommandHandler('mute', onMuteCommand)
registerCommandHandler('unmute', onUnmuteCommand)

0 comments on commit 1f326e0

Please sign in to comment.