Exemplo n.º 1
0
def item_pickup(event_var):
    pickingup = event_var["item"]
    if str(pickingup) in restrictedList:
        weapon = "weapon_%s" % pickingup
        es.sexec(event_var["userid"], "drop")
        es.server.queuecmd("es_xremove %s" % weapon)
        es.tell(event_var["userid"], "#multi", "#green[UltiRestrict] #default%s is restricted!" % pickingup)
Exemplo n.º 2
0
def slay(userid, varAnnounce=1):
    if es.exists("userid",userid) == 0:
        echo("[UltiTool] %s is not a valid userid!" % userid)
    else:
        es.sexec(userid, "kill")
        if varAnnounce == 1:
            announce("slayed",userid)
Exemplo n.º 3
0
 def removeSecondary(self):
     """Safely removes the secondary weapon"""
     if self.secondary:
         weaponindex = spe.getWeaponIndex(self.userid, self.secondary)
         if weaponindex:
             spe.removeEntityByIndex(weaponindex)
         if self.primary:
             es.sexec(self.userid, "use %s" % self.primary)
         else:
             es.sexec(self.userid, "use weapon_knife")
Exemplo n.º 4
0
def player_spawn(ev):
    if int(ev["es_userteam"]) > 1:
        player = ultilib.EasyPlayer(ev["userid"])
        player.cash = 0
        player.health = 1
        player.giveFlash(1000)
        player.nightvision = 1
        player.removeSecondary()
        player.removePrimary()
        es.sexec(player.userid, "use weapon_flashbang")
        if int(ev["es_userteam"]) == 3:
            player.defuser = 1
Exemplo n.º 5
0
def commandlist_selection(userid,choice,name):
    userid = str(userid)
    cmdlist_msg = langlib.Strings(es.getAddonPath('superhero') + '/languages/cmdlist_msg.ini')
    global popup_language
    if choice != None:
        if str(choice) == 'disable':
            Users[userid]['cmdlist'] = 0
            es.tell(userid,'#multi',cmdlist_msg('cmdlist_disable',lang=str(popup_language)))
        elif str(choice) == 'enable':
            Users[userid]['cmdlist'] = 1
            es.tell(userid,'#multi',cmdlist_msg('cmdlist_enable',lang=str(popup_language)))
        else:
            popupname = '/'+str(choice)
            es.sexec(userid,'say',popupname)
Exemplo n.º 6
0
 def confirmation(userid, choice, popupid):
     """
     The admin has chosen to clear the database so we shall first kill
     all players then clear the database. To ensure that all the values reset
     we need to restart the round.
     
     @PARAM userid - the admin who chose to delete the database
     @PARAM choice - whether or not the admin has confirmed the removal process
     @PARAM popupid - the id of the popup which was used to confirm the process
     """
     if choice:
         for player in es.getUseridList():
             es.sexec(player, 'kill')
             tell(player, 'database deleting')
         sourcerpg.database.clear(True)
         es.server.queuecmd('mp_restartround 1')
Exemplo n.º 7
0
 def confirmation(userid, choice, popupid):
     """
     The admin has chosen to clear the database so we shall first kill
     all players then clear the database. To ensure that all the values reset
     we need to restart the round.
     
     @PARAM userid - the admin who chose to delete the database
     @PARAM choice - whether or not the admin has confirmed the removal process
     @PARAM popupid - the id of the popup which was used to confirm the process
     """
     if choice:
         for player in es.getUseridList():
             es.sexec(player, 'kill')
             tell(player, 'database deleting')
         sourcerpg.database.clear(True)
         es.server.queuecmd('mp_restartround 1')
Exemplo n.º 8
0
def commandlist_selection(userid, choice, name):
    userid = str(userid)
    cmdlist_msg = langlib.Strings(
        es.getAddonPath('superhero') + '/languages/cmdlist_msg.ini')
    global popup_language
    if choice != None:
        if str(choice) == 'disable':
            Users[userid]['cmdlist'] = 0
            es.tell(userid, '#multi',
                    cmdlist_msg('cmdlist_disable', lang=str(popup_language)))
        elif str(choice) == 'enable':
            Users[userid]['cmdlist'] = 1
            es.tell(userid, '#multi',
                    cmdlist_msg('cmdlist_enable', lang=str(popup_language)))
        else:
            popupname = '/' + str(choice)
            es.sexec(userid, 'say', popupname)
