Page 1 of 1

[script] demolition man

Posted: Sun Nov 10, 2013 8:36 pm
by learn_more
infinite nades & ammo (ammo restocks on reload)
it's using the tent restock, so you get free health aswell.

https://github.com/learn-more/pysnip/bl ... tionman.py

Code: Select all
"""
Demolition man script.
Copyright (c) 2013 learn_more
See the file license.txt or http://opensource.org/licenses/MIT for copying permission.

Restocks the user when reloading / throwing a nade.
"""

from commands import add, admin

DEMOLITION_ENABLED_AT_ROUND_START = False

@admin
def toggledemo(connection):
	connection.protocol.demolitionEnabled = not connection.protocol.demolitionEnabled
	message = 'Demolition is now disabled'
	if connection.protocol.demolitionEnabled:
		message = 'Demolition is now enabled'
	connection.protocol.send_chat(message, irc = True)
	return 'ok :)'

add(toggledemo)

def apply_script(protocol, connection, config):
	class DemolitionProtocol(protocol):
		demolitionEnabled = DEMOLITION_ENABLED_AT_ROUND_START

		def on_map_change(self, map):
			self.demolitionEnabled = DEMOLITION_ENABLED_AT_ROUND_START
			return protocol.on_map_change(self, map)

	class DemolitionConnection(connection):

		def _on_reload(self):
			if self.protocol.demolitionEnabled:
				self.refill()
			return connection._on_reload(self)

		def on_grenade_thrown(self, grenade):
			if self.protocol.demolitionEnabled:
				self.refill()
			return connection.on_grenade_thrown(self, grenade)

		def on_spawn(self, pos):
			if self.protocol.demolitionEnabled:
				self.send_chat('You are the demolition man, grenades & ammo will be restocked!')
			return connection.on_spawn(self, pos)
		
	return DemolitionProtocol, DemolitionConnection

Re: [script] demolition man

Posted: Mon Nov 11, 2013 12:29 am
by Kuma
Isn't this like, god mode.
But anyways, nice for a first. Better than mine :P
Adding a command to toggle this would be nice.

Re: [script] demolition man

Posted: Mon Nov 11, 2013 12:45 am
by JoJoe_Stinky
This totally rock! Thanks!

Great for testing out maps on a local server. Blue_Sunglasses1 Green_Sunglasses1 , I am going to be linking mapper here for tutorials :)

Thanks LearnMore!

Re: [script] demolition man

Posted: Mon Nov 11, 2013 10:00 am
by learn_more
Kuma wrote:
Isn't this like, god mode.
But anyways, nice for a first. Better than mine :P
Adding a command to toggle this would be nice.
almost yeah,
but it's great fun for destroying maps :)

yesterday i was testing some shit, and you can create nice tunnels and shit with this.
Kuma wrote:
Isn't this like, god mode.
But anyways, nice for a first. Better than mine :P
Adding a command to toggle this would be nice.
yeah, ill make a toggle probably.

Re: [script] demolition man

Posted: Wed Nov 13, 2013 11:48 pm
by learn_more
added toggle
at map change the demomode gets disabled.