Esempio n. 1
0
 def _Win(self, popupid, optionid, choice, winner_votes, winner_percent, total_votes, was_tied, was_canceled):
     self.display.Stop()
     es.cexec_all('playgamesound', str(vote_end_sound) )
     if not was_tied or was_canceled:
         if choice != "0" and winner_votes:
             if self.option and self.options[choice]['winner']:
                 if isinstance(self.option, str):
                     es.server.cmd(self.option)
                 elif callable(self.option):
                     self.params = {}
                     self.params['winner']      = choice
                     self.params['votes']       = winner_votes
                     self.params['percent']     = winner_percent
                     self.params['total votes'] = total_votes
                     self.option(self.params)
             tokens = {}
             tokens['winner']     = choice 
             tokens['votes']      = winner_votes 
             tokens['totalvotes'] = total_votes
             tokens['percent']    = winner_percent
             
             for player in playerlib.getPlayerList("#human"): 
                 es.tell(int(player),'#multi',xalanguage("vote win",tokens, player.get("lang")))
         else:
             for player in playerlib.getPlayerList("#human"): 
                 es.tell(int(player),'#green',xalanguage("vote no voters", {}, player.get("lang")))
          
     elif was_tied and not was_canceled:
         for player in playerlib.getPlayerList("#human"): 
             es.tell(int(player),'#green',xalanguage("vote tie", player.get("lang")))
         possibilities = []
         maxAmount = 0
         for possibility in self.display.SortDict():
             amount = self.display.votes[possibility]['votes'] 
             if amount < maxAmount:
                 break
             maxAmount = amount
             possibilities.append(possibility)
         winner = random.choice(possibilities)
         tokens = {}
         tokens['winner'] = winner
         for player in playerlib.getPlayerList("#human"): 
             es.tell(int(player),'#multi',xalanguage("random win", tokens, player.get("lang")))
         if self.option and self.options[winner]['winner']:
             if isinstance(self.option, str):
                 es.server.cmd(self.option)
             elif callable(self.option):
                 self.params = {}
                 self.params['winner']      = winner
                 self.params['votes']       = winner_votes
                 self.params['percent']     = winner_percent
                 self.params['total votes'] = total_votes
                 self.option(self.params)
     else: 
         for player in playerlib.getPlayerList("#human"): 
             es.tell(int(player), '#green', xalanguage("vote canceled", player.get("lang") ) )
def TeamChat(userid, text, teamonly):
	text = str(str(text).strip('"'))
	if es.exists('saycommand',text.split(' ')[0]) or text.split(' ')[0].lower() in ["!vote","!kick","!ban","!tele","!teleport","!burn","!slay","!noclip","!beacon","!happy","!slap","!nominate","!rtv","rtv","/rtv","votekick","voteban","!votekick","!voteban","!me","/me"]:
		return (userid, text, teamonly)
	else:
		if es.getplayerteam(userid) == 1:
			return (userid, text, teamonly)
		if es.getplayerteam(userid) == 2:
			es.msg('#multi','[#greenInfected#default] %s: #default%s'%(es.getplayername(userid),text))
		if es.getplayerteam(userid) == 3:
			es.msg('#multi','[#greenSurvivor#default] %s: #default%s'%(es.getplayername(userid),text))
		es.cexec_all('play common/talk.wav')
		return (0, None, None)
Esempio n. 3
0
 def StartVote(self):
     self.vote.showmenu = False
     self.vote.start(float(vote_timer))
     self.display = HudHint(self.options, self.shortName)
     for player in vote_players:
         if not es.exists('userid', player):
             continue
         if not vote_players[player]['stopped']: 
             popuplib.send("vote_" + self.shortName , player) 
         elif vote_players[player]['reason']: 
             tokens = {} 
             tokens['reason'] = vote_players[player]['reason'] 
             es.tell(player, '#green', xalanguage("stopped vote", tokens, playerlib.getPlayer(player).get("lang"))) 
     es.cexec_all('playgamesound ' + str(vote_start_sound) )
     self.display.Start()
