예제 #1
0
파일: tracker.py 프로젝트: kdar/rconsoft
    def on_rcon_event(self, event, data, **kwargs):
        if event == "user_connected" or event == "user_joined_team" or event == "user_changed_name":
            rcon_client.players.setdefault(data["uniqueid"], {}).update(data)

            # Get some extra info about this user.
            rcon_client.user(data["uniqueid"])

        if event == "user_disconnected":
            del rcon_client.players[data["uniqueid"]]

        elif event == "server_cvar":
            pass

        elif event == "rcon_command":
            m = self.rcon_password_regex.match(data["command"])
            if m:
                print "Warning. Someone changed the password: %s" % m.groupdict()["password"]
예제 #2
0
파일: tracker.py 프로젝트: kdar/rconsoft
        def got_users(players):
            # ==============================
            # This gets called once the user command succeeds.
            def got_user(player):
                # Try to determine the person's team based on their model.
                # CAVEAT: If the person is in spectator, then their model will
                # be the last model they used. So you can't really tell if they're
                # spectating or on a team.
                # Teams and their corresponding models:
                #   CT      TERRORIST
                #  urban     terror
                #  gsg9      leet
                #  sas       arctic
                #  gign      guerilla
                m = player["model"]
                if m == "urban" or m == "gsg9" or m == "sas" or m == "gign":
                    player["team"] = "CT"
                else:
                    player["team"] = "TERRORIST"

            for uniqueid in players:
                player = players[uniqueid]
                rcon_client.user(player["uniqueid"]).addCallback(got_user)