Exemple #1
0
def level_down_victim(attacker, victim):
    ggAttacker = Player(attacker)
    ggVictim = Player(victim)

    # Can the victim level down ?
    if ggVictim.level == 1:
        return False

    # Send message to attacker if victim cannot level down?
    if ggVictim.preventlevel.leveldown:

        # Always level mode (do not bother the attacker)?
        if not int(gg_knife_pro_always_level):
            msg(attacker, 'VictimPreventLevel', prefix=True)

            # The steal event didn't get fired
            return False

    # Player can level down
    else:
        # Play sound & send message
        ggVictim.playsound('leveldown')
        ggVictim.leveldown(1, attacker, 'steal')

    fire_gg_knife_steal(attacker, victim)

    # The steal event got fired
    return True
Exemple #2
0
def player_death(event_var):
    # Has the round ended?
    if not ActiveInfo.round:
        return

    # Set player ids
    userid = int(event_var['userid'])
    attacker = int(event_var['attacker'])

    # Is the attacker on the server?
    if not es.exists('userid', attacker):
        return

    # Suicide check
    if (attacker == 0 or attacker == userid):
        return

    # Get attacker object
    ggAttacker = Player(attacker)

    # ===============
    # TEAM-KILL CHECK
    # ===============
    if (event_var['es_userteam'] == event_var['es_attackerteam']):
        # Trigger level down
        ggAttacker.leveldown(int(gg_tk_punish), userid, 'tk')

        # Message
        ggAttacker.msg('TeamKill_LevelDown', {'newlevel': ggAttacker.level},
                       prefix='gg_tk_punish')

        # Play the leveldown sound
        ggAttacker.playsound('leveldown')
def hostage_killed(event_var):
    # Was fall damage?
    attacker = int(event_var['userid'])
    if not attacker:
        return

    # Get the attacker instance
    ggPlayer = Player(attacker)

    # Increment player hostage kills
    ggPlayer.hostage_killed += 1

    # Enough hostages killed to punish?
    if ggPlayer.hostage_killed >= int(gg_hostage_killed_kills):

        # Reset hostage killed counter
        ggPlayer.hostage_killed = 0

        # Punish the player
        ggPlayer.leveldown(int(gg_hostage_killed_punish), 0, 'hostage_killed')

        # Message
        ggPlayer.msg('Hostage_Killed_LevelDown', {'newlevel': ggPlayer.level},
                        prefix='gg_hostage_killed_punish')

        # Play the leveldown sound
        ggPlayer.playsound('leveldown')
Exemple #4
0
def level_down_victim(attacker, victim):
    ggAttacker = Player(attacker)
    ggVictim = Player(victim)

    # Can the victim level down ?
    if ggVictim.level == 1:
        return False

    # Send message to attacker if victim cannot level down?
    if ggVictim.preventlevel.leveldown:

        # Always level mode (do not bother the attacker)?
        if not int(gg_knife_pro_always_level):
            msg(attacker, 'VictimPreventLevel', prefix=True)

            # The steal event didn't get fired
            return False

    # Player can level down
    else:
        # Play sound & send message
        ggVictim.playsound('leveldown')
        ggVictim.leveldown(1, attacker, 'steal')

    fire_gg_knife_steal(attacker, victim)

    # The steal event got fired
    return True
Exemple #5
0
def player_death(event_var):
    # Has the round ended?
    if not ActiveInfo.round:
        return

    # Set player ids
    userid = int(event_var['userid'])
    attacker = int(event_var['attacker'])

    # Is the attacker on the server?
    if not es.exists('userid', attacker):
        return

    # Suicide check
    if (attacker == 0 or attacker == userid):
        return

    # Get attacker object
    ggAttacker = Player(attacker)

    # ===============
    # TEAM-KILL CHECK
    # ===============
    if (event_var['es_userteam'] == event_var['es_attackerteam']):
        # Trigger level down
        ggAttacker.leveldown(int(gg_tk_punish), userid, 'tk')

        # Message
        ggAttacker.msg('TeamKill_LevelDown', {'newlevel': ggAttacker.level},
                        prefix='gg_tk_punish')

        # Play the leveldown sound
        ggAttacker.playsound('leveldown')
Exemple #6
0
def hostage_killed(event_var):
    # Was fall damage?
    attacker = int(event_var['userid'])
    if not attacker:
        return

    # Get the attacker instance
    ggPlayer = Player(attacker)

    # Increment player hostage kills
    ggPlayer.hostage_killed += 1

    # Enough hostages killed to punish?
    if ggPlayer.hostage_killed >= int(gg_hostage_killed_kills):

        # Reset hostage killed counter
        ggPlayer.hostage_killed = 0

        # Punish the player
        ggPlayer.leveldown(int(gg_hostage_killed_punish), 0, 'hostage_killed')

        # Message
        ggPlayer.msg('Hostage_Killed_LevelDown', {'newlevel': ggPlayer.level},
                     prefix='gg_hostage_killed_punish')

        # Play the leveldown sound
        ggPlayer.playsound('leveldown')
def player_death(event_var):
    '''
    Note to devs:
        Strangely enough, player_death no longer fires anymore when a player
        is killed by the bomb exploding. Therefore, we no longer need to keep
        track of counting bomb deaths as suicide.
    '''
    # Has the round ended?
    if not ActiveInfo.round:
        return

    # Set player ids
    userid = int(event_var['userid'])
    attacker = int(event_var['attacker'])

    # Is the victim on the server?
    if not es.exists('userid', userid) and userid != 0:
        return

    # If the attacker is not "world or the userid of the victim, it is not a
    # suicide
    if not attacker in (0, userid):
        return

    # If the suicide was caused by a team change, stop here
    if userid in recentTeamChange:
        return

    # Get victim object
    ggVictim = Player(userid)

    # Trigger level down
    ggVictim.leveldown(int(gg_suicide_punish), userid, 'suicide')

    # Message
    ggVictim.msg('Suicide_LevelDown', {'newlevel': ggVictim.level},
                    prefix='gg_suicide_punish')

    # Play the leveldown sound
    ggVictim.playsound('leveldown')