def pm(script, name, *args): player = get_player(script.server, name) message = ' '.join(args) player.send_chat('%s (PM): %s' % (script.connection.name, message)) print '%s to %s (PM): %s' % (script.connection.name, player.name, message) return 'PM sent to player.name' bot.me('%s to %s (PM): %s' % (script.connection.name, player.name, message))
def stun(script, name, stun_duration=500): player = get_player(script.server, name) damage_player(script, player, stun_duration=stun_duration) message = '%s was stunned' % player.name print message script.server.send_chat(message) bot.me(message)
def kill(script, name): player = get_player(script.server, name) damage_player(script, player, damange=player.entity_data.hp + 100.0) message = '%s was killed' % player.name print message script.server.send_chat(message) bot.me(message)
def whereis(script, name = None): if name is None: player = script.protocol message = 'You are at %s' else: player = get_player(script.factory, name) message = '%s is at %%s' % player.get_name() return message % (get_chunk(player.get_position()),)
def whereis(script, name=None): if name is None: player = script.connection message = 'You are at %s' else: player = get_player(script.server, name) message = '%s is at %%s' % player.name return message % (get_chunk(player.position),)
def kill(script, name): player = get_player(script.server, name) packet = HitPacket() packet.entity_id = player.entity_id packet.target_id = player.entity_id packet.hit_type = HIT_NORMAL packet.damage = player.entity_data.hp + 1000.0 packet.critical = 1 packet.stun_duration = 0 packet.something8 = 0 packet.pos = player.position packet.hit_dir = Vector3() packet.skill_hit = 0 packet.show_light = 0 script.server.update_packet.player_hits.append(packet) message = '%s was killed' % player.name print message script.server.send_chat(message)
def kick(script, name): player = get_player(script.factory, name) player.kick()
def ban(script, name, *args): player = get_player(script.server, name) reason = ' '.join(args) or DEFAULT_REASON script.parent.ban(player.address.host, reason)
def ban_player(self, player_id, *args): player = get_player(self.server, "#" + player_id) reason = ' '.join(args) or "No reason specified" self.server.call_scripts('ban', player.address.host, reason) return json.dumps({"response": "Success"})
def kick_player(self, player_id): player = get_player(self.server, "#" + player_id) player.kick() return json.dumps({"response": "Success"})
def kick(script, name): player = get_player(script.server, name) player.kick()
def getip(script, name): player = get_player(script.server, name) playerIP = player.connection.host return playerIP
def get_player(self, name): if not name or not isinstance(name, basestring): raise InvalidPlayer() return get_player(self.server, name)