Ejemplo n.º 1
0
def player_death(event_var):
    attacker = int(event_var['attacker'])

    # Checking if player needs a new nade bonus
    if not check_bonus(attacker):
        return

    # We using a weapon list ?
    if not using_weapon_list():
        return

    weapon = get_weapon(attacker)

    # Was the kill with the bonus gun ?
    if event_var['weapon'] != weapon[0]:
        return

    ggPlayer = Player(attacker)

    # Stop Player at last level ?
    if int(gg_nade_bonus_mode) == 0:

        # Player on last level ?
        if get_total_levels(str(gg_nade_bonus)) == ggPlayer.nadeBonusLevel:
            return

    # Multikil check
    multiKill = get_level_multikill(ggPlayer.nadeBonusLevel,
                                            str(gg_nade_bonus))

    # Checking for multikill level
    if multiKill > 1:

        # Adding kill
        ggPlayer.nadeBonusMulti += 1

        # Level up ?
        if ggPlayer.nadeBonusMulti >= multiKill:

            # Reset multikill count
            ggPlayer.nadeBonusMulti = 0

            # Level up
            ggPlayer.nadeBonusLevel += 1

            # Give new weapon
            give_bonus(attacker, True, True)

        else:
            # Play sound
            ggPlayer.playsound('multikill')

    else:
        # Level up
        ggPlayer.nadeBonusLevel += 1

        # Give new weapon
        give_bonus(attacker, True, True)
Ejemplo n.º 2
0
def player_death(event_var):
    attacker = int(event_var['attacker'])

    # Checking if player needs a new nade bonus
    if not check_bonus(attacker):
        return

    # We using a weapon list ?
    if not using_weapon_list():
        return

    weapon = get_weapon(attacker)

    # Was the kill with the bonus gun ?
    if event_var['weapon'] != weapon[0]:
        return

    ggPlayer = Player(attacker)

    # Stop Player at last level ?
    if int(gg_nade_bonus_mode) == 0:

        # Player on last level ?
        if get_total_levels(str(gg_nade_bonus)) == ggPlayer.nadeBonusLevel:
            return

    # Multikil check
    multiKill = get_level_multikill(ggPlayer.nadeBonusLevel,
                                    str(gg_nade_bonus))

    # Checking for multikill level
    if multiKill > 1:

        # Adding kill
        ggPlayer.nadeBonusMulti += 1

        # Level up ?
        if ggPlayer.nadeBonusMulti >= multiKill:

            # Reset multikill count
            ggPlayer.nadeBonusMulti = 0

            # Level up
            ggPlayer.nadeBonusLevel += 1

            # Give new weapon
            give_bonus(attacker, True, True)

        else:
            # Play sound
            ggPlayer.playsound('multikill')

    else:
        # Level up
        ggPlayer.nadeBonusLevel += 1

        # Give new weapon
        give_bonus(attacker, True, True)
Ejemplo n.º 3
0
def give_bonus(userid, sound=False, turboCheck=False):
    ggPlayer = Player(userid)

    # Using weapon list?
    if using_weapon_list():

        # Player needs a real levelup?
        totalLevels = get_total_levels(str(gg_nade_bonus))
        if totalLevels < ggPlayer.nadeBonusLevel:

            # Reset bonus multi kills
            ggPlayer.nadeBonusMulti = 0

            # Player stuck on last gun ?
            if int(gg_nade_bonus_mode) == 0:
                ggPlayer.nadeBonusLevel = totalLevels
                return

            # Resetting player's bonus level
            ggPlayer.nadeBonusLevel = 1

            # Put the player back on level 1 ?
            if int(gg_nade_bonus_mode) == 1:

                # Recall the function to give level 1 weapon
                give_bonus(userid, sound, turboCheck)

                # Strip the previous weapons
                ggPlayer.strip_weapons([get_level_weapon(
                    get_total_levels(str(gg_nade_bonus)), str(gg_nade_bonus))])
                return

            # Level them up
            ggPlayer.levelup(1, userid, 'kill')

            # Play the levelup sound
            ggPlayer.playsound('levelup')

            # Strip the previous weapons
            ggPlayer.strip_weapons([get_level_weapon(get_total_levels(
                                    str(gg_nade_bonus)), str(gg_nade_bonus))])

            # Display message
            ggPlayer.msg('Levelup', {}, True)

            return

    # Play sound ?
    if sound:
        ggPlayer.playsound('nadebonuslevel')

    # gg_turbo is loaded ?
    if turboCheck and not int(es.ServerVar('gg_turbo')):
        return

    # Get weapon
    weapons = get_weapon(userid)

    # All you get is a knife?
    if len(weapons) == 1 and weapons[0] == 'knife':

        # Not carrying a nade?
        if getPlayer(userid).get('he') == 0:

            # Pull out knife
            es.sexec(userid, 'use weapon_knife')

        return

    # Give weapons
    count = 0
    for weapon in weapons:

        # If the weapon is flashbang, and it is not the first flashbang in the
        # list, give it without stripping the first one we gave, and continue
        if (weapon == "flashbang" and
          weapons.count("flashbang") > 1 and
          count != weapons.index("flashbang")):

            ggPlayer.give(weapon, False, False)
            continue

        count += 1

        ggPlayer.give(weapon, False, True)

    # if they are carrying an hegrenade, make them use it
    if getPlayer(userid).get('he') != 0:
        es.sexec(userid, 'use weapon_hegrenade')

    # If a weapon list is being used, strip the previous weapons
    if using_weapon_list():
        previousLevel = Player(userid).nadeBonusLevel - 1
        # If their level just started the loop again, their previous level is
        # the total number of levels
        if previousLevel < 1:
            previousLevel = get_total_levels(str(gg_nade_bonus))
            # If the total number of levels is 1, don't strip them
            if previousLevel == 1:
                return

        # Strip the previous weapons
        ggPlayer.strip_weapons([get_level_weapon(previousLevel,
                                                        str(gg_nade_bonus))])
