Page 1 of 1

[SCRIPT] teamlock.py

Posted: Wed Jan 21, 2015 6:12 am
by kmsi
usage : /teamlock

my first script! xD
after this command enabled, every new players coming would be switched to specator team.
Code: Select all
"""
Script by kmsi(kmsiapps@gmail.com)
When someone logins, switch his team to spectator_team.
Usage : /teamlock
"""
from commands import add, admin

lock_team=False

@admin
def teamlock(connection):
	global lock_team
	if lock_team==True:
		lock_team=False
	elif lock_team==False:
		lock_team=True
	value=lock_team
	on_off = ['UNLOCKED', 'LOCKED'][int(value)]
	connection.protocol.send_chat('BOTH TEAM are %s' % on_off)
add(teamlock)
		
def apply_script(protocol, connection, config):
	class kmsiconnection(connection):
		def on_login(self, name):
			if lock_team:
				self.send_chat('Both team are locked. You only can spectate!')
				self.set_team(self.protocol.spectator_team)
				self.respawn()
			return connection.on_login(self, name)
	return protocol, kmsiconnection	

Re: [SCRIPT] teamlock.py

Posted: Wed Jan 21, 2015 5:55 pm
by Silnius
Nice first script, it could be useful when team have some match !
(btw i am not sure that you posted on the right subforums)

Re: [SCRIPT] teamlock.py

Posted: Thu Jan 22, 2015 1:44 am
by kmsi
Silnius wrote:
Nice first script, it could be useful when team have some match !
(btw i am not sure that you posted on the right subforums)
Thank you. I coudln't post on "Pending Approval" forum so i posted here Blue_Crying

Re: [SCRIPT] teamlock.py

Posted: Thu Jan 22, 2015 3:36 am
by Lincent
You made some grammar mistakes it should be (Both teams are locked. You only can spectate!)

Re: [SCRIPT] teamlock.py

Posted: Thu Jan 22, 2015 6:04 am
by kmsi
Lincent wrote:
You made some grammar mistakes it should be (Both teams are locked. You only can spectate!)
Thanks. I'll correct it.

Re: [SCRIPT] teamlock.py

Posted: Fri Jan 23, 2015 8:24 am
by Mr.Torch
Nice