Example #1
0
    def callvote(cls, vote, display, time=30):
        if not cls.is_vote_active():
            # Tell vote_started's dispatcher that it's a vote called by the server.
            minqlx.EVENT_DISPATCHERS["vote_started"].caller(None)
            minqlx.callvote(vote, display, time)
            return True

        return False
Example #2
0
    def callvote(cls, vote, display, time=30):
        if not cls.is_vote_active():
            # Tell vote_started's dispatcher that it's a vote called by the server.
            minqlx.EVENT_DISPATCHERS["vote_started"].caller(None)
            minqlx.callvote(vote, display, time)
            return True

        return False
Example #3
0
    def callvote(cls, vote: str, display: str, time: int = 30) -> bool:
        if cls.is_vote_active():
            return False

        # Tell vote_started's dispatcher that it's a vote called by the server.
        minqlx.EVENT_DISPATCHERS["vote_started"].caller(None)
        minqlx.callvote(vote, display, time)
        return True
Example #4
0
    def handle_vote_called(self, caller, vote, args):
        if not self.get_cvar("g_allowSpecVote", bool) and caller.team == "spectator":
            caller.tell("You are not allowed to call a vote as spectator.")
            return minqlx.RET_NONE

        if minqlx.Plugin.is_vote_active():
            return minqlx.RET_NONE

        if vote.lower() == "thrufloors":
            if args.lower() == "off":
                minqlx.callvote("g_forceDmgThroughSurface 0", "Turn off damage through floors?")
                minqlx.client_command(caller.id, "vote yes")
                self.msg(f"{caller.name}^7 called a vote.")
                return minqlx.RET_STOP_ALL
            if args.lower() == "on":
                minqlx.callvote("g_forceDmgThroughSurface 1", "Turn on damage through floors?")
                minqlx.client_command(caller.id, "vote yes")
                self.msg(f"{caller.name}^7 called a vote.")
                return minqlx.RET_STOP_ALL
            caller.tell("^2/cv thrufloors [on/off]^7 is the usage for this callvote command.")
            return minqlx.RET_STOP_ALL

        if vote.lower() == "spec":
            target_player = self.find_target_player_or_list_alternatives(caller, args)
            if target_player is None:
                return minqlx.RET_STOP_ALL

            if target_player.team == "spectator":
                caller.tell(f"Player {target_player.name}^7 is already in the spectators.")
                return minqlx.RET_STOP_ALL

            minqlx.callvote(f"put {target_player.id} spec", f"spec {target_player.name}^7?")
            minqlx.client_command(caller.id, "vote yes")
            self.msg(f"{caller.name}^7 called a vote.")
            return minqlx.RET_STOP_ALL

        if vote.lower() == "mute":
            target_player = self.find_target_player_or_list_alternatives(caller, args)
            if target_player is None:
                return minqlx.RET_STOP_ALL

            minqlx.callvote(
                f"qlx !silence {target_player.id} 10 minutes You were call-voted silent for 10 minutes.;"
                f"mute {target_player.id}", f"Mute {target_player.name}^7 for 10 minutes?")
            minqlx.client_command(caller.id, "vote yes")
            self.msg(f"{caller.name}^7 called a vote.")
            return minqlx.RET_STOP_ALL

        if vote.lower() == "allready":
            if self.game.state == "warmup":
                minqlx.callvote("qlx !allready", "Ready all players?")
                minqlx.client_command(caller.id, "vote yes")
                return minqlx.RET_STOP_ALL
            caller.tell("The game is already in progress.")
            return minqlx.RET_STOP_ALL

        return minqlx.RET_NONE
Example #5
0
 def callvote(cls, vote, display, time=30):
     minqlx.callvote(vote, display, time)