Exemplo n.º 9
0
def player_hurt(ev):
	userid = ev['userid']
	if superhero.hasHero(userid,'Magneto'):
		attacker = ev['attacker']
		weapon = ev['weapon']
		weapon = 'weapon_%s'%weapon
		dice = random.randint(1,1)
		if dice == 1:
			if not weapon in ['weapon_glock','weapon_usp','weapon_p228','weapon_fiveseven','weapon_deagle','weapon_elite','weapon_knife','weapon_flashbang','weapon_hegrenade','weapon_smokegrenade']:
				wep_remove(attacker)
				for wep in ['weapon_glock','weapon_usp','weapon_p228','weapon_fiveseven','weapon_deagle','weapon_elite']:
					es.sexec(attacker, 'use %s'%wep)
				if ev['health'] > 0:
					if ev['es_userweapon'] in ['weapon_glock','weapon_usp','weapon_p228','weapon_fiveseven','weapon_deagle','weapon_elite','weapon_knife','weapon_flashbang','weapon_hegrenade','weapon_smokegrenade']:
						es.give(userid, weapon)
						es.tell(userid, '#multi', '#green[SH]#lightgreen You have taken#green',ev['es_attackername'],'#lightgreenprimary weapon')
				es.tell(attacker, '#multi', '#green[SH]#lightgreen Magneto has taken your primary weapon')
Exemplo n.º 10
0
    def drop(self, weapon_name=None):
        """Force the player to drop their weapon. If a specific weapon is
        passed, cause them to switch to it first.

        Arguments:
        weapon_name (Keyword Default: None) - the full name of the weapon to
        drop.

        """
        weapon_name = weapons.transform_weapon_name(weapon_name)
        if weapon_name is not None:
            if weapon_name not in (self.primary.weapon_type.name,
                                   self.secondary.weapon_type.name,
                                   self.c4.weapon_type.name):
                raise PlayersError("weapon %s is not owned by player user ID,"
                                   " %s" % (weapon_name, self.user_ID))
            _set_weapon(self.user_ID, weapon_name)
        es.sexec(self.user_ID, "drop")
Exemplo n.º 11
0
    def drop(self, weapon_name=None):
        """Force the player to drop their weapon. If a specific weapon is
        passed, cause them to switch to it first.

        Arguments:
        weapon_name (Keyword Default: None) - the full name of the weapon to
        drop.

        """
        weapon_name = weapons.transform_weapon_name(weapon_name)
        if weapon_name is not None:
            if weapon_name not in (self.primary.weapon_type.name,
                                   self.secondary.weapon_type.name,
                                   self.c4.weapon_type.name):
                raise PlayersError("weapon %s is not owned by player user ID,"
                                   " %s" %(weapon_name, self.user_ID))
            _set_weapon(self.user_ID, weapon_name)
        es.sexec(self.user_ID, "drop")
Exemplo n.º 12
0
def player_hurt(event_var):
    """
    This event executes when a player is damaged. Check for opposite teams,
    if so, run the test to see if we should run the drop.

    @PARAM event_var - an automatically passed event instance
    """
    userid   = event_var['userid']
    attacker = event_var['attacker']
    player   = sourcerpg.players[attacker]
    if attacker and attacker.isdigit() and int(attacker) > 0 and userid != attacker:
        if event_var['es_userteam'] != event_var['es_attackerteam']:
            level = player[skillName]
            if level:
                """ The attacker is at least level 1 in the drop skill """
                if random.randint(1, 100) <= level * float(percentage):
                    """ We have the drop percentage, drop it """
                    es.sexec(userid, 'drop')
Exemplo n.º 13
0
def player_hurt(ev):
    userid = ev['userid']
    if superhero.hasHero(userid, 'Magneto'):
        attacker = ev['attacker']
        weapon = ev['weapon']
        weapon = 'weapon_%s' % weapon
        dice = random.randint(1, 1)
        if dice == 1:
            if not weapon in [
                    'weapon_glock', 'weapon_usp', 'weapon_p228',
                    'weapon_fiveseven', 'weapon_deagle', 'weapon_elite',
                    'weapon_knife', 'weapon_flashbang', 'weapon_hegrenade',
                    'weapon_smokegrenade'
            ]:
                wep_remove(attacker)
                for wep in [
                        'weapon_glock', 'weapon_usp', 'weapon_p228',
                        'weapon_fiveseven', 'weapon_deagle', 'weapon_elite'
                ]:
                    es.sexec(attacker, 'use %s' % wep)
                if ev['health'] > 0:
                    if ev['es_userweapon'] in [
                            'weapon_glock', 'weapon_usp', 'weapon_p228',
                            'weapon_fiveseven', 'weapon_deagle',
                            'weapon_elite', 'weapon_knife', 'weapon_flashbang',
                            'weapon_hegrenade', 'weapon_smokegrenade'
                    ]:
                        es.give(userid, weapon)
                        es.tell(userid, '#multi',
                                '#green[SH]#lightgreen You have taken#green',
                                ev['es_attackername'],
                                '#lightgreenprimary weapon')
                es.tell(
                    attacker, '#multi',
                    '#green[SH]#lightgreen Magneto has taken your primary weapon'
                )
