Example #1
0
def cmdTempBan(obj, t): 
	#!tempban Joey length reason
	db = database.DB()
	db.tableSelect('clients')
	msg = obj.data["msg"].split(" ", 3)
	sender = obj.data['sender']
	senderobj = A.findClient(sender)

	if len(msg) == 3: #!ban joey
		reason = 'No Reason Given'
	elif len(msg) == 4: #!ban joey my special reason
		reason = msg[3].strip()
	else: A.tell(sender, 'Usage: !tempban <player> <duration> [reason]')

	if 1 < len(msg) < 5:
		ctime = datetime.now()
		etime = datetime(ctime.year, ctime.month, ctime.day, ctime.hour, ctime.minute, ctime.second) + timedelta(minutes=const.timeparse(msg[2]))
		exptime = time.mktime(etime.timetuple())
		banr = A.findClient(msg[1])
		if banr != None:
			banrdb = db.rowFind(banr.cid)
			db.tableSelect('penalties')
			db.rowCreate({'userid':banr.cid, 'adminid':senderobj.cid, 'type':'tempban', 'reason':reason, 'time':ctime, 'expiration':exptime, 'status':1})
			db.commit()
			A.tell(banr.uid, 'Temp Banned tell %s' % etime.__str__())
			A.kick(banr.uid)
			A.tell(sender, 'Temp Banned %s tell %s!' % (banr.name, etime.__str__()))
	else: A.tell(sender, 'Usage: !tempban <player> <duration> [reason]')
Example #2
0
def cmdBan(obj, t):
	#!ban Joey He's an idiot
	db = database.DB()
	db.tableSelect('clients')
	msg = obj.data["msg"].split(" ", 2)
	sender = obj.data['sender']
	senderobj = A.findClient(sender)
	ctime = datetime.now()

	if len(msg) == 2: #!ban joey
		reason = 'No Reason Given'
	elif len(msg) == 3: #!ban joey my special reason
		reason = msg[2].strip()
	else: A.tell(sender, 'Usage: !ban <player> [reason]')

	if 1 < len(msg) < 4:
		banr = A.findClient(msg[1])
		if banr != None:
			banrdb = db.rowFind(banr.cid)
			db.tableSelect('penalties')
			db.rowCreate({'userid':banr.cid, 'adminid':senderobj.cid, 'type':'ban', 'reason':reason, 'time':ctime, 'expiration':-1, 'status':1})
			db.commit()
			A.kick(banr.uid)
			A.tell(sender, 'Banned %s!' % banr.name)
		else:
			A.tell(sender, 'No users matching %s' % msg[1])
Example #3
0
def cmdUnBan(obj, t):
	#!unban blah
	db = database.DB()
	db2 = database.DB()
	db.tableSelect('clients')
	sender = obj.data['sender']
	senderobj = A.findClient(sender)
	msg = obj.data["msg"].split(" ", 1)
	rid = None

	if len(msg) == 2:
		if msg[0].isdigit():
			rid = int(msg[0])
		else:
			print msg[1]
			entr = db.rowFindAll(msg[1].strip(), 'nick')
			print db.rowsGetAll()
			if entr == None:
				A.tell(sender, 'Couldnt find a ban for user with nickname %s' % msg[1])
			elif len(entr) > 1:
				A.tell(sender, 'Multiple users found... listing...')
				if len(entr) <= 15:
					for i in entr:
						objz = A.findClient(i)
						A.tell(sender, '[%s] %s' % (objz.cid, objz.name))
				else:
					A.tell(sender, 'Too many (<15) users to list...')
			elif len(entr) == 1:
				rid = entr[0]['id']
		
		if rid != None:
			objz = A.findClient(rid)
			db2.tableSelect('penalties')
			print db2.rowsGetAll()
			entr = db2.rowFindAll(rid, 'userid')
			if entr is None:
				return A.tell(sender, 'No bans found for %s' % msg[1])
			elif len(entr) == 1:
				entr[0]['status'] = 0
				db2.rowUpdate(entr[0])
			elif len(entr) > 1:
				for i in entr:
					if i['type'] in ('ban', 'tempban'):
						r = db2.rowFind(i['id'])
						r['status'] = 0
						db2.rowUpdate(r)
			db2.commit()
			A.tell(sender, 'Unbanned %s' % msg[1])
	else:
		return A.tell(sender, 'Usage: !unban <player>')
Example #4
0
def cmdKick(obj, t):
	msg = obj.data["msg"].split(" ")
	sender = obj.data["sender"]
	if len(msg) == 1: A.tell(sender, "Usage: !kick <user>")
	elif len(msg) == 2:
		if msg[1].isdigit():
			kick = int(msg[1]) #@DEV This needs a check to see if players name is 0 or something annoying like that
		else:
			cli = A.findClient(msg[1])
			if cli != None:
				kick = cli.uid
		A.rcon('clientkick %d' % kick)