Ejemplo n.º 4
0
def give_bonus(userid, sound=False, turboCheck=False):
    ggPlayer = Player(userid)

    # Using weapon list?
    if using_weapon_list():

        # Player needs a real levelup?
        totalLevels = get_total_levels(str(gg_nade_bonus))
        if totalLevels < ggPlayer.nadeBonusLevel:

            # Reset bonus multi kills
            ggPlayer.nadeBonusMulti = 0

            # Player stuck on last gun ?
            if int(gg_nade_bonus_mode) == 0:
                ggPlayer.nadeBonusLevel = totalLevels
                return

            # Resetting player's bonus level
            ggPlayer.nadeBonusLevel = 1

            # Put the player back on level 1 ?
            if int(gg_nade_bonus_mode) == 1:

                # Recall the function to give level 1 weapon
                give_bonus(userid, sound, turboCheck)

                # Strip the previous weapons
                ggPlayer.strip_weapons([
                    get_level_weapon(get_total_levels(str(gg_nade_bonus)),
                                     str(gg_nade_bonus))
                ])
                return

            # Level them up
            ggPlayer.levelup(1, userid, 'kill')

            # Play the levelup sound
            ggPlayer.playsound('levelup')

            # Strip the previous weapons
            ggPlayer.strip_weapons([
                get_level_weapon(get_total_levels(str(gg_nade_bonus)),
                                 str(gg_nade_bonus))
            ])

            # Display message
            ggPlayer.msg('Levelup', {}, True)

            return

    # Play sound ?
    if sound:
        ggPlayer.playsound('nadebonuslevel')

    # gg_turbo is loaded ?
    if turboCheck and not int(es.ServerVar('gg_turbo')):
        return

    # Get weapon
    weapons = get_weapon(userid)

    # All you get is a knife?
    if len(weapons) == 1 and weapons[0] == 'knife':

        # Not carrying a nade?
        if getPlayer(userid).get('he') == 0:

            # Pull out knife
            es.sexec(userid, 'use weapon_knife')

        return

    # Give weapons
    count = 0
    for weapon in weapons:

        # If the weapon is flashbang, and it is not the first flashbang in the
        # list, give it without stripping the first one we gave, and continue
        if (weapon == "flashbang" and weapons.count("flashbang") > 1
                and count != weapons.index("flashbang")):

            ggPlayer.give(weapon, False, False)
            continue

        count += 1

        ggPlayer.give(weapon, False, True)

    # if they are carrying an hegrenade, make them use it
    if getPlayer(userid).get('he') != 0:
        es.sexec(userid, 'use weapon_hegrenade')

    # If a weapon list is being used, strip the previous weapons
    if using_weapon_list():
        previousLevel = Player(userid).nadeBonusLevel - 1
        # If their level just started the loop again, their previous level is
        # the total number of levels
        if previousLevel < 1:
            previousLevel = get_total_levels(str(gg_nade_bonus))
            # If the total number of levels is 1, don't strip them
            if previousLevel == 1:
                return

        # Strip the previous weapons
        ggPlayer.strip_weapons(
            [get_level_weapon(previousLevel, str(gg_nade_bonus))])