Page 1 of 1

[SCRIPT] map_roof

Posted: Sat Oct 19, 2013 11:48 am
by Kuma
This script was made to prevent people from flying over the limit of z. Doing this may crash the client(Ace of spades). You can add the max height people can fly to in config. By default the value is -4 (4 blocks more than the limit) Add it like this
Code: Select all
"map_roof" : -4 (Change -4 with some other number, for eg -5)
The code itself
Code: Select all
#Map_roof by Kuma

from pyspades.server import position_data

def apply_script(protocol, connection, config):

  class roofConnection(connection):
    def on_position_update(self):
      protocol = self.protocol
      obj = self.world_object
      position = obj.position
      x, y, z = position.x, position.y, position.z
      if z <= protocol.ROOF:
        obj.set_position(x, y, protocol.ROOF)
        position_data.x = x
        position_data.y = y
        position_data.z = protocol.ROOF
        self.send_contained(position_data)
        return connection.on_position_update(self)

  class roofProtocol(protocol):
    ROOF = config.get('map_roof', -4.0) #I recommed less than -4.0

  return roofProtocol, roofConnection