[script] demolition man

5 posts Page 1 of 1
learn_more
Coder
Coder
Posts: 890
Joined: Sun Mar 24, 2013 9:59 pm


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
Last edited by learn_more on Sun Nov 24, 2013 3:47 pm, edited 3 times in total.
Kuma
Scripter
Scripter
Posts: 758
Joined: Fri Mar 22, 2013 10:05 am


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.
JoJoe_Stinky
Mapper
Mapper
Posts: 173
Joined: Thu Oct 24, 2013 3:53 pm


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!
learn_more
Coder
Coder
Posts: 890
Joined: Sun Mar 24, 2013 9:59 pm


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.
learn_more
Coder
Coder
Posts: 890
Joined: Sun Mar 24, 2013 9:59 pm


added toggle
at map change the demomode gets disabled.
5 posts Page 1 of 1
Return to “Features & Enhancements”

Who is online

Users browsing this forum: No registered users and 1 guest