[SCRIPT] teamlock.py

Intended for use on live public servers.
6 posts Page 1 of 1 First unread post
kmsi
Mapper
Mapper
Posts: 46
Joined: Fri Jan 03, 2014 3:25 am


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([email protected])
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	
Attachments
teamlock.py
(803 Bytes) Downloaded 354 times
Last edited by kmsi on Sat Jan 24, 2015 2:41 am, edited 2 times in total.
Silnius
Assistant Moderator
Assistant Moderator
Posts: 274
Joined: Mon Nov 05, 2012 8:15 am


Nice first script, it could be useful when team have some match !
(btw i am not sure that you posted on the right subforums)
kmsi
Mapper
Mapper
Posts: 46
Joined: Fri Jan 03, 2014 3:25 am


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
Lincent
Veterans
Veterans
Posts: 693
Joined: Wed Mar 27, 2013 9:47 pm


You made some grammar mistakes it should be (Both teams are locked. You only can spectate!)
kmsi
Mapper
Mapper
Posts: 46
Joined: Fri Jan 03, 2014 3:25 am


Lincent wrote:
You made some grammar mistakes it should be (Both teams are locked. You only can spectate!)
Thanks. I'll correct it.
Mr.Torch
Artist
Artist
Posts: 988
Joined: Sat Dec 15, 2012 2:46 am


Nice
6 posts Page 1 of 1 First unread post
Return to “Completed Releases”

Who is online

Users browsing this forum: No registered users and 1 guest