예제 #1
0
def player_changename(event_var):
    '''Called when a player changes their name while on the server'''

    # Update the player's name in the winners database if they are in it
    if Player(int(event_var['userid'])).wins:
        update_winner('name', event_var['newname'],
            uniqueid=event_var['es_steamid'])
예제 #2
0
def add_winner(name, uniqueid, wins, timestamp):
    # Store the number of wins that the player currently has, or None if they
    # do not exist
    currentWins = ggDB.select('gg_wins', 'wins',
                              'where uniqueid = "%s"' % uniqueid)

    # If the uniqueid is not in the database, add it
    if currentWins == None:
        insert_winner(name, uniqueid, wins, timestamp)
    # If the uniqueid is in the database
    else:
        # If gg_convert is set to add the converted and current wins
        if int(gg_convert) == 1:
            totalWins = int(currentWins) + wins
        # If gg_convert is set to replace the current wins
        else:
            totalWins = wins

        # Update the number of wins stored for the uniqueid
        update_winner('wins', totalWins, uniqueid=uniqueid)
예제 #3
0
def add_winner(name, uniqueid, wins, timestamp):
    # Store the number of wins that the player currently has, or None if they
    # do not exist
    currentWins = ggDB.select(
        'gg_wins', 'wins', 'where uniqueid = "%s"' % uniqueid)

    # If the uniqueid is not in the database, add it
    if currentWins == None:
        insert_winner(name, uniqueid, wins, timestamp)
    # If the uniqueid is in the database
    else:
        # If gg_convert is set to add the converted and current wins
        if int(gg_convert) == 1:
            totalWins = int(currentWins) + wins
        # If gg_convert is set to replace the current wins
        else:
            totalWins = wins

        # Update the number of wins stored for the uniqueid
        update_winner('wins', totalWins, uniqueid=uniqueid)