Elevated Gaming Network
http://elevatedgaming.net/forums/

CTBan
http://elevatedgaming.net/forums/viewtopic.php?f=57&t=30973
Page 2 of 2

Author:  Yiggles Moto [ Mon Jul 02, 2018 9:03 am ]
Post subject:  Re: CTBan

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 :P 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 think I've heard people saying they use auto-assign or something to join CT and get around our CT ban. Could be doing it normally, haven't been able to confirm it.

Author:  Central [ Mon Jul 02, 2018 11:06 am ]
Post subject:  Re: CTBan

Yiggles Moto wrote:
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 :P 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 think I've heard people saying they use auto-assign or something to join CT and get around our CT ban. Could be doing it normally, haven't been able to confirm it.

That’s been a think for absolutely centuries, seen it done before, it occasionally works I don’t think it does as it used to anymore but I’m not sure if a map change had fixed, hadn’t been on since I reported that ione stopped working however I haven’t seen that done for a while or heard of it being done for quite a long time. I was a member back when that happened though so over a year now. But I’ll say something if I hear of it again

Author:  Doldol [ Mon Jul 02, 2018 12:55 pm ]
Post subject:  Re: CTBan

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 :P 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:
Syntax - python: Download - Hide
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

Page 2 of 2 All times are UTC - 6 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/