def check_kick_timeout(cn, victim): t = time.time() try: if (t - spam_last_votekick[cn]) <= 2: ban(playercn, ban_duration, 'spamming server', -1) except KeyError: pass spam_last_votekick[cn] = t
def onTeamkill(cn, tcn): try: if player(cn).teamkills() >= limit: ban(cn, duration, 'killing teammates', -1) elif warn_tk_limit and player(cn).teamkills() == 1: player(cn).message(warning(warn_tk_message.substitute(colordict, limit=limit))) except KeyError: pass
def onTeamkill(cn, tcn): try: if player(cn).teamkills() >= limit: ban(cn, duration, 'killing teammates', -1) elif warn_tk_limit and player(cn).teamkills() == 1: player(cn).message( warning(warn_tk_message.substitute(colordict, limit=limit))) except KeyError: pass
def checkVotes(cn): players = allPlayers() needed = len(players) / 2 if needed <= 1: needed += 1 votes = 0 for player in players: try: if player.votekick == cn: votes += 1 except AttributeError: pass if votes >= needed: ban(cn, 3600, 'Vote', -1)
def dealwithspammer(self, ip): try: playercn = playerByIpString(ip).cn ban(playercn, ban_duration, 'spamming server', -1) except ValueError: print "Error while banning spamming player by IP"