Page 1 of 1

[REQUEST]Infinite Blocks

Posted: Fri Nov 08, 2013 12:59 am
by Bux Xray
Hi,,I wnna request a script that everyone can use it

like b4yl

you can do /blocks but it just makes your blocks infinite but anyone can still kill you

Re: [REQUEST]Infinite Blocks

Posted: Fri Nov 08, 2013 10:51 am
by Kuma
Here something I made in haste (tested only once) It heals you like the tent/cp heal when you place a block/line.
WARNING: I don't think this script is compatible with PEACE script (PEACE has its own way for infinite blocks)
Code: Select all
from commands import add, name

@name('blocks')
def toggle_infi_blocks(connection):
    protocol = connection.protocol
    if connection in protocol.players:
        connection.infi_blocks = not connection.infi_blocks
        return "You are {} infinite blocks mode.".format(["out of", "now in"][int(connection.infi_blocks)])

add(toggle_infi_blocks)

def apply_script(protocol, connection, config):

    class blockConnection(connection):
        infi_blocks = False
        
        def on_block_build(self, x, y, z):
            if self.infi_blocks:
                self.refill()
            return connection.on_block_build(self, x, y, z)

        def on_line_build(self, points):
            if self.infi_blocks:
                self.refill()
            return connection.on_line_build(self, points)

    return protocol, blockConnection

Re: [REQUEST]Infinite Blocks

Posted: Fri Nov 08, 2013 3:39 pm
by Dr.Morphman
hmm there is no way to actualy set the amount of blocks a player is carrying with him even though there is a player.blocks variable right?

Re: [REQUEST]Infinite Blocks

Posted: Fri Nov 08, 2013 5:36 pm
by Kuma
Dr.Morphman wrote:
hmm there is no way to actualy set the amount of blocks a player is carrying with him even though there is a player.blocks variable right?
But there is no way to send the packet to the client so it won't matter any way. (UNLESS almighty polm has a solution!)
EDIT:
This may be done by storing their health in some variables and after the .refill() we can just set their health and ammo to that. The problem is that grenades are similar to blocks and there is no way to send a grenade packet as a ammunition (we can create a grenade in the world like you said.)