def run(self): try: global old roster = bsInternal._getGameRoster() if roster != old: #print roster for i in roster: a = i['displayString'] if a in banned: with bs.Context('UI'): bsInternal._chatMessage(a + ", You are banned due to voilation of rules.") bsInternal._disconnectClient(int(i['clientID'])) old = roster except Exception as e: pass bs.realTimer(2000,self.run)
def trans(t, n, d='en'): try: t = bs.utf8(t) lang = translator.detect(t) if (lang.lang in supported_langs) or d != 'en': tn = bs.utf8(translator.translate(t, d).pronunciation) if tn is None: tn = bs.utf8(translator.translate(t, d).text) tc = bs.utf8(profanity.censor(tn)) if tc != tn: import kicker kicker.kick(n, reason='Abuse', warn=True) if tc.lower() != t.lower(): bsInternal._chatMessage( t + ' ({}) ==> ({}) '.format(lang.lang, d) + tc) except Exception as e: pass
def beg(i): n = i.get_account_id() n2 = i.getInputDevice().getClientID() stuff = db.getData(n) prob = random.random() if prob >= 0.2: c = random.randint(5, 25) stuff['p'] += c db.saveData(n, stuff) bsInternal._chatMessage( random.choice(celeb) + ' Gave ' + i.getName(full=True) + ' ' + str(c) + u" \ue01f!") else: bs.screenMessage(random.choice(celeb) + " flicked " + i.getName(full=True) + ' off!', color=(1, 0, 0), transient=True) clear()
def checkAnswer(msg, clientID): global answeredBy if True: #msg.lower() == correctAnswer: if answeredBy is not None: bsInternal._chatMessage('THIS GUY GOT IT ' + answeredBy) else: for i in bsInternal._getForegroundHostActivity().players: if i.getInputDevice().getClientID() == clientID: answeredBy = i.getName() accountID = i.get_account_id() bs.screenMessage(answeredBy + ': ' + msg, color=(0, 0.6, 0.2), transient=True) try: bsInternal._chatMessage('CONGO BRO ' + answeredBy + '! YOU JUST GOT ' + bs.getSpecialChar('ticket') + '10.') addCoins(accountID, 10) except: pass '''else: bs.screenMessage('Wrong', color=(1, 0, 0), transient=True, clients=[clientID])''' return
def askQuestion(): global answeredBy global correctAnswer keys = [] for x in questionsList: keys.append(x) question = keys[randrange(len(keys))] correctAnswer = questionsList[question] if question == 'add': a = randrange(100, 999) b = randrange(10, 99) correctAnswer = str(a + b) question = 'What is ' + str(a) + ' + ' + str(b) + '?' elif question == 'multiply': a = randrange(100, 999) availableB = [0, 1, 10, 5] b = availableB[randrange(4)] correctAnswer = str(a * b) question = 'What is ' + str(a) + ' x ' + str(b) + '?' bsInternal._chatMessage(question) answeredBy = None checkExpiredItems() return
def kickByNick(self, nick): if nick != '': roster = bsInternal._getGameRoster() for i in roster: try: #bsInternal._chatMessage(nick+' in try') #bsInternal._chatMessage('encoded') #bsInternal._chatMessage(i['players'][0]['nameFull'].encode('utf-8')+' comparing with '+nick.encode('utf-8')) if i['players'][0]['nameFull'].find(nick) != -1: bsInternal._chatMessage('abuse detected kicking ' + nick) bsInternal._disconnectClient(int(i['clientID'])) except: pass else: bsInternal._chatMessage("abuse detected") bsInternal._chatMessage("will be banned manually by Mr.Smoothy")
def __init__(self, color=(1, 1, 1), highlight=(0.5, 0.5, 0.5), character="Spaz", player=None, powerupsExpire=True): """ Create a spaz for the provided bs.Player. Note: this does not wire up any controls; you must call connectControlsToPlayer() to do so. """ #https://github.com/imayushsaini/Bombsquad-Mr.Smoothy-Admin-Powerup-Server # convert None to an empty player-ref if player is None: player = bs.Player(None) Spaz.__init__(self, color=color, highlight=highlight, character=character, sourcePlayer=player, startInvincible=True, powerupsExpire=powerupsExpire) self.lastPlayerAttackedBy = None # FIXME - should use empty player ref self.lastAttackedTime = 0 self.lastAttackedType = None self.heldCount = 0 self.lastPlayerHeldBy = None # FIXME - should use empty player ref here self._player = player profiles = [] profiles = self._player.getInputDevice()._getPlayerProfiles() ### cName = player.getName() clID = self._player.getInputDevice().getClientID() #bsInternal._chatMessage(str(clID)+'clid') #bsInternal._chatMessage(str(self._player.get_account_id())) #bsInternal._chatMessage(str(self._player.getID())) cl_str = [] if cName[0] == ' ' or cName == '': bsInternal._disconnectClient(int( player.getInputDevice().getClientID())) bsInternal._chatMessage("No white Space Name Allowed") bsInternal._chatMessage("kicking" + cl_str) playeraccountid = self._player.get_account_id() ## if profiles == [] or profiles == {}: profiles = bs.getConfig()['Player Profiles'] for p in profiles: try: if playeraccountid in MID.admins: PermissionEffect(owner=self.node, prefix=u'\ue048 A.D.M.I.N \ue048', prefixAnim={ 0: (0.5, 0.011, 0.605), 250: (1, 0.411, 0.3411), 250 * 2: (1, 0.591, 0.811), 250 * 3: (0.829, 0.331, 0.403) }) break if playeraccountid in MID.vips: PermissionEffect(owner=self.node, prefix=u'\ue043 VIP \ue043', prefixAnim={ 0: (0.9, 0.611, 0.705), 250: (1, 0.311, 0.5411), 250 * 2: (0.7, 0.591, 0.811), 250 * 3: (0.729, 0.431, 0.703) }) break if playeraccountid in MID.members: PermissionEffect(owner=self.node, prefix=u" MEMBER ", prefixAnim={ 0: (0.85, 0.852, 0.85), 250: (0.59, 0.598, 0), 250 * 2: (0.75, 1, 0), 250 * 3: (0.9, 0.17, 0.028) }) break except: pass # grab the node for this player and wire it to follow our spaz (so players' controllers know where to draw their guides, etc) if player.exists(): playerNode = bs.getActivity()._getPlayerNode(player) self.node.connectAttr('torsoPosition', playerNode, 'position')
def popupMenuSelectedChoice(self, popupWindow, choice): if choice == "kickOrg": if self._popupPartyMemberIsHost: bs.playSound(bs.getSound('error')) bs.screenMessage(bs.Lstr(resource='internal.cantKickHostError'), color=(1, 0, 0)) else: #print self._popupPartyMemberClientID result = bsInternal._disconnectClient( self._popupPartyMemberClientID) if not result: bs.playSound(bs.getSound('error')) bs.screenMessage( bs.Lstr(resource='getTicketsWindow.unavailableText'), color=(1, 0, 0)) elif choice == "kick": bsInternal._chatMessage("/" + choice + " " + (str(self._popupPartyMemberClientID))) elif choice == "ban": for client in bsInternal._getGameRoster(): if client['clientID'] == self._popupPartyMemberClientID: try: bsInternal._chatMessage("/" + choice + " " + str(client['players'][0]['name'])) except: pass elif choice == "unban": for client in bsInternal._getGameRoster(): if client['clientID'] == self._popupPartyMemberClientID: try: bsInternal._chatMessage("/" + choice + " " + str(client['players'][0]['name'])) except: pass elif choice == "remove": for client in bsInternal._getGameRoster(): if client['clientID'] == self._popupPartyMemberClientID: try: bsInternal._chatMessage("/" + choice + " " + str(client['players'][0]['name'])) except: pass elif choice == "curse": for client in bsInternal._getGameRoster(): if client['clientID'] == self._popupPartyMemberClientID: try: bsInternal._chatMessage("/" + choice + " " + str(client['players'][0]['name'])) except: pass elif choice == "celebrate": for client in bsInternal._getGameRoster(): if client['clientID'] == self._popupPartyMemberClientID: try: bsInternal._chatMessage("/" + choice + " " + str(client['players'][0]['name'])) except: pass elif choice == "freeze": for client in bsInternal._getGameRoster(): if client['clientID'] == self._popupPartyMemberClientID: try: bsInternal._chatMessage("/" + choice + " " + str(client['players'][0]['name'])) except: pass elif choice == "thaw": for client in bsInternal._getGameRoster(): if client['clientID'] == self._popupPartyMemberClientID: try: bsInternal._chatMessage("/" + choice + " " + str(client['players'][0]['name'])) except: pass elif choice == "kill": for client in bsInternal._getGameRoster(): if client['clientID'] == self._popupPartyMemberClientID: try: bsInternal._chatMessage("/" + choice + " " + str(client['players'][0]['name'])) except: pass elif choice == "knock": for client in bsInternal._getGameRoster(): if client['clientID'] == self._popupPartyMemberClientID: try: bsInternal._chatMessage("/" + choice + " " + str(client['players'][0]['name'])) except: pass elif choice == "punch": for client in bsInternal._getGameRoster(): if client['clientID'] == self._popupPartyMemberClientID: try: bsInternal._chatMessage("/" + choice + " " + str(client['players'][0]['name'])) except: pass elif choice == "headless": for client in bsInternal._getGameRoster(): if client['clientID'] == self._popupPartyMemberClientID: try: bsInternal._chatMessage("/" + choice + " " + str(client['players'][0]['name'])) except: pass elif choice == "heal": for client in bsInternal._getGameRoster(): if client['clientID'] == self._popupPartyMemberClientID: try: bsInternal._chatMessage("/" + choice + " " + str(client['players'][0]['name'])) except: pass elif choice == "shield": for client in bsInternal._getGameRoster(): if client['clientID'] == self._popupPartyMemberClientID: try: bsInternal._chatMessage("/" + choice + " " + str(client['players'][0]['name'])) except: pass elif choice == "list": bsInternal._chatMessage("/" + choice) elif choice == "camera": bsInternal._chatMessage("/" + choice) elif choice == "slow": bsInternal._chatMessage("/" + choice) elif choice == "amnesty": bsInternal._chatMessage("/" + choice) elif choice == "help": bsInternal._chatMessage("/" + choice) elif choice == "end": bsInternal._chatMessage("/" + choice) elif choice == "headlessall": bsInternal._chatMessage("/" + choice) elif choice == "killall": bsInternal._chatMessage("/" + choice) elif choice == "freezeall": bsInternal._chatMessage("/" + choice) elif choice == "curseall": bsInternal._chatMessage("/" + choice) elif choice == "shieldall": bsInternal._chatMessage("/" + choice) elif choice == "healall": bsInternal._chatMessage("/" + choice) elif choice == "knockall": bsInternal._chatMessage("/" + choice) elif choice == "thawall": bsInternal._chatMessage("/" + choice) elif choice == "punchall": bsInternal._chatMessage("/" + choice) elif choice == "celebrateall": bsInternal._chatMessage("/" + choice) elif self._popupType == 'menu': if choice in ('mute', 'unmute'): bsConfig = bs.getConfig() bsConfig['Chat Muted'] = (choice == 'mute') bs.writeConfig() bs.applySettings() self._update() else: bs.textWidget(edit=self._textField, text='')
def popupMenuSelectedChoice(self, popupWindow, choice): def getIndex(): for i in bsInternal._getGameRoster(): if i['clientID'] == self._popupPartyMemberClientID: return bsInternal._getGameRoster().index(i) if self._popupType == 'partyMemberPress': if choice in [ 'Kick', 'Vote to Kick', 'Изгнать', 'Голосовать за вылет' ]: if self._popupPartyMemberIsHost: bs.playSound(bs.getSound('error')) bs.screenMessage( bs.Lstr(resource='internal.cantKickHostError'), color=(1, 0, 0)) else: result = bsInternal._disconnectClient( self._popupPartyMemberClientID) if not result: bs.playSound(bs.getSound('error')) bs.screenMessage( bs.Lstr(resource='getTicketsWindow.unavailableText'), color=(1, 0, 0)) elif choice in ['Departure without a vote', 'Вылет без голосования']: bsInternal._chatMessage('/kick ' + str(self._popupPartyMemberClientID)) elif choice in ['Ban for teaming', 'Бан за тиминг']: bsInternal._chatMessage('/ban' + ' device ' + eval( bsInternal._getGameRoster()[getIndex()]['specString'])['n'] + ' team') elif choice in ['Ban for bad words', 'Бан за плохие слова']: bsInternal._chatMessage('/ban' + ' device ' + eval( bsInternal._getGameRoster()[getIndex()]['specString'])['n'] + ' badwords') elif choice in [ 'Ban for exile without reason', 'Бан за изгнание без причины' ]: bsInternal._chatMessage('/ban' + ' device ' + eval( bsInternal._getGameRoster()[getIndex()]['specString'])['n'] + ' freeKick') elif choice in ['Account profile', 'Профиль аккаунта']: for i in bsInternal._getGameRoster(): if i['clientID'] == self._popupPartyMemberClientID: bs.screenMessage(i['displayString']) else: if choice in ['Defrost', 'Разморозить']: _choice = 'thaw' elif choice in ['Turn into box', 'Превратить в коробку']: _choice = 'box' elif choice in ['Remove from game', 'Убрать из игры']: _choice = 'remove' elif choice in ['Cure', 'Вылечить']: _choice = 'heal' elif choice in ['Rainbow skin', 'Радужный скин']: _choice = 'rainbow' elif choice in ['Put to sleep', 'Усыпить']: _choice = 'sleep' elif choice in ['To freeze', 'Заморозить']: _choice = 'freeze' elif choice in ['To revive', 'Возродить']: _choice = 'rise' elif choice in ['Invisibility', 'Невидимость']: _choice = 'inv' elif choice in ['Fly', 'Полет']: _choice = 'fly' elif choice in ['New fly', 'Новый полет']: _choice = 'fly3d' elif choice in ['Kill', 'Убить']: _choice = 'kill' elif choice in ['Curse', 'Проклятие']: _choice = 'curse' elif choice in ['God mode', 'Режим бога']: _choice = 'gm' bsInternal._chatMessage('/' + _choice + ' device ' + eval( bsInternal._getGameRoster()[getIndex()]['specString'])['n']) elif self._popupType == 'menu': if choice in ('mute', 'unmute'): bsConfig = bs.getConfig() bsConfig['Chat Muted'] = (choice == 'mute') bs.writeConfig() bs.applySettings() self._update() elif choice == 'favoritesChatMenuAddButton': configLastServer = bs.getConfig()['BombDash Last Server'] configFavoritesServers = bs.getConfig( )['BombDash Favorites Servers'] if not configLastServer: bs.screenMessage(bs.Lstr(resource='favoritesLastServerNone'), (1, 0, 0)) elif configLastServer in configFavoritesServers: bs.screenMessage( bs.Lstr(resource='favoritesLastServerInFavorites'), (1, 0, 0)) else: bs.getConfig()['BombDash Favorites Servers'].append( configLastServer) bs.writeConfig() bs.screenMessage(bs.Lstr(resource='favoritesLastServerAdded'), (0, 1, 0)) else: print 'unhandled popup type: ' + str(self._popupType)
def restart(): bsInternal._chatMessage('Rebooting Server... Thanks For Playing!') bsInternal._chatMessage('You Can Also Join Again Using IP & Port') text = 'IP: %s Port: %s' % (ip, port) bsInternal._chatMessage(text) bs.realTimer(3000, bs.Call(bs.quit))
def opt(self, nick, msg): if self.checkDevice(nick): m = msg.split(' ')[0] # command a = msg.split(' ', 1)[1:] # arguments activity = bsInternal._getForegroundHostActivity() with bs.Context(activity): if m == '/kick': #just remove from the game if a == []: bsInternal._chatMessage("MUST USE KICK ID") else: try: kickedPlayerID = int(a[0]) except Exception: bsInternal._chatMessage("PLAYER NOT FOUND") else: if not kickedPlayerID == -1: bsInternal._disconnectClient(kickedPlayerID) bsInternal._chatMessage( bs.getSpecialChar('logoFlat')) else: bsInternal._chatMessage("CANT KICK HOST") elif m == '/list': #list of current players id bsInternal._chatMessage( "==========PLAYER KICK IDS==========") for i in bsInternal._getGameRoster(): try: bsInternal._chatMessage( i['players'][0]['nameFull'] + " kick ID " + str(i['clientID'])) except Exception: pass bsInternal._chatMessage( "==========PLAYER IDS=============") for s in bsInternal._getForegroundHostSession().players: bsInternal._chatMessage( s.getName() + " ID = " + str(bsInternal._getForegroundHostSession().players. index(s))) elif m == '/ban': # add id to banlist=autokick list if a == []: bsInternal._chatMessage( "MUST USE PLAYER ID OR NICK" ) #also FIX this every time bsInternal ChatMessage thing!! for stop loops "update-FIXED" else: #firstly try nick if nick len is more then 2 else try as player id FIX ME if len(a[0]) > 2: for i in bs.getActivity().players: try: if (i.getName()).encode('utf-8') == (a[0]): bannedClient = i.getInputDevice( ).getClientID() bannedName = i.getName().encode( 'utf-8') bannedPlayerID = i.get_account_id() foolist = [] foolist = mbal.autoKickList if bannedPlayerID not in foolist: foolist.append(bannedPlayerID) bsInternal._chatMessage( str(bannedName) + " Banned") i.removeFromGame() else: bsInternal._chatMessage( str(bannedName) + " Already Banned") with open( bs.getEnvironment() ['systemScriptsDirectory'] + "/MythBAdminList.py") as file: s = [row for row in file] s[7] = 'autoKickList = ' + str( foolist) + '\n' f = open( bs.getEnvironment() ['systemScriptsDirectory'] + "/MythBAdminList.py", 'w') for i in s: f.write(i) f.close() reload(mbal) except Exception: pass bsInternal._chatMessage( bs.getSpecialChar('logoFlat')) else: try: bannedClient = bsInternal._getForegroundHostSession( ).players[int(a[0])] except Exception: bsInternal._chatMessage("PLAYER NOT FOUND") else: foolist = [] foolist = mbal.autoKickList bannedPlayerID = bannedClient.get_account_id() if bannedPlayerID not in foolist: foolist.append(bannedPlayerID) bsInternal._chatMessage( str(bannedClient) + " Banned") bannedClient.removeFromGame() else: bsInternal._chatMessage( str(bannedClient) + " Already Banned") with open(bs.getEnvironment() ['systemScriptsDirectory'] + "/MythBAdminList.py") as file: s = [row for row in file] s[7] = 'autoKickList = ' + str( foolist) + '\n' f = open( bs.getEnvironment() ['systemScriptsDirectory'] + "/MythBAdminList.py", 'w') for i in s: f.write(i) f.close() reload(mbal) elif m == '/unban': # remove id from banlist=autokick list if a == []: bsInternal._chatMessage("MUST USE PLAYER ID OR NICK") else: if len(a[0]) > 2: for i in bs.getActivity().players: try: if (i.getName()).encode('utf-8') == (a[0]): bannedClient = i.getInputDevice( ).getClientID() bannedName = i.getName().encode( 'utf-8') bannedPlayerID = i.get_account_id() foolist = [] foolist = mbal.autoKickList if bannedPlayerID in foolist: foolist.remove(bannedPlayerID) bsInternal._chatMessage( str(bannedName) + " be free now!") else: bsInternal._chatMessage( str(bannedName) + " Already Not Banned") with open( bs.getEnvironment() ['systemScriptsDirectory'] + "/MythBAdminList.py") as file: s = [row for row in file] s[7] = 'autoKickList = ' + str( foolist) + '\n' f = open( bs.getEnvironment() ['systemScriptsDirectory'] + "/MythBAdminList.py", 'w') for i in s: f.write(i) f.close() reload(mbal) except Exception: pass bsInternal._chatMessage( bs.getSpecialChar('logoFlat')) else: try: bannedClient = bsInternal._getForegroundHostSession( ).players[int(a[0])] except Exception: bsInternal._chatMessage("PLAYER NOT FOUND") else: foolist = [] foolist = mbal.autoKickList bannedPlayerID = bannedClient.get_account_id() if bannedPlayerID in foolist: foolist.remove(bannedPlayerID) bsInternal._chatMessage( str(bannedClient) + " be free now!") else: bsInternal._chatMessage( str(bannedClient) + " Already Not Banned") with open(bs.getEnvironment() ['systemScriptsDirectory'] + "/MythBAdminList.py") as file: s = [row for row in file] s[7] = 'autoKickList = ' + str( foolist) + '\n' f = open( bs.getEnvironment() ['systemScriptsDirectory'] + "/MythBAdminList.py", 'w') for i in s: f.write(i) f.close() reload(mbal) elif m == '/amnesty': # reset blacklist foolist = [] bsInternal._chatMessage( "==========FREEDOM TO ALL==========") bsInternal._chatMessage( "=========BLACKLİST WIPED=========") with open(bs.getEnvironment()['systemScriptsDirectory'] + "/MythBAdminList.py") as file: s = [row for row in file] s[7] = 'autoKickList = ' + str(foolist) + '\n' f = open( bs.getEnvironment()['systemScriptsDirectory'] + "/MythBAdminList.py", 'w') for i in s: f.write(i) f.close() reload(mbal) elif m == '/camera': #change camera mode bsInternal._chatMessage(bs.getSpecialChar('logoFlat')) try: if bs.getSharedObject( 'globals').cameraMode == 'follow': bs.getSharedObject('globals').cameraMode = 'rotate' else: bs.getSharedObject('globals').cameraMode = 'follow' except Exception: bsInternal._chatMessage('AN ERROR OCCURED') elif m == '/maxplayers': #set maxplayers limit if a == []: bsInternal._chatMessage('MUST USE NUMBERS') else: try: bsInternal._getForegroundHostSession( )._maxPlayers = int(a[0]) bsInternal._setPublicPartyMaxSize(int(a[0])) bsInternal._chatMessage('MaxPlayers = ' + str(int(a[0]))) except Exception: bsInternal._chatMessage('AN ERROR OCCURED') elif m == '/help': #show help bsInternal._chatMessage( "=====================COMMANDS=====================") bsInternal._chatMessage( "list-kick-remove-ban-unban-amnesty-kill-curse-end-heal" ) bsInternal._chatMessage( "freeze-thaw-headless-shield-punch-maxplayers-headlessall" ) bsInternal._chatMessage( "killall-freezeall-shieldall-punchall-camera-slow") elif m == '/remove': #remove from game if a == []: bsInternal._chatMessage('MUST USE PLAYER ID OR NICK') else: if len(a[0]) > 2: for i in bs.getActivity().players: try: if (i.getName()).encode('utf-8') == (a[0]): i.removeFromGame() except Exception: pass bsInternal._chatMessage( bs.getSpecialChar('logoFlat')) else: try: bs.getActivity().players[int( a[0])].removeFromGame() bsInternal._chatMessage( bs.getSpecialChar('logoFlat')) except Exception: bsInternal._chatMessage('PLAYER NOT FOUND') elif m == '/curse': #curse if a == []: bsInternal._chatMessage('MUST USE PLAYER ID OR NICK') else: if len(a[0]) > 2: for i in bs.getActivity().players: try: if (i.getName()).encode('utf-8') == (a[0]): if i.actor.exists(): i.actor.curse() except Exception: pass bsInternal._chatMessage( bs.getSpecialChar('logoFlat')) else: try: bs.getActivity().players[int( a[0])].actor.curse() bsInternal._chatMessage( bs.getSpecialChar('logoFlat')) except Exception: bsInternal._chatMessage('PLAYER NOT FOUND') elif m == '/curseall': #curse all for i in bs.getActivity().players: try: if i.actor.exists(): i.actor.curse() except Exception: pass bsInternal._chatMessage(bs.getSpecialChar('logoFlat')) elif m == '/kill': #kill if a == []: bsInternal._chatMessage('MUST USE PLAYER ID OR NICK') else: if len(a[0]) > 2: for i in bs.getActivity().players: try: if (i.getName()).encode('utf-8') == (a[0]): if i.actor.exists(): i.actor.node.handleMessage( bs.DieMessage()) except Exception: pass bsInternal._chatMessage( bs.getSpecialChar('logoFlat')) else: try: bs.getActivity().players[int( a[0])].actor.node.handleMessage( bs.DieMessage()) bsInternal._chatMessage( bs.getSpecialChar('logoFlat')) except Exception: bsInternal._chatMessage('PLAYER NOT FOUND') elif m == '/killall': #kill all for i in bs.getActivity().players: try: if i.actor.exists(): i.actor.node.handleMessage(bs.DieMessage()) except Exception: pass bsInternal._chatMessage(bs.getSpecialChar('logoFlat')) elif m == '/freeze': #freeze if a == []: bsInternal._chatMessage('MUST USE PLAYER ID OR NICK') else: if len(a[0]) > 2: for i in bs.getActivity().players: try: if (i.getName()).encode('utf-8') == (a[0]): if i.actor.exists(): i.actor.node.handleMessage( bs.FreezeMessage()) except Exception: pass bsInternal._chatMessage( bs.getSpecialChar('logoFlat')) else: try: bs.getActivity().players[int( a[0])].actor.node.handleMessage( bs.FreezeMessage()) bsInternal._chatMessage( bs.getSpecialChar('logoFlat')) except Exception: bsInternal._chatMessage('PLAYER NOT FOUND') elif m == '/freezeall': #freeze all for i in bs.getActivity().players: try: if i.actor.exists(): i.actor.node.handleMessage(bs.FreezeMessage()) except Exception: pass bsInternal._chatMessage(bs.getSpecialChar('logoFlat')) elif m == '/thaw': #thaw if a == []: bsInternal._chatMessage('MUST USE PLAYER ID OR NICK') else: if len(a[0]) > 2: for i in bs.getActivity().players: try: if (i.getName()).encode('utf-8') == (a[0]): if i.actor.exists(): i.actor.node.handleMessage( bs.ThawMessage()) except Exception: pass bsInternal._chatMessage( bs.getSpecialChar('logoFlat')) else: try: bs.getActivity().players[int( a[0])].actor.node.handleMessage( bs.ThawMessage()) bsInternal._chatMessage( bs.getSpecialChar('logoFlat')) except Exception: bsInternal._chatMessage('PLAYER NOT FOUND') elif m == '/thawall': #thaw all for i in bs.getActivity().players: try: if i.actor.exists(): i.actor.node.handleMessage(bs.ThawMessage()) except Exception: pass bsInternal._chatMessage(bs.getSpecialChar('logoFlat')) elif m == '/headless': #headless if a == []: bsInternal._chatMessage('MUST USE PLAYER ID OR NICK') else: if len(a[0]) > 2: for i in bs.getActivity().players: try: if (i.getName()).encode('utf-8') == (a[0]): if i.actor.exists(): i.actor.node.headModel = None i.actor.node.style = "cyborg" except Exception: pass bsInternal._chatMessage( bs.getSpecialChar('logoFlat')) else: try: bs.getActivity().players[int( a[0])].actor.node.headModel = None bs.getActivity().players[int( a[0])].actor.node.style = "cyborg" bsInternal._chatMessage( bs.getSpecialChar('logoFlat')) except Exception: bsInternal._chatMessage('PLAYER NOT FOUND') elif m == '/headlessall': #headless all for i in bs.getActivity().players: try: if i.actor.exists(): i.actor.node.headModel = None i.actor.node.style = "cyborg" except Exception: pass bsInternal._chatMessage(bs.getSpecialChar('logoFlat')) elif m == '/heal': #heal if a == []: bsInternal._chatMessage('MUST USE PLAYER ID OR NICK') else: if len(a[0]) > 2: for i in bs.getActivity().players: try: if (i.getName()).encode('utf-8') == (a[0]): if i.actor.exists(): i.actor.node.handleMessage( bs.PowerupMessage( powerupType='health')) except Exception: pass bsInternal._chatMessage( bs.getSpecialChar('logoFlat')) else: try: bs.getActivity().players[int( a[0])].actor.node.handleMessage( bs.PowerupMessage( powerupType='health')) bsInternal._chatMessage( bs.getSpecialChar('logoFlat')) except Exception: bsInternal._chatMessage('PLAYER NOT FOUND') elif m == '/healall': #heal all for i in bs.getActivity().players: try: if i.actor.exists(): i.actor.node.handleMessage( bs.PowerupMessage(powerupType='health')) except Exception: pass bsInternal._chatMessage(bs.getSpecialChar('logoFlat')) elif m == '/shield': #shield if a == []: bsInternal._chatMessage('MUST USE PLAYER ID OR NICK') else: if len(a[0]) > 2: for i in bs.getActivity().players: try: if (i.getName()).encode('utf-8') == (a[0]): if i.actor.exists(): i.actor.node.handleMessage( bs.PowerupMessage( powerupType='shield')) except Exception: pass bsInternal._chatMessage( bs.getSpecialChar('logoFlat')) else: try: bs.getActivity().players[int( a[0])].actor.node.handleMessage( bs.PowerupMessage( powerupType='shield')) bsInternal._chatMessage( bs.getSpecialChar('logoFlat')) except Exception: bsInternal._chatMessage('PLAYER NOT FOUND') elif m == '/shieldall': #shield all for i in bs.getActivity().players: try: if i.actor.exists(): i.actor.node.handleMessage( bs.PowerupMessage(powerupType='shield')) except Exception: pass bsInternal._chatMessage(bs.getSpecialChar('logoFlat')) elif m == '/punch': #punch if a == []: bsInternal._chatMessage('MUST USE PLAYER ID OR NICK') else: if len(a[0]) > 2: for i in bs.getActivity().players: try: if (i.getName()).encode('utf-8') == (a[0]): if i.actor.exists(): i.actor.node.handleMessage( bs.PowerupMessage( powerupType='punch')) except Exception: pass bsInternal._chatMessage( bs.getSpecialChar('logoFlat')) else: try: bs.getActivity().players[int( a[0])].actor.node.handleMessage( bs.PowerupMessage(powerupType='punch')) bsInternal._chatMessage( bs.getSpecialChar('logoFlat')) except Exception: bsInternal._chatMessage('PLAYER NOT FOUND') elif m == '/punchall': #punch all for i in bs.getActivity().players: try: if i.actor.exists(): i.actor.node.handleMessage( bs.PowerupMessage(powerupType='punch')) except Exception: pass bsInternal._chatMessage(bs.getSpecialChar('logoFlat')) elif m == '/knock': #knock him if a == []: bsInternal._chatMessage('MUST USE PLAYER ID OR NICK') else: if len(a[0]) > 2: for i in bs.getActivity().players: try: if (i.getName()).encode('utf-8') == (a[0]): if i.actor.exists(): i.actor.node.handleMessage( "knockout", 5000) except Exception: pass bsInternal._chatMessage( bs.getSpecialChar('logoFlat')) else: try: bs.getActivity().players[int( a[0])].actor.node.handleMessage( "knockout", 5000) bsInternal._chatMessage( bs.getSpecialChar('logoFlat')) except Exception: bsInternal._chatMessage('PLAYER NOT FOUND') elif m == '/knockall': #knock all for i in bs.getActivity().players: try: if i.actor.exists(): i.actor.node.handleMessage("knockout", 5000) except Exception: pass bsInternal._chatMessage(bs.getSpecialChar('logoFlat')) elif m == '/celebrate': #celebrate him if a == []: bsInternal._chatMessage('MUST USE PLAYER ID OR NICK') else: if len(a[0]) > 2: for i in bs.getActivity().players: try: if (i.getName()).encode('utf-8') == (a[0]): if i.actor.exists(): i.actor.node.handleMessage( 'celebrate', 30000) except Exception: pass bsInternal._chatMessage( bs.getSpecialChar('logoFlat')) else: try: bs.getActivity().players[int( a[0])].actor.node.handleMessage( 'celebrate', 30000) bsInternal._chatMessage( bs.getSpecialChar('logoFlat')) except Exception: bsInternal._chatMessage('PLAYER NOT FOUND') elif m == '/celebrateall': #celebrate for i in bs.getActivity().players: try: if i.actor.exists(): i.actor.node.handleMessage('celebrate', 30000) except Exception: pass bsInternal._chatMessage(bs.getSpecialChar('logoFlat')) elif m == '/slow': # slow-mo bsInternal._chatMessage(bs.getSpecialChar('logoFlat')) try: if bs.getSharedObject('globals').slowMotion == True: bs.getSharedObject('globals').slowMotion = False else: bs.getSharedObject('globals').slowMotion = True except Exception: bsInternal._chatMessage('AN ERROR OCCURED') elif m == '/end': # just end game try: bsInternal._getForegroundHostActivity().endGame() bsInternal._chatMessage('THE END') except Exception: bsInternal._chatMessage('AN ERROR OCCURED')
def opt(self, nick, msg): if self.checkDevice(nick): m = msg.split(' ')[0] # command a = msg.split(' ')[1:] # arguments activity = bsInternal._getForegroundHostActivity() with bs.Context(activity): if m == '/kick': if a == []: bsInternal._chatMessage( 'Using: /kick name or clientID') else: if len(a[0]) > 3: self.kickByNick(a[0]) bsInternal._chatMessage('Player Kicked By Admin') else: try: s = int(a[0]) bsInternal._chatMessage( 'Player Kicked By Admin') bsInternal._disconnectClient(int(a[0])) except: self.kickByNick(a[0]) elif m == '/admin': clID = int(a[0]) for client in bsInternal._getGameRoster(): if client['clientID'] == clID: if a[1] == 'add': newadmin = client['displayString'] updated_admins = gph.adminHashes.append( newadmin) elif a[1] == 'remove': newadmin = client['displayString'] if newadmin in gph.adminHashes: updated_admins = gph.adminHashes.remove( newadmin) with open(bs.getEnvironment()['systemScriptsDirectory'] + "/getPermissionsHashes.py") as file: s = [row for row in file] s[0] = 'vipHashes = []' + '\n' s[1] = 'adminHashes = ' + updated_admins + '\n' f = open( bs.getEnvironment()['systemScriptsDirectory'] + "/getPermissionsHashes.py", 'w') for i in s: f.write(i) f.close() elif m == '/ban': clID = int(a[0]) for client in bsInternal._getGameRoster(): if client['clientID'] == clID: if a[1] == 'add': ban = client['displayString'] updated_ban = gph.ban.append(ban) bs.screenMessage('Banning...') elif a[1] == 'remove': ban = client['displayString'] if ban in gph.ban: updated_ban = gph.ban.remove(ban) with open(bs.getEnvironment()['systemScriptsDirectory'] + "/getPermissionsHashes.py") as file: s = [row for row in file] s[0] = 'vipHashes = []' + '\n' s[1] = 'admin = []' + '\n' s[2] = 'ass = []' + '\n' s[3] = 'ban = ' + updated_ban + '\n' f = open( bs.getEnvironment()['systemScriptsDirectory'] + "/getPermissionsHashes.py", 'w') for i in s: f.write(i) f.close() elif m == '/ass': clID = int(a[0]) for client in bsInternal._getGameRoster(): if client['clientID'] == clID: if a[1] == 'add': ass = client['displayString'] updated_ass = gph.ass.append(ass) elif a[1] == 'remove': ass = client['displayString'] if ass in gph.ass: updated_ass = gph.ass.remove(ass) with open(bs.getEnvironment()['systemScriptsDirectory'] + "/getPermissionsHashes.py") as file: s = [row for row in file] s[0] = 'vipHashes = []' + '\n' s[1] = 'admin= []' + '\n' s[2] = 'ass = ' + updated_admins + '\n' f = open( bs.getEnvironment()['systemScriptsDirectory'] + "/getPermissionsHashes.py", 'w') for i in s: f.write(i) f.close() elif m == '/vip': clID = int(a[0]) for client in bsInternal._getGameRoster(): if client['clientID'] == clID: if a[1] == 'add': vip = client['displayString'] updated_vip = gph.vip.append(vip) elif a[1] == 'remove': vip = client['displayString'] if vip in gph.vip: updated_vip = gph.vip.remove(vip) with open(bs.getEnvironment()['systemScriptsDirectory'] + "/getPermissionsHashes.py") as file: s = [row for row in file] s[0] = 'vip = ' + updated_admins + '\n' f = open( bs.getEnvironment()['systemScriptsDirectory'] + "/getPermissionsHashes.py", 'w') for i in s: f.write(i) f.close() elif m == '/list': bsInternal._chatMessage( "======== FOR /kick ONLY: ========") for i in bsInternal._getGameRoster(): try: bsInternal._chatMessage( i['players'][0]['nameFull'] + " (/kick " + str(i['clientID']) + ")") except: pass bsInternal._chatMessage( "==================================") bsInternal._chatMessage( "======= For other commands: =======") for s in bsInternal._getForegroundHostSession().players: bsInternal._chatMessage( s.getName() + " " + str(bsInternal._getForegroundHostSession( ).players.index(s))) elif m == '/ooh': if a is not None and len(a) > 0: s = int(a[0]) def oohRecurce(c): bs.playSound(bs.getSound('ooh'), volume=2) c -= 1 if c > 0: bs.gameTimer( int(a[1]) if len(a) > 1 and a[1] is not None else 1000, bs.Call(oohRecurce, c=c)) oohRecurce(c=s) else: bs.playSound(bs.getSound('ooh'), volume=2) elif m == '/playSound': if a is not None and len(a) > 1: s = int(a[1]) def oohRecurce(c): bs.playSound(bs.getSound(str(a[0])), volume=2) c -= 1 if c > 0: bs.gameTimer( int(a[2]) if len(a) > 2 and a[2] is not None else 1000, bs.Call(oohRecurce, c=c)) oohRecurce(c=s) else: bs.playSound(bs.getSound(str(a[0])), volume=2) elif m == '/quit': bsInternal.quit() elif m == '/nv': if self.tint is None: self.tint = bs.getSharedObject('globals').tint bs.getSharedObject('globals').tint = ( 0.5, 0.7, 1) if a == [] or not a[0] == u'off' else self.tint elif m == '/freeze': if a == []: bsInternal._chatMessage( 'Using: /freeze all or number of list') else: if a[0] == 'all': for i in bs.getSession().players: try: i.actor.node.handleMessage( bs.FreezeMessage()) except: pass else: bs.getSession().players[int( a[0])].actor.node.handleMessage( bs.FreezeMessage()) elif m == '/thaw': if a == []: bsInternal._chatMessage( 'Using: /thaw all or number of list') else: if a[0] == 'all': for i in bs.getSession().players: try: i.actor.node.handleMessage( bs.ThawMessage()) except: pass else: bs.getSession().players[int( a[0])].actor.node.handleMessage( bs.ThawMessage()) elif m == '/sleep': if a == []: bsInternal._chatMessage('Using: number of list') else: if a[0] == 'all': for i in bs.getSession().players: try: i.actor.node.handleMessage( "knockout", 5000) except: pass else: bs.getSession().players[int( a[0])].actor.node.handleMessage( "knockout", 5000) elif m == '/kill': if a == []: bsInternal._chatMessage( 'Using: /kill all or number of list') else: if a[0] == 'all': for i in bs.getSession().players: try: i.actor.node.handleMessage(bs.DieMessage()) except: pass else: bs.getSession().players[int( a[0])].actor.node.handleMessage( bs.DieMessage()) elif m == '/curse': if a == []: bsInternal._chatMessage( 'Using: /curse all or number of list') else: if a[0] == 'all': for i in bs.getSession().players: try: i.actor.curse() except: pass else: bs.getSession().players[int(a[0])].actor.curse() elif m == '/box': if a == []: bsInternal._chatMessage( 'Using: /box all or number of list') else: try: if a[0] == 'all': for i in bs.getSession().players: try: i.actor.node.torsoModel = bs.getModel( "tnt") except: print 'error' for i in bs.getSession().players: try: i.actor.node.colorMaskTexture = bs.getTexture( "tnt") except: print 'error' for i in bs.getSession().players: try: i.actor.node.colorTexture = bs.getTexture( "tnt") except: print 'error' for i in bs.getSession().players: try: i.actor.node.highlight = (1, 1, 1) except: print 'error' for i in bs.getSession().players: try: i.actor.node.color = (1, 1, 1) except: print 'error' for i in bs.getSession().players: try: i.actor.node.headModel = None except: print 'error' for i in bs.getSession().players: try: i.actor.node.style = "cyborg" except: print 'error' else: n = int(a[0]) bs.getSession().players[ n].actor.node.torsoModel = bs.getModel( "tnt") bs.getSession().players[ n].actor.node.colorMaskTexture = bs.getTexture( "tnt") bs.getSession().players[ n].actor.node.colorTexture = bs.getTexture( "tnt") bs.getSession( ).players[n].actor.node.highlight = (1, 1, 1) bs.getSession().players[n].actor.node.color = ( 1, 1, 1) bs.getSession( ).players[n].actor.node.headModel = None bs.getSession( ).players[n].actor.node.style = "cyborg" except: bs.screenMessage('Ошибка!', color=(1, 0, 0)) elif m == '/spaz': if a == []: bsInternal._chatMessage( 'Using: /spaz all or number of list') else: try: if a[0] == 'all': for i in bs.getSession().players: t = i.actor.node try: t.colorTexture = bs.getTexture(a[1] + "Color") t.colorMaskTexture = bs.getTexture( a[1] + "ColorMask") t.headModel = bs.getModel(a[1] + "Head") t.torsoModel = bs.getModel(a[1] + "Torso") t.pelvisModel = bs.getModel(a[1] + "Pelvis") t.upperArmModel = bs.getModel( a[1] + "UpperArm") t.foreArmModel = bs.getModel(a[1] + "ForeArm") t.handModel = bs.getModel(a[1] + "Hand") t.upperLegModel = bs.getModel( a[1] + "UpperLeg") t.lowerLegModel = bs.getModel( a[1] + "LowerLeg") t.toesModel = bs.getModel(a[1] + "Toes") t.style = a[1] except: print 'error' else: n = int(a[0]) t = bs.getSession().players[n].actor.node t.colorTexture = bs.getTexture(a[1] + "Color") t.colorMaskTexture = bs.getTexture(a[1] + "ColorMask") t.headModel = bs.getModel(a[1] + "Head") t.torsoModel = bs.getModel(a[1] + "Torso") t.pelvisModel = bs.getModel(a[1] + "Pelvis") t.upperArmModel = bs.getModel(a[1] + "UpperArm") t.foreArmModel = bs.getModel(a[1] + "ForeArm") t.handModel = bs.getModel(a[1] + "Hand") t.upperLegModel = bs.getModel(a[1] + "UpperLeg") t.lowerLegModel = bs.getModel(a[1] + "LowerLeg") t.toesModel = bs.getModel(a[1] + "Toes") t.style = a[1] except: bs.screenMessage('error', color=(1, 0, 0)) elif m == '/inv': if a == []: bsInternal._chatMessage( 'Using: /spaz all or number of list') else: try: if a[0] == 'all': for i in bs.getSession().players: t = i.actor.node try: t.headModel = None t.torsoModel = None t.pelvisModel = None t.upperArmModel = None t.foreArmModel = None t.handModel = None t.upperLegModel = None t.lowerLegModel = None t.toesModel = None t.style = "cyborg" except: print 'error' else: n = int(a[0]) t = bs.getSession().players[n].actor.node t.headModel = None t.torsoModel = None t.pelvisModel = None t.upperArmModel = None t.foreArmModel = None t.handModel = None t.upperLegModel = None t.lowerLegModel = None t.toesModel = None t.style = "cyborg" except: bs.screenMessage('error', color=(1, 0, 0)) elif m == '/tex': if a == []: bsInternal._chatMessage( 'Using: /tex all or number of list') else: try: if a[0] == 'all': for i in bs.getSession().players: try: i.actor.node.colorMaskTexture = bs.getTexture( "egg1") except: print 'error' for i in bs.getSession().players: try: i.actor.node.colorTexture = bs.getTexture( "egg1") except: print 'error' else: n = int(a[0]) bs.getSession().players[ n].actor.node.colorMaskTexture = bs.getTexture( "egg1") bs.getSession().players[ n].actor.node.colorTexture = bs.getTexture( "egg1") except: bs.screenMessage('Ошибка!', color=(1, 0, 0)) elif m == '/remove': if a == []: bsInternal._chatMessage( 'Using: /remove all or number of list') else: if a[0] == 'all': for i in bs.getSession().players: try: i.removeFromGame() except: pass else: bs.getSession().players[int(a[0])].removeFromGame() elif m == '/end': try: bsInternal._getForegroundHostActivity().endGame() except: pass elif m == '/hug': if a == []: bsInternal._chatMessage( 'Using: /hug all or number of list') else: try: if a[0] == 'all': try: bsInternal._getForegroundHostActivity( ).players[ 0].actor.node.holdNode = bsInternal._getForegroundHostActivity( ).players[1].actor.node except: pass try: bsInternal._getForegroundHostActivity( ).players[ 1].actor.node.holdNode = bsInternal._getForegroundHostActivity( ).players[0].actor.node except: pass try: bsInternal._getForegroundHostActivity( ).players[ 3].actor.node.holdNode = bsInternal._getForegroundHostActivity( ).players[2].actor.node except: pass try: bsInternal._getForegroundHostActivity( ).players[ 4].actor.node.holdNode = bsInternal._getForegroundHostActivity( ).players[3].actor.node except: pass try: bsInternal._getForegroundHostActivity( ).players[ 5].actor.node.holdNode = bsInternal._getForegroundHostActivity( ).players[6].actor.node except: pass try: bsInternal._getForegroundHostActivity( ).players[ 6].actor.node.holdNode = bsInternal._getForegroundHostActivity( ).players[7].actor.node except: pass else: bsInternal._getForegroundHostActivity( ).players[int( a[0] )].actor.node.holdNode = bsInternal._getForegroundHostActivity( ).players[int(a[1])].actor.node except: bs.screenMessage('Ошибка!', color=(1, 0, 0)) elif m == '/gm': if a == []: for i in range(len(activity.players)): if activity.players[i].getName().encode( 'utf-8').find( nick.encode('utf-8').replace( '...', '').replace(':', '')) != -1: activity.players[ i].actor.node.hockey = activity.players[ i].actor.node.hockey == False activity.players[ i].actor.node.invincible = activity.players[ i].actor.node.invincible == False activity.players[ i].actor._punchPowerScale = 5 if activity.players[ i].actor._punchPowerScale == 1.2 else 1.2 else: activity.players[int( a[0])].actor.node.hockey = activity.players[int( a[0])].actor.node.hockey == False activity.players[int( a[0])].actor.node.invincible = activity.players[ int(a[0])].actor.node.invincible == False activity.players[int( a[0] )].actor._punchPowerScale = 5 if activity.players[int( a[0])].actor._punchPowerScale == 1.2 else 1.2 elif m == '/tint': if a == []: bsInternal._chatMessage('Using: /tint R G B') bsInternal._chatMessage('OR') bsInternal._chatMessage('Using: /tint r bright speed') else: if a[0] == 'r': m = 1.3 if a[1] is None else float(a[1]) s = 1000 if a[2] is None else float(a[2]) bsUtils.animateArray( bs.getSharedObject('globals'), 'tint', 3, { 0: (1 * m, 0, 0), s: (0, 1 * m, 0), s * 2: (0, 0, 1 * m), s * 3: (1 * m, 0, 0) }, True) else: try: if a[1] is not None: bs.getSharedObject('globals').tint = ( float(a[0]), float(a[1]), float(a[2])) else: bs.screenMessage('Error!', color=(1, 0, 0)) except: bs.screenMessage('Error!', color=(1, 0, 0)) elif m == 'pause': bs.getSharedObject('globals').paused = bs.getSharedObject( 'globals').paused == False elif m == '/sm': bs.getSharedObject( 'globals').slowMotion = bs.getSharedObject( 'globals').slowMotion == False elif m == '/bunny': if a == []: bsInternal._chatMessage( 'Using: /bunny count owner(number of list)') import BuddyBunny for i in range(int(a[0])): p = bs.getSession().players[int(a[1])] if not 'bunnies' in p.gameData: p.gameData['bunnies'] = BuddyBunny.BunnyBotSet(p) p.gameData['bunnies'].doBunny() elif m == '/cameraMode': try: if bs.getSharedObject( 'globals').cameraMode == 'follow': bs.getSharedObject('globals').cameraMode = 'rotate' else: bs.getSharedObject('globals').cameraMode = 'follow' except: pass elif m == '/lm': arr = [] for i in range(100): try: arr.append(bsInternal._getChatMessages()[-1 - i]) except: pass arr.reverse() for i in arr: bsInternal._chatMessage(i) elif m == '/gp': if a == []: bsInternal._chatMessage('Using: /gp number of list') else: s = bsInternal._getForegroundHostSession() for i in s.players[int( a[0])].getInputDevice()._getPlayerProfiles(): try: bsInternal._chatMessage(i) except: pass elif m == '/icy': bsInternal._getForegroundHostActivity().players[int( a[0] )].actor.node = bsInternal._getForegroundHostActivity( ).players[int(a[1])].actor.node elif m == '/fly': if a == []: bsInternal._chatMessage( 'Using: /fly all or number of list') else: if a[0] == 'all': for i in bsInternal._getForegroundHostActivity( ).players: i.actor.node.fly = True else: bsInternal._getForegroundHostActivity( ).players[int( a[0] )].actor.node.fly = bsInternal._getForegroundHostActivity( ).players[int(a[0])].actor.node.fly == False elif m == '/floorReflection': bs.getSharedObject( 'globals').floorReflection = bs.getSharedObject( 'globals').floorReflection == False elif m == '/ac': if a == []: bsInternal._chatMessage('Using: /ac R G B') bsInternal._chatMessage('OR') bsInternal._chatMessage('Using: /ac r bright speed') else: if a[0] == 'r': m = 1.3 if a[1] is None else float(a[1]) s = 1000 if a[2] is None else float(a[2]) bsUtils.animateArray( bs.getSharedObject('globals'), 'ambientColor', 3, { 0: (1 * m, 0, 0), s: (0, 1 * m, 0), s * 2: (0, 0, 1 * m), s * 3: (1 * m, 0, 0) }, True) else: try: if a[1] is not None: bs.getSharedObject( 'globals').ambientColor = (float(a[0]), float(a[1]), float(a[2])) else: bs.screenMessage('Error!', color=(1, 0, 0)) except: bs.screenMessage('Error!', color=(1, 0, 0)) elif m == '/iceOff': try: activity.getMap().node.materials = [ bs.getSharedObject('footingMaterial') ] activity.getMap().isHockey = False except: pass try: activity.getMap().floor.materials = [ bs.getSharedObject('footingMaterial') ] activity.getMap().isHockey = False except: pass for i in activity.players: i.actor.node.hockey = False elif m == '/maxPlayers': if a == []: bsInternal._chatMessage( 'Using: /maxPlayers count of players') else: try: bsInternal._getForegroundHostSession( )._maxPlayers = int(a[0]) bsInternal._setPublicPartyMaxSize(int(a[0])) bsInternal._chatMessage('Players limit set to ' + str(int(a[0]))) except: bs.screenMessage('Error!', color=(1, 0, 0)) elif m == '/heal': if a == []: bsInternal._chatMessage( 'Using: /heal all or number of list') else: try: bsInternal._getForegroundHostActivity().players[ int(a[0])].actor.node.handleMessage( bs.PowerupMessage(powerupType='health')) except: bs.screenMessage('Error!', color=(1, 0, 0)) elif m == '/reflections': if a == [] or len(a) < 2: bsInternal._chatMessage( 'Using: /reflections type(1/0) scale') rs = [int(a[1])] type = 'soft' if int(a[0]) == 0 else 'powerup' try: bsInternal._getForegroundHostActivity().getMap( ).node.reflection = type bsInternal._getForegroundHostActivity().getMap( ).node.reflectionScale = rs except: pass try: bsInternal._getForegroundHostActivity().getMap( ).bg.reflection = type bsInternal._getForegroundHostActivity().getMap( ).bg.reflectionScale = rs except: pass try: bsInternal._getForegroundHostActivity().getMap( ).floor.reflection = type bsInternal._getForegroundHostActivity().getMap( ).floor.reflectionScale = rs except: pass try: bsInternal._getForegroundHostActivity().getMap( ).center.reflection = type bsInternal._getForegroundHostActivity().getMap( ).center.reflectionScale = rs except: pass elif m == '/shatter': if a == []: bsInternal._chatMessage( 'Using: /shatter all or number of list') else: if a[0] == 'all': for i in bsInternal._getForegroundHostActivity( ).players: i.actor.node.shattered = int(a[1]) else: bsInternal._getForegroundHostActivity().players[ int(a[0])].actor.node.shattered = int(a[1]) elif m == '/cm': if a == []: time = 8000 else: time = int(a[0]) op = 0.08 std = bs.getSharedObject('globals').vignetteOuter bsUtils.animateArray( bs.getSharedObject('globals'), 'vignetteOuter', 3, { 0: bs.getSharedObject('globals').vignetteOuter, 17000: (0, 1, 0) }) try: bsInternal._getForegroundHostActivity().getMap( ).node.opacity = op except: pass try: bsInternal._getForegroundHostActivity().getMap( ).bg.opacity = op except: pass try: bsInternal._getForegroundHostActivity().getMap( ).bg.node.opacity = op except: pass try: bsInternal._getForegroundHostActivity().getMap( ).node1.opacity = op except: pass try: bsInternal._getForegroundHostActivity().getMap( ).node2.opacity = op except: pass try: bsInternal._getForegroundHostActivity().getMap( ).node3.opacity = op except: pass try: bsInternal._getForegroundHostActivity().getMap( ).steps.opacity = op except: pass try: bsInternal._getForegroundHostActivity().getMap( ).floor.opacity = op except: pass try: bsInternal._getForegroundHostActivity().getMap( ).center.opacity = op except: pass def off(): op = 1 try: bsInternal._getForegroundHostActivity().getMap( ).node.opacity = op except: pass try: bsInternal._getForegroundHostActivity().getMap( ).bg.opacity = op except: pass try: bsInternal._getForegroundHostActivity().getMap( ).bg.node.opacity = op except: pass try: bsInternal._getForegroundHostActivity().getMap( ).node1.opacity = op except: pass try: bsInternal._getForegroundHostActivity().getMap( ).node2.opacity = op except: pass try: bsInternal._getForegroundHostActivity().getMap( ).node3.opacity = op except: pass try: bsInternal._getForegroundHostActivity().getMap( ).steps.opacity = op except: pass try: bsInternal._getForegroundHostActivity().getMap( ).floor.opacity = op except: pass try: bsInternal._getForegroundHostActivity().getMap( ).center.opacity = op except: pass bsUtils.animateArray( bs.getSharedObject('globals'), 'vignetteOuter', 3, { 0: bs.getSharedObject('globals').vignetteOuter, 100: std }) bs.gameTimer(time, bs.Call(off)) elif m == 'help': bsInternal._chatMessage( bs.Lstr(resource='help1').evaluate()) bsInternal._chatMessage( bs.Lstr(resource='help2').evaluate()) bsInternal._chatMessage( bs.Lstr(resource='help3').evaluate()) bsInternal._chatMessage( bs.Lstr(resource='help4').evaluate()) bsInternal._chatMessage( bs.Lstr(resource='help5').evaluate()) bsInternal._chatMessage( bs.Lstr(resource='help6').evaluate()) bsInternal._chatMessage( bs.Lstr(resource='help7').evaluate()) bsInternal._chatMessage( bs.Lstr(resource='help8').evaluate()) bsInternal._chatMessage( bs.Lstr(resource='help9').evaluate()) bsInternal._chatMessage( bs.Lstr(resource='help10').evaluate()) bsInternal._chatMessage( bs.Lstr(resource='help11').evaluate()) bsInternal._chatMessage( bs.Lstr(resource='help12').evaluate()) bsInternal._chatMessage( bs.Lstr(resource='help13').evaluate()) bsInternal._chatMessage( bs.Lstr(resource='help14').evaluate()) bsInternal._chatMessage( bs.Lstr(resource='help15').evaluate()) bsInternal._chatMessage( bs.Lstr(resource='help16').evaluate()) bsInternal._chatMessage( bs.Lstr(resource='help17').evaluate()) bsInternal._chatMessage( bs.Lstr(resource='help18').evaluate()) bsInternal._chatMessage( bs.Lstr(resource='help19').evaluate()) bsInternal._chatMessage( bs.Lstr(resource='help20').evaluate()) bsInternal._chatMessage( bs.Lstr(resource='help21').evaluate()) bsInternal._chatMessage( bs.Lstr(resource='help22').evaluate()) bsInternal._chatMessage( bs.Lstr(resource='help23').evaluate()) bsInternal._chatMessage( bs.Lstr(resource='help24').evaluate()) bsInternal._chatMessage( bs.Lstr(resource='help25').evaluate()) bsInternal._chatMessage( bs.Lstr(resource='help26').evaluate()) bsInternal._chatMessage( bs.Lstr(resource='help27').evaluate()) bsInternal._chatMessage( bs.Lstr(resource='help28').evaluate()) bsInternal._chatMessage( bs.Lstr(resource='help29').evaluate()) bsInternal._chatMessage( bs.Lstr(resource='help30').evaluate()) bsInternal._chatMessage( bs.Lstr(resource='help31').evaluate()) bsInternal._chatMessage( bs.Lstr(resource='help32').evaluate())
def checkDevice(self, nick): # check host (settings.cmdForMe) client_str = [] for client in bsInternal._getGameRoster(): if client['players'] != []: if client['players'][0]['name'] == nick.encode('utf-8'): client_str = client['displayString'] clientID = client['clientID'] if client_str in gph.adminHashes: bsInternal._chatMessage("Sir, Yes Sir!") return True elif client_str in gph.assholes: bsInternal._chatMessage("The Commands are not for you assholes.") bsInternal._disconnectClient(int(client['displayString'])) return False elif client_str in gph.chutiya: bsInternal._chatMessage( "Tum jaise chutiyo ke liye commands nahi hai.") bsInternal._disconnectClient(int(client['displayString'])) return False elif client_str in gph.co: bsInternal._chatMessage("Ohk, Done.") return True elif client_str in gph.elder: bsInternal._chatMessage("You can't use commands yet.") return False elif client_str in gph.member: bsInternal._chatMessage("You are just a newcomer.") return False elif client_str not in [ gph.chutiya, gph.assholes, gph.co, gph.adminHashes, gph.member, gph.elder ]: bsInternal._chatMessage("only admin can use chat commands") bsInternal._disconnectClient(int(client['displayString'])) return False else: bs.screenMessage("only admin can use chat commands", color=(2, 0, 0), clients=clientID) bsInternal._disconnectClient(int(client['displayString'])) return False
def __init__(self, color=(1, 1, 1), highlight=(0.5, 0.5, 0.5), character="Spaz", player=None, powerupsExpire=True): """ Create a spaz for the provided bs.Player. Note: this does not wire up any controls; you must call connectControlsToPlayer() to do so. """ #https://github.com/imayushsaini/Bombsquad-Mr.Smoothy-Admin-Powerup-Server # convert None to an empty player-ref if player is None: player = bs.Player(None) Spaz.__init__(self, color=color, highlight=highlight, character=character, sourcePlayer=player, startInvincible=True, powerupsExpire=powerupsExpire) self.lastPlayerAttackedBy = None # FIXME - should use empty player ref self.lastAttackedTime = 0 self.lastAttackedType = None self.heldCount = 0 self.lastPlayerHeldBy = None # FIXME - should use empty player ref here self._player = player profiles = [] profiles = self._player.getInputDevice()._getPlayerProfiles() ### cName = player.getName() clID = self._player.getInputDevice().getClientID() cl_str = [] if cName[0] == ' ' or cName == '': bsInternal._disconnectClient(int( player.getInputDevice().getClientID())) bsInternal._chatMessage("No white Space Name Allowed") bsInternal._chatMessage("kicking" + cl_str) playeraccountid = self._player.get_account_id() if os.path.exists('stats2.json'): while True: try: with open('stats2.json') as f: stats = json.loads(f.read()) break except Exception as (e): print e time.sleep(0.05) else: stats = {} if playeraccountid not in stats: killed = 1 kills = 0 else: killed = stats[playeraccountid]['killed'] kills = stats[playeraccountid]['kills'] if (killed == 0): killed = 1 kd = kills / round(killed, 1) kd = round(kd, 3) ranked = False #print("kill",kills,"killed",killed,"kd",round(kd,3)) ##v if profiles == [] or profiles == {}: profiles = bs.getConfig()['Player Profiles'] reload(rank) if playeraccountid in rank.player: prank = rank.player.index(playeraccountid) + 1 ranked = True for p in profiles: try: if ranked: ranktag(owner=self.node, prank=prank, prefix=" ", prefixAnim={ 0: (0.85, 0.852, 0.85), 250: (0.59, 0.598, 0), 250 * 2: (0.75, 1, 0), 250 * 3: (0.9, 0.17, 0.028) }, prefixAnimate=False, particles=False) kdpronoobtag(owner=self.node, kd=kd, kills=kills, prefix=" ", prefixAnim={ 0: (0.85, 0.852, 0.85), 250: (0.59, 0.598, 0), 250 * 2: (0.75, 1, 0), 250 * 3: (0.9, 0.17, 0.028) }, prefixAnimate=False, particles=False) kdtag(owner=self.node, kd=kd, prefix=" ", prefixAnim={ 0: (0.85, 0.852, 0.85), 250: (0.59, 0.598, 0), 250 * 2: (0.75, 1, 0), 250 * 3: (0.9, 0.17, 0.028) }, prefixAnimate=False, particles=False) if playeraccountid in MID.smoothy: PermissionEffect(owner=self.node, prefix=u'\ue048 Smoothy \ue048', prefixAnim={ 0: (0.5, 0.011, 0.605), 250: (1, 0.411, 0.3411), 250 * 2: (1, 0.591, 0.811), 250 * 3: (0.829, 0.331, 0.403) }) break # do same to add more custom tags to owners or someone .. if playeraccountid in MID.admins: PermissionEffect(owner=self.node, kd=kd, prefix=u'\ue048 A.D.M.I.N \ue048', prefixAnim={ 0: (0.5, 0.011, 0.605), 250: (1, 0.411, 0.3411), 250 * 2: (1, 0.591, 0.811), 250 * 3: (0.829, 0.331, 0.403) }) break if playeraccountid in MID.vips: PermissionEffect(owner=self.node, kd=kd, prefix=u'\ue043 VIP \ue043', prefixAnim={ 0: (0.9, 0.611, 0.705), 250: (1, 0.311, 0.5411), 250 * 2: (0.7, 0.591, 0.811), 250 * 3: (0.729, 0.431, 0.703) }) break if playeraccountid in MID.members: PermissionEffect(owner=self.node, kd=kd, prefix=u" MEMBER ", prefixAnim={ 0: (0.85, 0.852, 0.85), 250: (0.59, 0.598, 0), 250 * 2: (0.75, 1, 0), 250 * 3: (0.9, 0.17, 0.028) }) break #you can give custom tag to anyone without giving any command permision # if playeraccountid in MID.anyname: # PermissionEffect(owner = self.node,kd=kd,prefix = u" anyname ",prefixAnim = {0: (0.85,0.852,0.85), 250: (0.59,0.598,0),250*2:(0.75,1,0),250*3:(0.9,0.17,0.028)}) # break except: pass # grab the node for this player and wire it to follow our spaz (so players' controllers know where to draw their guides, etc) if player.exists(): playerNode = bs.getActivity()._getPlayerNode(player) self.node.connectAttr('torsoPosition', playerNode, 'position')
def send_message(msg): if len(bsInternal._getGameRoster()) < 1: if bsUI.gPartyWindow is not None and bsUI.gPartyWindow() is not None: with bs.Context("UI"): bsUI.gPartyWindow()._addMsg(msg=msg, color=(1, 1, 1)) else: bsInternal._chatMessage(msg)
def opt(self, clientID=None, msg=""): global gEvent, admins, vips, settings global banned, prefixes if gSettingsEnabled: settings = bs.get_settings() admins, vips, banned, prefixes = settings.get("admins", []), settings.get("vips", []), \ settings.get("banned", []), settings.get("prefixes", {}) a = bsInternal._getForegroundHostActivity() roster = bsInternal._getGameRoster() if gEvent is None: gEvent = bsInternal._getAccountMiscReadVal('easter', False) def format_message(msg=''): msg = msg.replace("/", "") mg = msg.split(" ") command = mg[0].lower() if len(mg) > 1: arg = mg[1:] for i in range(len(arg)): key = arg[i] c = is_account(key, True) if c is not None: arg[i] = c else: arg[i] = key.lower() else: arg = [] if self.player is not None and self.player.exists() and command in ['s', 'summon'] and hasattr(self.player.actor.node, 'position'): if ('~' in arg) or ('^' in arg): rng = (2, 5) if len(arg) > 0: if arg[0] in ['f','flag']: rng = (1, 4) for i in range(rng[0], rng[1]): if len(arg) > i and arg[i] in ["~", "^"]: arg[i] = self.player.actor.node.position[i-rng[0]] return msg, command, arg def check_player(): global admins self.is_vip = self.is_admin = self.is_host = False self.player = None host = get_account_string(arg=bsInternal._getAccountDisplayString(True)) if gSettingsEnabled: hosts = bs.get_setting("hosts", []) if host not in hosts: hosts.append(host) bs.set_setting("hosts", hosts) else: hosts = [] if len(roster) > 0: account = None for i in roster: if i['clientID'] == clientID: account = i['displayString'].decode('utf-8') break if account is not None: if account in vips: self.is_vip = True if account in admins: self.is_vip = self.is_admin = True if account == host or (account != host and account in hosts): self.is_host = self.is_admin = self.is_vip = True for i in a.players: if i.exists(): id = i.getInputDevice().getClientID() if id == clientID: self.player = i else: self.is_host = self.is_admin = self.is_vip = True if len(a.players) > 0: self.player = a.players[0] check_player() msg, command, arg = format_message(msg=msg) if a is not None: with bs.Context(a): if command in ["h", "help"] and self.is_vip: commands, num = {1: []}, 1 def add_commands(cmds=[], commands={1: []}, num=1): for i in cmds: if len(commands[num]) < 30: commands[num].append(i) else: num += 1 commands[num] = [] commands[num].append(i) return commands, num commands, num = add_commands(["help - помощь", "time - установить время", \ "skin - изменить облик", "kick - выгнать из игры", \ "end - закончить игру", "sm - замедленный режим игры", \ "rise - возродить", "frozen - заморозить", "shatter - разделить на части"], commands=commands, num=num) if self.is_admin: commands, num = add_commands(['summon - вызвать объект', 'vip - выдать права vip-пользователя', \ 'punch - сила удара', 'hitpoints - очки жизни', 'prefix - выдать префикс', \ 'ban - забанить', 'mp - максимальное кол-во игроков', \ 'pause - остановить/продолжить игру', \ 'sleep - усыпить', 'head - ребят я черешня', \ 'nodes - список всех типов объектов на карте', 'connect - а это че', \ 'curse - проклятие'], commands=commands, num=num) if gEvent: commands, num = add_commands(['flex - хайпово флексить'], commands=commands, num=num) if self.is_admin: commands, num = add_commands(['dance - станцевать брейк', 'dance2 - станцевать лезгинку', 'party - устроить вечеринку'], commands=commands, num=num) if self.is_host: commands, num = add_commands(['default - отобрать права пользователя', \ 'admin - выдать права администратора'], commands=commands, num=num) commands, num = add_commands(['help [номер страницы] - следующий список команд', \ 'команды могут выполняться через спец-символ ;', 'pause;/pause(перед каждой командой /)'], commands=commands, num=num) num = 1 if len(arg) > 0 and bigger_than_zero(arg[0]): num=int(arg[0]) commands = commands.get(num, []) for i in commands: send_message(i) elif command in ["l", "list"] and self.is_vip: if len(roster) > 0: players = [] for i in [[c["id"] for c in k["players"]] for k in roster]: for d in i: players.append(d) players.sort() for i in roster: data = [(", ").join([r["nameFull"] for r in i["players"]]) if len(i["players"]) > 0 else " - ", (", ").join([str(players.index(r)) for r in [c["id"] for c in i["players"]]]) if len(i["players"]) > 0 else " - "] bsInternal._chatMessage(i["displayString"] + " : "+ data[0] + " : " + data[1]) else: if len(a.players) > 0: for i in a.players: bsInternal._chatMessage(i.getInputDevice().getPlayer().getName(True) + " : " + str(a.players.index(i))) else: send_message(" - ") elif command in ['timeset', 'time'] and self.is_vip: if len(arg) > 0: tint = get_tint() self.time.update({"normal": get_normal_tint()}) for i in self.time: if arg[0] == i: bs.getSharedObject("globals").tint = tint = self.time[i] break if arg[0] == 'cycle': bs.getSharedObject('globals').tint = tint = get_normal_tint() set_tint(tint=tint) else: for i in ['time [normal|sunrise|day|noon|sunset|night|cycle]', \ 'timeset cycle - дневной цикл(плавная смена времени)', \ 'timeset noon - середина дня', 'timeset sunset - закат']: send_message(i) elif command in ['summon','s'] and self.is_admin: if len(arg) > 0: if arg[0] in ['bomb','b']: if len(arg) > 1: bombs = [i.lower() for i in gBombs] bombType, pos, count = 'normal', [0, 5, 0], 1 bombType = gBombs[bombs.index(arg[1].lower())] if arg[1].lower() in bombs else 'normal' if len(arg) > 5: count = min(30, int(arg[5])) if bigger_than_zero(arg[5]) else 1 for i in range(2, 5): if len(arg) > i and is_num(arg[i]): pos[i-2] = float(arg[i]) for i in range(count): bs.Bomb(position=tuple(pos), bombType=bombType).autoRetain() else: mg = bs.text_split(words=gBombs) mg += "s bomb [название] [позиция(3 числа)] [кол-во]\ns bomb normal 0 5 0 1" for i in mg.split('\n'): send_message(i) elif arg[0] in ['bot']: if len(arg) > 1: bots = [i.lower() for i in gBots] botType, pos, count = 'BomberBot', [0, 5, 0], 1 botType = gBots[bots.index(arg[1].lower())] if arg[1].lower() in bots else 'BomberBot' if len(arg) > 5: count = min(30, int(arg[5])) if bigger_than_zero(arg[5]) else 1 for i in range(2, 5): if len(arg) > i and is_num(arg[i]): pos[i-2] = float(arg[i]) if hasattr(bsSpaz, botType): bot = eval("bsSpaz."+botType) if not hasattr(self, "_bots") or (hasattr(self, "_bots") and self._bots is None): self._bots = bs.BotSet() for i in range(count): self._bots.spawnBot(bot, pos=tuple(pos), spawnTime=0, onSpawnCall=self._on_spawn) else: mg = bs.text_split(words=gBots, words_count=3) mg += "s bot [название] [позиция(3 числа)] [кол-во]\ns bot BomberBot 0 5 0 1" for i in mg.split('\n'): send_message(i) elif arg[0] in ['flag','f']: if len(arg) > 1: pos, count, time_out, color = [0, 5, 0], 1, 20, [1, 1, 0] if len(arg) > 4: count = min(30, int(arg[4])) if bigger_than_zero(arg[4]) else 1 if len(arg) > 5: time_out = int(arg[5]) if bigger_than_zero(arg[5]) else 20 for i in range(1, 4): if len(arg) > i and is_num(arg[i]): pos[i-1] = float(arg[i]) for i in range(6, 9): if len(arg) > i and is_num(arg[i]): color[i-6] = float(arg[i]) for i in range(count): bs.Flag(position=tuple(pos), droppedTimeout=time_out, color=color).autoRetain() else: for i in ["s flag [позиция(3 числа)] [кол-во] [тайм-аут] [цвет(3 числа)]", \ "s flag 0 5 0", "s flag ~ ~ ~ 10 999 1 0 0"]: send_message(i) elif arg[0] in ['powerup','p']: if len(arg) > 1: powerups = [i.lower() for i in gPowerups] powerupType, pos, count = 'punch', [0, 5, 0], 1 powerupType = gPowerups[powerups.index(arg[1].lower())] if arg[1].lower() in powerups else 'punch' if len(arg) > 5: count = min(30, int(arg[5])) if bigger_than_zero(arg[5]) else 1 for i in range(2, 5): if len(arg) > i and is_num(arg[i]): pos[i-2] = float(arg[i]) for i in range(count): bs.Powerup(position=tuple(pos),powerupType=powerupType).autoRetain() else: mg = bs.text_split(words=gPowerups) mg += "s p [название] [позиция(3 числа)] [кол-во]\ns p punch 0 5 0 1" for i in mg.split('\n'): send_message(i) elif arg[0] in ['box']: if len(arg) > 1: boxTypes = ['s','small','big','b'] boxType, pos, count = 'small', [0, 5, 0], 1 boxType = arg[1].lower() if arg[1].lower() in boxTypes else 'small' if len(arg) > 5: count = min(30, int(arg[5])) if bigger_than_zero(arg[5]) else 1 for i in range(2, 5): if len(arg) > i and is_num(arg[i]): pos[i-2] = float(arg[i]) for i in range(count): Box(pos=tuple(pos), scale=1 if boxType in ["s","small"] else 1.38, owner=None).autoRetain() else: for i in ["s box [small|big] [позиция] [кол-во]", \ "s box small 0 5 0", "s box big ~ ~ ~ 5"]: send_message(i) else: for i in ["summon [bomb|powerup|bot|box|flag]", "bomb - вызвать бомбу.", "powerup - вызвать усилитель.", "bot - вызвать бота.", "box - вызвать коробку."]: send_message(i) elif command in ['skin'] and self.is_vip: if len(arg) > 0: if len(arg) < 2: arg.append(get_account_string(self.player)) if arg[0] in gSkins or arg[0] == 'delete': account = is_account(arg[1], True) if arg[1] == "all": if arg[0] == 'delete': for i in a.players: skins.delete_skin(i) else: skins.change_skin(skin=arg[0], players=[a.players]) elif account is not None: if arg[0] == 'delete': skins.delete_skin(account) else: skins.change_skin(skin=arg[0], players=[account]) elif is_num(arg[1]): if len(a.players) > int(arg[1]) and int(arg[1]) >= 0: if arg[0] == 'delete': skins.delete_skin(int(arg[1])) else: skins.change_skin(skin=arg[0], players=[int(arg[1])]) else: mg = bs.text_split(words=gSkins) mg += "skin [название] [номер игрока]\nskin bunny 0\nskin pixie" for i in mg.split('\n'): send_message(i) elif command in ['ph','punch','hp','hitpoints'] and self.is_admin: if len(arg) > 0 and len(a.players) > 0: if len(arg) < 2: player = [self.player] if len(arg) > 1: if is_num(arg[1]) and len(a.players) > int(arg[1]) and int(arg[1]) >= 0: player = [a.players[int(arg[1])]] elif arg[1] == "all": player = a.players if player is not None: if bigger_than_zero(arg[0]): arg[0] = int(arg[0]) if command in ["punch", "ph"] and arg[0] > 10: arg[0] = 10 for i in player: if i.exists(): if command in ["punch", "ph"]: i.actor._punchPowerScale = arg[0] else: i.actor.hitPointsMax = i.actor.hitPoints = arg[0] else: for i in [command+" [число] [номер игрока | all]", \ command+" 1000 0", command+" 10 all"]: send_message(i) elif (command in ['vip'] and self.is_admin) or (command in ['admin'] and self.is_host): if len(arg) > 0: self.add_admin(True if command == "admin" else False, get_account_string(arg[0])) else: for i in [command+" [номер игрока|имя аккаунта]", \ command+" 0", command+u" \ue030PC123456"]: send_message(i) elif command in ['df','default'] and self.is_host: if len(arg) > 0: self.del_admin(get_account_string(arg[0])) else: for i in [command+" [номер игрока|имя аккаунта]", \ command+" 0", command+u" \ue030PC123456"]: send_message(i) elif command in ['prefix'] and self.is_admin: global prefixes if len(arg) > 0: type = arg[1] if len(arg) > 1 else "spark" prefix = "prefix" if len(arg) < 3 else (" ").join(msg.split(" ")[3:]) if arg[0] == 'delete' and len(arg) > 1: account = get_account_string(arg[1]) elif arg[0] != 'delete': account = get_account_string(arg[0]) else: account = None if arg[0] == 'delete': if account is not None and account in prefixes: prefixes.pop(account) if gSettingsEnabled: bs.set_setting("prefixes", prefixes) else: self.set_prefix(account=account, prefix=prefix, type=type) else: for i in ["prefix [номер игрока | имя аккаунта] [slime|ice|spark|rock|metal] [префикс]", \ "prefix 0 spark клоун сбежал"]: send_message(i) elif command in ['kick'] and self.is_vip: if len(arg) > 0: account = get_account_string(arg[0]) if account is not None and len(roster) > 0: id = None for i in roster: if i['displayString'].decode('utf-8') == account: id = i['clientID'] break if id is not None: bsInternal._disconnectClient(id, 300) else: for i in [command+" [номер игрока|имя аккаунта]", \ command+" 0", command+u" \ue030PC123456"]: send_message(i) elif command in ['ban'] and self.is_admin: if len(arg) > 0: self.ban(account=get_account_string(arg[0])) else: for i in [command+" [номер игрока|имя аккаунта]", \ command+" 0", command+u" \ue030PC123456"]: send_message(i) elif command in ['end'] and self.is_vip: if hasattr(a, "endGame"): a.endGame() else: send_message("Сейчас это недоступно") elif command in ['party','pt'] and self.is_admin: if hasattr(a, 'cameraFlash') and gEvent: time = 1000 def run(time=1000): color = tuple([random.randrange(1,2) for i in range(3)]) a.cameraFlash(duration=time, color=color) if hasattr(a, "_partyFlash") and a._partyFlash is not None: a._partyFlash = None a._cameraFlash = [] else: run(time=time) a._partyFlash = bs.Timer(time, bs.Call(run, time), True) else: send_message("Сейчас это недоступно") elif command in ['sm'] and self.is_vip: bs.getSharedObject("globals").slowMotion = motion = bs.getSharedObject("globals").slowMotion == False set_motion(motion=motion) elif command in ['pause'] and self.is_admin: bs.getSharedObject("globals").paused = bs.getSharedObject("globals").paused == False elif command in ['max_players', 'mp'] and self.is_admin: if bigger_than_zero(arg[0]): bsInternal._setPublicPartyMaxSize(int(arg[0])) else: for i in ["mp [кол-во игроков]", "mp 8", "максимальное кол-во игроков сейчас: "+str(bsInternal._getPublicPartyMaxSize())]: send_message(i) elif command in ['shatter', 'sh'] and self.is_vip: if len(arg) > 0: def shatter(player=None, shatterMultiple=1): if player is not None and player.exists() and player.isAlive(): player.actor.node.shattered = shatterMultiple player.actor.shattered = True if shatterMultiple > 0 else False if bigger_than_zero(arg[0]): if len(arg) > 1: if is_num(arg[1]) and int(arg[1]) < len(a.players): shatter(a.players[int(arg[1])], int(arg[0])) elif arg[1] == "all": for i in a.players: shatter(i, int(arg[0])) elif self.player is not None: shatter(self.player, int(arg[0])) else: for i in [command+" [число] [номер игрока | all]", command+" 2 0", command+" 10"]: send_message(i) elif command in ['frozen', 'fr'] and self.is_vip: if len(arg) > 0: def frozen(player=None): if player is not None and player.exists() and player.isAlive(): player.actor.node.frozen = player.actor.node.frozen == 0 player.actor.frozen = player.actor.frozen == False if is_num(arg[0]) and int(arg[0]) < len(a.players): frozen(a.players[int(arg[0])]) elif arg[0] == "all": for i in a.players: frozen(i) elif self.player is not None: frozen(self.player) else: for i in [command+" [номер игрока | all]", command+" 2", \ command+" me", "введи команду повторно, чтобы её отменить"]: send_message(i) elif command in ['sleep','sl'] and self.is_admin: if len(arg) > 0: def sleep(player=None, sleepTime=5000): def work(player=None, sleepTime=5000): if player is not None and player.exists() and player.isAlive(): player.actor.node.handleMessage('knockout', sleepTime) if not hasattr(player.actor, 'sleepTime') or (hasattr(player.actor, 'sleepTime') and player.actor.sleepTime is None): player.actor.sleepTime = sleepTime else: player.actor.sleepTime -= 500 if player.actor.sleepTime <= 0: player.actor._sleep = player.actor.sleepTime = None if player is not None and player.exists() and player.isAlive(): if sleepTime > 500: if hasattr(player.actor, '_sleep') and player.actor._sleep is not None: player.actor._sleep = None else: player.actor._sleep = bs.Timer(500, bs.Call(work, player, sleepTime), repeat=True) work(player=player, sleepTime=sleepTime) else: work(player=player, sleepTime=sleepTime) if bigger_than_zero(arg[0]): if len(arg) > 1: if is_num(arg[1]) and int(arg[1]) < len(a.players): sleep(a.players[int(arg[1])], int(arg[0])) elif arg[1] == "all": for i in a.players: sleep(i, int(arg[0])) elif self.player is not None: sleep(self.player, int(arg[0])) else: for i in [command+" [число] [номер игрока | all]", command+" 2000 0", \ command+" 5000", "введи команду повторно, чтобы её отменить"]: send_message(i) elif command in ['curse','cr'] and self.is_admin: if len(arg) > 0: def curse(player=None): if player is not None and player.exists() and player.isAlive(): if hasattr(player.actor, 'curse'): player.actor.curse() if is_num(arg[0]) and int(arg[0]) < len(a.players): curse(a.players[int(arg[0])]) elif arg[0] == "all": for i in a.players: curse(i) elif self.player is not None: curse(self.player) else: for i in [command+" [номер игрока | all]", command+" 2", command+" me"]: send_message(i) elif command in ['nodes'] and self.is_admin: if len(arg) > 0: if arg[0] == 'types': nodes = list(set([i.getNodeType() for i in bsInternal.getNodes() if hasattr(i, "getNodeType")])) if arg[0] == 'names': nodes = [i.getName() for i in bsInternal.getNodes() if hasattr(i, 'getName')] if len(arg) > 1: nodes = [i for i in nodes if arg[1].lower() in i.lower()] for i in bs.text_split(words=nodes, stroke_on_end=False).split('\n'): send_message(i) else: for i in [command+' types spaz', command+' types', command+' names']: send_message(i) elif command in ['connect'] and self.is_admin: def connect(node=None, connected_node=None, type='position'): if node is not None and node.exists(): if connected_node is not None and connected_node.exists(): try: node.connectAttr(type, connected_node, type) except: pass if len(arg) > 0: node = [i for i in bsInternal.getNodes() if hasattr(i, 'getName') and i.getName().lower() == arg[0].lower()] if len(node) > 0: node = node[0] if len(arg) < 3: arg[2] = 'position' if is_num(arg[1]) and int(arg[1]) < len(a.players): player = a.players[int(arg[1])] if player.exists(): connect(player.actor.node, node, arg[2]) elif arg[1] == "all": for i in a.players: if i.exists(): connect(i.actor.node, node, arg[2]) elif self.player is not None and self.player.exists(): connect(self.player.actor.node, node, arg[2]) else: for i in [command+' [имя объекта (/nodes names)] [номер игрока | all] [тип присоединения]', \ command+' [email protected]:259 all position']: send_message(i) elif command in ['head'] and self.is_admin: if len(arg) > 0: def head(player=None): if player is not None and player.exists() and player.isAlive(): player.actor.node.holdNode = player.actor.node if is_num(arg[0]) and int(arg[0]) < len(a.players): head(a.players[int(arg[0])]) elif arg[0] == "all": for i in a.players: head(i) elif self.player is not None: head(self.player) else: for i in [command+" [номер игрока | all]", command+" 2", command+" me"]: send_message(i) elif command in ['rise', 'rs'] and self.is_vip: if len(arg) > 0: def respawn(player=None): if player is not None and player.exists() and not player.isAlive(): player.gameData['respawnTimer'] = player.gameData['respawnIcon'] = None with bs.Context(a): a.spawnPlayer(player=player) if is_num(arg[0]) and int(arg[0]) < len(a.players): respawn(a.players[int(arg[0])]) elif arg[0] == "all": for i in a.players: respawn(i) elif self.player is not None: respawn(self.player) else: for i in [command+" [номер игрока | all]", command+" 2", command+" me"]: send_message(i) elif command in ['flex','fl'] and self.is_vip: if not gEvent: send_message("Сейчас это недоступно") return if len(arg) > 0: def flex(actor=None): def work(node=None): if node is not None and node.exists(): node.handleMessage('celebrate', 1000) if actor is not None and actor.exists(): if not hasattr(actor, '_flex') or (hasattr(actor, '_flex') and actor._flex is None): actor._flex = bs.Timer(1000, bs.Call(work, actor.node), repeat=True) work(node=actor.node) else: actor._flex = None if is_num(arg[0]) and int(arg[0]) < len(a.players): flex(a.players[int(arg[0])].actor) elif arg[0] == 'all': for i in find_players_and_bots(): flex(i) elif self.player is not None and self.player.exists(): flex(self.player.actor) else: for i in [command+" [номер игрока|all]", command+" 0", command+" me", "введи команду повторно, чтобы её отменить"]: send_message(i) elif command in ['dn', 'dance'] and self.is_admin: if not gEvent: send_message("Сейчас это недоступно") return if len(arg) > 0: def dance(actor=None): def work(node=None): if node is not None and node.exists(): pos = (node.position[0], node.position[1] + 0.5, node.position[2]) node.handleMessage("impulse", pos[0], pos[1], pos[2], 0, -2, 0, 2000, 0, 1, 0, 0, -2, 0) if actor is not None and actor.exists(): if not hasattr(actor, '_dance') or (hasattr(actor, '_dance') and actor._dance is None): actor._dance = bs.Timer(100, bs.Call(work, actor.node), repeat=True) work(node=actor.node) else: actor._dance = None if is_num(arg[0]) and int(arg[0]) < len(a.players): dance(a.players[int(arg[0])].actor) elif arg[0] == 'all': for i in find_players_and_bots(): dance(i) elif self.player is not None and self.player.exists(): dance(self.player.actor) else: for i in [command+" [номер игрока|all]", command+" 0", command+" me", "введи команду повторно, чтобы её отменить"]: send_message(i) elif command in ['dn2', 'dance2'] and self.is_admin: if not gEvent: send_message("Сейчас это недоступно") return if len(arg) > 0: def dance2(actor=None): def work(node=None): if node is not None and node.exists(): node.jumpPressed = True node.jumpPressed = False if actor is not None and actor.exists(): if not hasattr(actor, '_dance2') or (hasattr(actor, '_dance2') and actor._dance2 is None): actor._dance2 = bs.Timer(500, bs.Call(work, actor.node), repeat=True) work(node=actor.node) else: actor._dance2 = None if is_num(arg[0]) and int(arg[0]) < len(a.players): dance2(a.players[int(arg[0])].actor) elif arg[0] == 'all': for i in find_players_and_bots(): dance2(i) elif self.player is not None and self.player.exists(): dance2(self.player.actor) else: for i in [command+" [номер игрока|all]", command+" 0", command+" me", "введи команду повторно, чтобы её отменить"]: send_message(i)