def rtv(): """ Executed when a user types 'rtv' in chat """ global votes_in global vote_req_total userid = es.getcmduserid() steamid = es.getplayersteamid(userid) entry(steamid) if not players[steamid][0]: if (time.time() - map_start_time) < float(vote_req_time): tokens = {} tokens['time'] = int(float(vote_req_time) - int( time.time() - map_start_time ) ) es.tell(userid, '#multi', lang('map_time', tokens, playerlib.getPlayer(userid).get('lang') ) ) xartv.logging.log("has been denied the right to RTV as not enough time in the map has passed", userid ) else: if allowVoting: players[steamid][0] = True vote_req_total = int( round(vote_req_p / 100. * len(playerlib.getPlayerList("#human") ) ) ) if not votes_in: name = es.getplayername(userid) for user in es.getUseridList(): tokens = {} tokens['player'] = es.getplayername(user) es.tell(user, '#multi', lang('player_started', tokens, playerlib.getPlayer(user).get('lang') ) ) popuplib.unsend("nomination_menu", user) votes_in += 1 xartv.logging.log("has rocked the vote, %s votes in" % votes_in, userid ) if votes_in >= int(vote_req_min): if votes_in >= vote_req_total: xartv.logging.log("Rock the vote has passed, starting the vote") rtv_init() else: name = es.getplayername(userid) tokens = {} tokens['player'] = name tokens['votes'] = vote_req_total - votes_in xartv.logging.log("%s votes still needed to rock the vote" % (vote_req_total - votes_in) ) for user in es.getUseridList(): es.tell(user, '#multi', lang('req', tokens ,playerlib.getPlayer(user).get('lang') ) ) else: name = es.getplayername(userid) tokens = {} tokens['player'] = name tokens['votes'] = int(vote_req_min) - votes_in for user in es.getUseridList(): es.tell(user, '#multi', lang('req', tokens, playerlib.getPlayer(user).get('lang') ) ) else: es.tell(userid, '#multi', lang('started', lang=playerlib.getPlayer(userid).get('lang') ) ) else: xartv.logging.log("has attempted to RTV more than once", userid) es.tell(userid, '#multi', lang('1vote', lang=playerlib.getPlayer(userid).get('lang') ) )
def rtv(): """ Executed when a user types 'rtv' in chat """ global votes_in global vote_req_total userid = es.getcmduserid() steamid = es.getplayersteamid(userid) entry(steamid) if not players[steamid][0]: if (time.time() - map_start_time) < float(vote_req_time): tokens = {} tokens['time'] = int(float(vote_req_time) - int( time.time() - map_start_time ) ) es.tell(userid, '#multi', lang('map_time', tokens, playerlib.getPlayer(userid).get('lang') ) ) else: if allowVoting: players[steamid][0] = True vote_req_total = int( round(vote_req_p / 100. * len(playerlib.getPlayerList("#human") ) ) ) if not votes_in: name = es.getplayername(userid) for user in es.getUseridList(): tokens = {} tokens['player'] = es.getplayername(user) es.tell(user, '#multi', lang('player_started', tokens, playerlib.getPlayer(user).get('lang') ) ) popuplib.unsend("nomination_menu", user) votes_in += 1 if votes_in >= int(vote_req_min): if votes_in >= vote_req_total: rtv_init() else: name = es.getplayername(userid) tokens = {} tokens['player'] = name tokens['votes'] = vote_req_total - votes_in for user in es.getUseridList(): es.tell(user, '#multi', lang('req', tokens ,playerlib.getPlayer(user).get('lang') ) ) else: name = es.getplayername(userid) tokens = {} tokens['player'] = name tokens['votes'] = int(vote_req_min) - votes_in for user in es.getUseridList(): es.tell(user, '#multi', lang('req', tokens, playerlib.getPlayer(user).get('lang') ) ) else: es.tell(userid, '#multi', lang('started', lang=playerlib.getPlayer(userid).get('lang') ) ) else: es.tell(userid, '#multi', lang('1vote', lang=playerlib.getPlayer(userid).get('lang') ) )
def rtv(): """ Executed when a user types 'rtv' in chat """ global votes_in global vote_req_total userid = es.getcmduserid() steamid = es.getplayersteamid(userid) entry(steamid) if not players[steamid][0]: if (time.time() - map_start_time) < float(vote_req_time): tokens = {} tokens["time"] = int(float(vote_req_time) - int(time.time() - map_start_time)) es.tell(userid, "#multi", lang("map_time", tokens, playerlib.getPlayer(userid).get("lang"))) else: if allowVoting: players[steamid][0] = True vote_req_total = int(round(vote_req_p / 100.0 * len(playerlib.getPlayerList("#human")))) if not votes_in: name = es.getplayername(userid) for user in es.getUseridList(): tokens = {} tokens["player"] = es.getplayername(user) es.tell(user, "#multi", lang("player_started", tokens, playerlib.getPlayer(user).get("lang"))) popuplib.unsend("nomination_menu", user) votes_in += 1 if votes_in >= int(vote_req_min): if votes_in >= vote_req_total: rtv_init() else: name = es.getplayername(userid) tokens = {} tokens["player"] = name tokens["votes"] = vote_req_total - votes_in for user in es.getUseridList(): es.tell(user, "#multi", lang("req", tokens, playerlib.getPlayer(user).get("lang"))) else: name = es.getplayername(userid) tokens = {} tokens["player"] = name tokens["votes"] = int(vote_req_min) - votes_in for user in es.getUseridList(): es.tell(user, "#multi", lang("req", tokens, playerlib.getPlayer(user).get("lang"))) else: es.tell(userid, "#multi", lang("started", lang=playerlib.getPlayer(userid).get("lang"))) else: es.tell(userid, "#multi", lang("1vote", lang=playerlib.getPlayer(userid).get("lang")))