Exemplo n.º 1
0
def eventListener(obj, f):
	"""
	The making of this plugin was hell. 
	F**k the iourt team for the stupid
	decisions in the way flag capping is
	handled. Die in a cold, dark, horrible
	place.
	-B1
	"""
	global A, redFlag, blueFlag
	if redFlag == None: redFlag = Timer()
	if blueFlag == None: blueFlag = Timer()

	elif obj.type == "GAME_FLAGPICKUP":
		print obj.data['flagid'], redFlag.status, blueFlag.status
		if obj.data['flagid'] == 1 and redFlag.status == 0: redFlag.start()
		elif obj.data['flagid'] == 2 and blueFlag.status == 0: blueFlag.start()

	elif obj.type == "GAME_FLAGRETURN":
		if obj.data['flagid'] == 1: redFlag.reset()
		elif obj.data['flagid'] == 2: blueFlag.reset()

	elif obj.type == "GAME_FLAGCAPTURE":
		if obj.data['flagid'] == 2:
			redFlag.stop()
			A.say('%sRed %sFlag captured in %s%s seconds' % (A.RED, A.YELLOW, A.CYAN, redFlag.value()))
			redFlag.reset()
		elif obj.data['flagid'] == 1:
			blueFlag.stop()
			A.say('%sBlue %sFlag captured in %s%s seconds' % (A.BLUE, A.YELLOW, A.CYAN, blueFlag.value()))
			blueFlag.reset()
	elif obj.type == "GAME_FLAGRESET":
		if obj.data['flagid'] == 1: redFlag.reset()
		elif obj.data['flagid'] == 2: blueFlag.reset()
Exemplo n.º 2
0
def cmdTeams(obj, t):
	msg = obj.data["msg"].split(" ")
	sender = obj.data["sender"]

	redPlayers = A.retrieveTeam('red')
	bluePlayers = A.retrieveTeam('blue')
	toTeam = 0
	fromTeam = None
	
	difference = abs(len(redPlayers) - len(bluePlayers))
	if difference <= 1:
		A.tell(sender, "Teams are already balanced.")
		return

	A.rcon('bigtext "AUTO-BALANCING TEAMS')

	if len(bluePlayers) > len(redPlayers):
		fromTeam = bluePlayers
		toTeam = 1
	elif len(redPlayers) > len(bluePlayers):
		fromTeam = redPlayers
		toTeam = 2
	
	while difference > 1:
		# pick a cid from fromTeam
		cid = random.choice(fromTeam)
		fromTeam.remove(cid)
		A.rcon("forceteam %s %s" % (cid, toTeam))
		difference -= 1
	
	A.say("Balanced teams.") #<<< should be told to the user?
Exemplo n.º 3
0
def init(x=0):
	A.debug('ads.init() was called... looping', _name)
	while True:
		time.sleep(leng)
		if len(A.B.Clients) > 1: #Only print ads
			A.say(msg[x])
			x+=1
			if x >= len(msg): x = 0
Exemplo n.º 4
0
def welcomeEvent(obj, t):
	time.sleep(8)
	A.say('Everyone welcome ^1%s ^3to the server!' % A.B.Clients[obj.data['client']].nick)
Exemplo n.º 5
0
def testr(obj, n0):
	A.say('TESTING 1... 2... 3...')
	print "Testing!"