Central wrote:
Doldol wrote:
Central wrote:
A bit of an issue, may just need a server restart or a map change, but people who are CT Banned are able to join CT somehow.
They are slain and swapped though right?
Of course
once they go to CT with an existing CT ban and I catch em, I slay and swap, and comes to a server ban when they swap back after that. But just letting you know. It might just need a server restart I'm not sure, this has happened before, several times and was fixed until now.
I meant automatically.
Again, this plugin wasn't written by me, I was just asked to fix bans not working, and so I did. It's in large parts wasted effort and not really worth my time fixing since it's not really great code. I'm just applying duct tape to a car falling apart.
I've seen people claim they wanted to help code or at least knew how to, I'll post the code if you guys would help, it'd be pretty welcome. If not I guess I'll go over it in a couple days (please don't make me :/).
The code:
https://pastebin.com/d4Dvr4qD teambalancer plugin calls bans.isbanned to check if the player is banned when trying to join ct
Relevant code:
try:
from ctbans import ctbans as ctban
except Exception:
from warnings import warn
warn("Could not import ctbans", ImportWarning)
def jointeam_callback(command, index):
try:
chosen_team = int(command[1])
except (IndexError, ValueError):
chosen_team = 0
#return CommandReturn.BLOCK
if chosen_team == 3:
try:
if ctban.bans.isbanned(player.steamid):
SayText2(message="\x05EgN Balancer| \x01You are CTBanned!").send(index)
return CommandReturn.BLOCK
except Exception:
pass
t_count = get_team_player_count(2)
ct_count = get_team_player_count(3)
max_ct = max(1, t_count//2)
if ct_count < max_ct:
assigned_team = 3
else:
SayText2(message=CANT_JOIN_TEAM_MSG.format(TEAM_NAMES[chosen_team])).send(index)
return CommandReturn.BLOCK
elif chosen_team == 0:
try:
is_ctbanned = ctban.bans.isbanned(player.steamid)
except Exception:
is_ctbanned = False
if is_ctbanned:
assigned_team = 2
else:
t_count = get_team_player_count(2)
ct_count = get_team_player_count(3)
max_ct = t_count//2
if ct_count < max_ct:
assigned_team = random.choice((2,3))
else:
assigned_team = 2
elif chosen_team in (1,2):
assigned_team = chosen_team
else:
return CommandReturn.BLOCK
# raise NotImplementedError("Team {0} is not implemented in the Teambalancer!".format(chosen_team))
swap_to_team(Player(index), assigned_team)
return CommandReturn.BLOCK
The admin plugin:
https://pastebin.com/ci4gUBmF