def onDuelCommand(cn, args): if args == '': sbserver.playerMessage( cn, error('Usage: #duel <mapname> (mode) (cn) (cn)')) args = args.split(' ') players = sbserver.players() if len(players) != 2: sbserver.playerMessage( cn, error( 'There must be only two unspectated players to enter duel mode.' )) else: if len(args) == 2: map = args[0] mode = int(args[1]) elif len(args) == 1: map = args[0] mode = sbserver.gameMode() else: sbserver.playerMessage(cn, error('Usage: #duel <mapname> (mode)')) return duelers[0] = players[0] duelers[1] = players[1] prev_mastermode = sbserver.masterMode() sbserver.setMasterMode(2) sbserver.message(green('Duel begins in...')) duelCountdown(5, map, mode)
def setMasterMode(mm_number): '''Set server master mode. 0 - open 1 - veto 2 - locked 3 - private''' sbserver.setMasterMode(mm_number)
def masterMode(caller,name=None): """This changes the mastermode in the same way that /mastermode does without the need to have claimed master or admin.""" if name==None: return sbserver.masterMode() mastermode=mastermodeNumber(name) if config["serverpublic"]=="1": if mastermode>=2: UserSessionManager.checkPermissions(caller,"trusted") if config["serverpublic"]=="2": if mastermode>=3: UserSessionManager.checkPermissions(caller,"trusted") return sbserver.setMasterMode(mastermode)
def onDuelCommand(cn, args): if args == '': sbserver.playerMessage(cn, error('Usage: #duel <mapname> (mode) (cn) (cn)')) args = args.split(' ') players = sbserver.players() if len(players) != 2: sbserver.playerMessage(cn, error('There must be only two unspectated players to enter duel mode.')) else: if len(args) == 2: map = args[0] mode = int(args[1]) elif len(args) == 1: map = args[0] mode = sbserver.gameMode() else: sbserver.playerMessage(cn, error('Usage: #duel <mapname> (mode)')) return duelers[0] = players[0] duelers[1] = players[1] prev_mastermode = sbserver.masterMode() sbserver.setMasterMode(2) sbserver.message(green('Duel begins in...')) duelCountdown(5, map, mode)
def masterMode(caller,name=None): """Changes the mastermode of the server.""" if name==None: return sbserver.masterMode() mastermode=mastermodeNumber(name) if config["serverpublic"]=="1": if mastermode>=2: UserSessionManager.checkPermissions(caller,"trusted") if config["serverpublic"]=="2": if mastermode>=3: UserSessionManager.checkPermissions(caller,"trusted") return sbserver.setMasterMode(mastermode)
def endDuel(): sbserver.setMasterMode(prev_mastermode) sbserver.setPaused(False) currently_dueling[0] = False currently_dueling[1] = False
def onNoClients(): if sbserver.masterMode() > 1: sbserver.setMasterMode(1)
def setMM(cn, mm): sbserver.message((info(green('%s') + ' set master mode to ' + blue('%s')) % (sbserver.playerName(cn), MMNAMES[mm]))) sbserver.setMasterMode(mm)