Example #1
0
def score_menu_cmd(userid, args):
    # Make sure player exists
    if not es.exists('userid', userid) and userid != 0:
        return

    # Get list of levels
    scoreList = []
    for player in es.getUseridList():
        scoreList.append('[%s] %s' % (Player(player).level,
                                                    es.getplayername(player)))
    # Sort from highest to lowest
    scoreList.sort(lambda a, b: cmp(int(b[1:].split("]")[0]),
        int(a[1:].split("]")[0])))

    # Is the list empty ?
    if not scoreList:
        return

    # Get the list number the player is at
    listNumber = scoreList.index('[%s] %s' % (Player(userid).level,
                                                es.getplayername(userid))) + 1

    # Create a new OrderedMenu
    ggScoreMenu = OrderedMenu(userid, 'GunGame: Score Menu', scoreList,
                                                    highlightIndex=listNumber)

    # Send the OrderedMenu on the page the player is on
    ggScoreMenu.send_page(get_index_page(listNumber))
Example #2
0
def score_menu_cmd(userid, args):
    # Make sure player exists
    if not es.exists('userid', userid) and userid != 0:
        return

    # Get list of levels
    scoreList = []
    for player in es.getUseridList():
        scoreList.append('[%s] %s' %
                         (Player(player).level, es.getplayername(player)))
    # Sort from highest to lowest
    scoreList.sort(
        lambda a, b: cmp(int(b[1:].split("]")[0]), int(a[1:].split("]")[0])))

    # Is the list empty ?
    if not scoreList:
        return

    # Get the list number the player is at
    listNumber = scoreList.index(
        '[%s] %s' % (Player(userid).level, es.getplayername(userid))) + 1

    # Create a new OrderedMenu
    ggScoreMenu = OrderedMenu(userid,
                              'GunGame: Score Menu',
                              scoreList,
                              highlightIndex=listNumber)

    # Send the OrderedMenu on the page the player is on
    ggScoreMenu.send_page(get_index_page(listNumber))
Example #3
0
def weapons_menu_cmd(userid, args):
    # Make sure player exists
    if not es.exists('userid', userid) and userid != 0:
        return

    weaponOrder = []
    level = 1
    totalLevels = get_total_levels()

    while level <= totalLevels:
        weaponOrder.append(
            "[%s] %s" % (get_level_multikill(level), get_level_weapon(level)))
        level += 1

    # Get the level the player is on
    ggLevel = Player(userid).level

    # Create a new OrderedMenu
    ggWeaponsMenu = OrderedMenu(userid,
                                'GunGame: Weapons Menu',
                                weaponOrder,
                                highlightIndex=ggLevel)

    # Send the OrderedMenu on the page the player's weapon is on
    ggWeaponsMenu.send_page(get_index_page(ggLevel))
Example #4
0
def rank_menu_cmd(userid, args):
    # Make sure player exists
    if not es.exists('userid', userid) and userid != 0:
        return

    # Get the winners list with a limit of 0 (unlimited)
    currentWinners = get_winners_list(0)
    rankings = []
    rank = 0

    # Empty database ?
    if currentWinners == []:
        rankings = ['Nobody has won yet!']

    # 1 Winner ?
    elif isinstance(currentWinners, dict):
        # Check to see if the player requesting the menu is the player being
        # listed
        if currentWinners["uniqueid"] == es.getplayersteamid(userid):
            rank = 1

        # Add the player
        rankings.append('[%s] %s' %
                        (currentWinners['wins'], currentWinners['name']))

    # Update popup list
    else:
        count = 0

        for player in currentWinners:
            count += 1

            # Check to see if the player requesting the menu is the player
            # being listed
            if player["uniqueid"] == es.getplayersteamid(userid):
                rank = count

            # Add the player
            rankings.append('[%s] %s' % (player['wins'], player['name']))

    # Create a new OrderedMenu
    ggRankMenu = OrderedMenu(userid,
                             'GunGame: Rank Menu',
                             rankings,
                             highlightIndex=rank)

    # Send the OrderedMenu on the page the player is on
    ggRankMenu.send_page(get_index_page(rank))
Example #5
0
def rank_menu_cmd(userid, args):
    # Make sure player exists
    if not es.exists('userid', userid) and userid != 0:
        return

    # Get the winners list with a limit of 0 (unlimited)
    currentWinners = get_winners_list(0)
    rankings = []
    rank = 0

    # Empty database ?
    if currentWinners == []:
        rankings = ['Nobody has won yet!']

    # 1 Winner ?
    elif isinstance(currentWinners, dict):
        # Check to see if the player requesting the menu is the player being
        # listed
        if currentWinners["uniqueid"] == es.getplayersteamid(userid):
            rank = 1

        # Add the player
        rankings.append('[%s] %s' % (currentWinners['wins'],
                                                       currentWinners['name']))

    # Update popup list
    else:
        count = 0

        for player in currentWinners:
            count += 1

            # Check to see if the player requesting the menu is the player
            # being listed
            if player["uniqueid"] == es.getplayersteamid(userid):
                rank = count

            # Add the player
            rankings.append('[%s] %s' % (player['wins'], player['name']))

    # Create a new OrderedMenu
    ggRankMenu = OrderedMenu(userid, 'GunGame: Rank Menu', rankings,
                                                        highlightIndex=rank)

    # Send the OrderedMenu on the page the player is on
    ggRankMenu.send_page(get_index_page(rank))
Example #6
0
def weapons_menu_cmd(userid, args):
    # Make sure player exists
    if not es.exists('userid', userid) and userid != 0:
        return

    weaponOrder = []
    level = 1
    totalLevels = get_total_levels()

    while level <= totalLevels:
        weaponOrder.append("[%s] %s" % (get_level_multikill(level),
            get_level_weapon(level)))
        level += 1

    # Get the level the player is on
    ggLevel = Player(userid).level

    # Create a new OrderedMenu
    ggWeaponsMenu = OrderedMenu(userid, 'GunGame: Weapons Menu', weaponOrder,
                                                    highlightIndex=ggLevel)

    # Send the OrderedMenu on the page the player's weapon is on
    ggWeaponsMenu.send_page(get_index_page(ggLevel))