Exemplo n.º 14
0
def player_death(event_var):
    if mattie_mugmod > 0:
        if event_var['weapon'] == "knife":
             # don't mug if they're on the same team.
             if event_var['es_attackerteam'] != event_var['es_userteam']:
                  victim = playerlib.getPlayer(event_var['userid'])
                  attacker = playerlib.getPlayer(event_var['attacker'])
                  # take money
                  killercash = attacker.get("cash")
                  victimcash = victim.get("cash")
                  muggedamount = (victimcash * mugmod_percentage) / 100
                  # complete the transaction
                  victim.set("cash", victimcash - muggedamount)
                  attacker.set("cash", muggedamount + killercash)

                  # build the tokens for string replacement
                  tokens = {}
                  tokens['attacker'] = attacker.get("name")
                  tokens['victim']   =   victim.get("name")
                  tokens['dollars']  = muggedamount
                  
                  # tell the victim
                  es.tell(victim, text("mugged notice", tokens, victim.get("lang")))
                  # tell the attacker
                  es.tell(attacker, text("mugger notice", tokens, attacker.get("lang")))
                  
                  # play sound
                  if mugmod_sounds > 0: 
                      es.emitsound("player", int(attacker), str(mugmod_soundfile), 1, 0.6)
                  
                  if mugmod_taunt > 0:
                    # say message
                    if muggedamount <= 200:
                       es.sexec(int(attacker), "say %s" % text("poor victim"))
                    else:
                       # rich victim
                       choices = [x for x in text.keys() if x[0:8] == 'mugging:']
                       chosen = random.choice(choices)
                       es.sexec(int(attacker), "say %s" % text(chosen))
             else:
                if mugmod_taunt > 0:
                  # team knifer!
                  es.sexec(int(attacker), "say %s" % text("team mugger"))
Exemplo n.º 15
0
def sexec(argv):
  es.sexec(*argv)
Exemplo n.º 16
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))])
Exemplo n.º 17
0
def c4check(userid, location):
    myPlayer = playerlib.getPlayer(int(userid))
    if myPlayer.hasC4():
        if myPlayer.x == location:
            es.sexec(userid, "use weapon_c4")
            es.sexec(userid, "drop")
Exemplo n.º 18
0
def _set_weapon(user_ID, value):
    es.sexec(user_ID, "use %s" % weapons.transform_weapon_name(value))
Exemplo n.º 19
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))])
Exemplo n.º 20
0
 def kill(self):
     """Force the player to commit suicide and die."""
     es.sexec(self.user_ID, "kill")
Exemplo n.º 21
0
def sexec(argv):
    es.sexec(*argv)
Exemplo n.º 22
0
 def suicide(self):
     """Make the player commit suicide"""
     es.sexec(self.userid, "kill")
Exemplo n.º 23
0
def _set_weapon(user_ID, value):
    es.sexec(user_ID, "use %s" % weapons.transform_weapon_name(value))
Exemplo n.º 24
0
def player_spawn(ev):
    if started:
        es.sexec(ev["userid"], "kill")
        es.centertell(ev["userid"], "You may join the game next round!")
Exemplo n.º 25
0
def player_spawn(event_var):
  user = int(event_var['userid'])
  auth = services.use("auth")
  if not auth.isUseridAuthorized(user, "can_spawn2"):
    es.sexec(user, "kill")
Exemplo n.º 26
0
 def kill(self):
     """Force the player to commit suicide and die."""
     es.sexec(self.user_ID, "kill")
Exemplo n.º 27
0
def player_spawn(event_var):
    user = int(event_var['userid'])
    auth = services.use("auth")
    if not auth.isUseridAuthorized(user, "can_spawn2"):
        es.sexec(user, "kill")