Esempio n. 4
0
 def StartVote(self):
     self.vote.showmenu = False
     self.vote.start(float(vote_timer))
     self.display = HudHint(self.options, self.shortName)
     for player in vote_players:
         if not es.exists('userid', player):
             continue
         if not vote_players[player]['stopped']:
             popuplib.send("vote_" + self.shortName, player)
         elif vote_players[player]['reason']:
             tokens = {}
             tokens['reason'] = vote_players[player]['reason']
             es.tell(
                 player, '#green',
                 xalanguage("stopped vote", tokens,
                            playerlib.getPlayer(player).get("lang")))
     es.cexec_all('playgamesound ' + str(vote_start_sound))
     self.display.Start()
Esempio n. 5
0
def cexec_all(argv):
  es.cexec_all(*argv)
Esempio n. 6
0
def knives():
    global restrictedList
    restrictedList = ["glock","usp","p228","deagle","elite","fiveseven","m3","xm1014","mac10","tmp","mp5navy","ump45","p90","galil","famas","ak47","m4a1","scout","sg550","aug","awp","g3sg1","sg552","m249"]
    userList = es.getUseridList()
    es.cexec_all("drop")
Esempio n. 7
0
    def _Win(self, popupid, optionid, choice, winner_votes, winner_percent,
             total_votes, was_tied, was_canceled):
        self.display.Stop()
        es.cexec_all('playgamesound', str(vote_end_sound))
        if not was_tied or was_canceled:
            if choice != "0" and winner_votes:
                if self.option and self.options[choice]['winner']:
                    if isinstance(self.option, str):
                        es.server.queuecmd(self.option)
                    elif callable(self.option):
                        self.params = {}
                        self.params['winner'] = choice
                        self.params['votes'] = winner_votes
                        self.params['percent'] = winner_percent
                        self.params['total votes'] = total_votes
                        self.option(self.params)
                tokens = {}
                tokens['winner'] = choice
                tokens['votes'] = winner_votes
                tokens['totalvotes'] = total_votes
                tokens['percent'] = winner_percent

                for player in playerlib.getPlayerList("#human"):
                    es.tell(int(player), '#multi',
                            xalanguage("vote win", tokens, player.get("lang")))
                xavote.logging.log(
                    "option %s has won vote %s with %s%% %s/%s votes" %
                    (choice, self.shortName, winner_percent, winner_votes,
                     total_votes))
            else:
                for player in playerlib.getPlayerList("#human"):
                    es.tell(
                        int(player), '#green',
                        xalanguage("vote no voters", {}, player.get("lang")))
                xavote.logging.log(
                    "no option has won vote %s due to no voters" %
                    self.shortName)

        elif was_tied and not was_canceled:
            for player in playerlib.getPlayerList("#human"):
                es.tell(int(player), '#green',
                        xalanguage("vote tie", player.get("lang")))
            possibilities = []
            maxAmount = 0
            for possibility in self.display.SortDict():
                amount = self.display.votes[possibility]['votes']
                if amount < maxAmount:
                    break
                maxAmount = amount
                possibilities.append(possibility)
            winner = random.choice(possibilities)
            tokens = {}
            tokens['winner'] = winner
            for player in playerlib.getPlayerList("#human"):
                es.tell(int(player), '#multi',
                        xalanguage("random win", tokens, player.get("lang")))
            if self.option and self.options[winner]['winner']:
                if isinstance(self.option, str):
                    es.server.queuecmd(self.option)
                elif callable(self.option):
                    self.params = {}
                    self.params['winner'] = winner
                    self.params['votes'] = winner_votes
                    self.params['percent'] = winner_percent
                    self.params['total votes'] = total_votes
                    self.option(self.params)
            xavote.logging.log(
                "voting for vote %s was a draw so option %s was randomly selected as the winner"
                % (self.shortName, winner))
        else:
            for player in playerlib.getPlayerList("#human"):
                es.tell(int(player), '#green',
                        xalanguage("vote canceled", player.get("lang")))
Esempio n. 8
0
def cexec_all(argv):
    es.cexec_all(*argv)