Example #5
0
def cmdLoadout(obj, t):
	msg = obj.msg.split(' ', 1)
	m = []
	if len(msg) == 2:
		usr = A.findClient(msg[1])
		if usr != None:
			#A.B.Clients[usr.uid].updateData(A.B.dumpUser(usr.uid)) This should refresh automatically w/ ClientUserInfo[Change]
			A.tell(obj.sender, 'Loadout for %s:' % A.B.Clients[usr.uid].name)
			for i in A.B.Clients[usr.uid].gear:
				if const.gearInfo[i] != None:
					m.append(const.gearInfo[i]['name'])
			A.tell(obj.sender, '%s' % ', '.join(m))
		else:
			A.tell(obj.sender, 'Unknown user %s' % msg[1])
	else:
		A.tell(obj.sender, 'Usage: !loadout <player>')
Example #6
0
def cmdNuke(obj, t):
	msg = obj.data["msg"].split(" ")
	sender = obj.data["sender"]
	if len(msg) == 1: A.tell(sender, "Usage: !nuke <user> <count>")
	else:
		if msg[1].isdigit():
			nuke = int(msg[1])
		else:
			cli = A.findClient(msg[1])
			if cli != None:
				nuke = cli.uid
		count = 1
		if len(msg) == 3:
			if canInt(msg[2]): count = int(msg[2])
		for i in range(count):
			A.rcon('nuke %d' % nuke)
			time.sleep(.8)
Example #7
0
def cmdSlap(obj, t):
	msg = obj.data["msg"].split(" ")
	sender = obj.data["sender"]
	if len(msg) == 1: A.tell(sender, "Usage: !slap <user> <count>")
	else:
		if msg[1].isdigit():
			slap = int(msg[1])
		else:
			cli = A.findClient(msg[1])
			if cli != None:
				slap = cli.uid
			else: return None
		count = 1
		if len(msg) == 3:
			if canInt(msg[2]): count = int(msg[2])
		for i in range(count):
			A.rcon('slap %d' % slap)
			time.sleep(.8)
Example #8
0
def cmdLock(obj, t):
	#![un]lock user

	if len(obj.msgsplit) != 2: return A.tell(obj.sender, "Usage: %s <client>" % obj.cmd) #Sneaky bastard that I am

	playobj = A.findClient(obj.msgsplit[1])

	if 'fairplay_locked' not in playobj.__dict__.keys(): playobj.fairplay_locked = False

	if obj.cmd == '!lock':
		if playobj.fairplay_locked is True: return A.tell(obj.sender, "%s is already locked! Unlock with !unlock %s" % (playobj.name, playobj.uid))
		else: 
			playobj.fairplay_locked = True
			playobj.fairplay_lockedteam = playobj.team
		A.tell(obj.sender, 'Success! %s was locked to %s' % (playobj.name, playobj.team))

	elif obj.cmd == '!unlock':
		if playobj.fairplay_locked is True: 
			playobj.fairplay_locked = False
			playobj.fairplay_lockedteam = None #Will this cause an error? Cuz i'm thinking yeah it will...
		else: return A.tell(obj.sender, '%s is already unlocked!' % playobj.name)
		A.tell(obj.sender, 'Success! %s was unlocked!' % (playobj.name))
Example #9
0
def cmdForce(obj, t):
	msg = obj.data['msgsplit']
	sender = obj.data['sender'] #The sender id
	team = msg[2] #Team to switch player to

	playobj = A.findClient(msg[1]) #Player obj

	if A.canInt(team): team = const.teams[int(team)] #Is the team an integer representation of a team? if so use the team name
	if team not in const.teams.values() and team != 'spectator': #we are a bad team! 
		return A.tell(sender, 'Unknown team %s (spec/spectator/red/blue)' % team)
	if team == 'spec': team == 'spectator' #urt likes spectator

	if len(msg) == 3 and playobj.team != team: #!force player team
		A.rcon('forceteam %s %s' % (playobj.uid, team))
		A.tell(sender, '%s was forced to %s.' % (playobj.name, team))

	elif len(msg) == 4 and msg[3] == 'lock': #!force player team lock
		A.rcon('forceteam %s %s' % (playobj.uid, team))
		playobj.fairplay_locked = True
		playobj.fairplay_lockedteam = team
		A.tell(sender, '%s was forced and locked to %s. Type !unlock %s to unlock player.' % (playobj.name, team, playobj.name))
	else:
		A.tell(sender, "Usage: !force <client> <team> [lock]")