Example #1
0
def dissolve_ragdoll(userid, current_type):
    """Dissolve/remove the player's ragdoll."""
    # Get the ragdoll entity
    try:
        inthandle = Player.from_userid(userid).ragdoll
    except ValueError:
        return

    if inthandle == INVALID_ENTITY_INTHANDLE:
        return
    entity = Entity(index_from_inthandle(inthandle))

    # Should the ragdoll just be removed?
    if current_type == _num_dissolve_types + 2:
        entity.remove()
        return

    # Set the target name for the player's ragdoll
    entity.target_name = 'ragdoll_{userid}'.format(userid=userid)

    # Get the dissolver entity
    dissolver_entity = Entity.find_or_create('env_entity_dissolver')

    # Should a random dissolve type be chosen?
    if current_type == _num_dissolve_types + 1:
        current_type = randrange(_num_dissolve_types)

    # Set the magnitude
    dissolver_entity.magnitude = magnitude.get_int()

    # Set the dissolve type
    dissolver_entity.dissolve_type = current_type

    # Dissolve the ragdoll
    dissolver_entity.dissolve('ragdoll_{userid}'.format(userid=userid))
Example #2
0
def _dissolve_ragdoll(inthandle, current_type):
    """Dissolve/remove the player's ragdoll."""
    try:
        entity = Entity(index_from_inthandle(inthandle))
    except (OverflowError, ValueError):
        return

    # Should the ragdoll just be removed?
    if current_type == NUM_DISSOLVE_TYPES + 2:
        entity.remove()
        return

    # Set the target name for the player's ragdoll
    entity.target_name = f'ragdoll_{inthandle}'

    # Get the dissolver entity
    dissolver_entity = Entity.find_or_create('env_entity_dissolver')

    # Should a random dissolve type be chosen?
    if current_type == NUM_DISSOLVE_TYPES + 1:
        current_type = randrange(NUM_DISSOLVE_TYPES)

    # Set the magnitude
    dissolver_entity.magnitude = dissolver_magnitude.get_int()

    # Set the dissolve type
    dissolver_entity.dissolve_type = current_type

    # Dissolve the ragdoll
    dissolver_entity.dissolve(f'ragdoll_{inthandle}')
Example #3
0
	def player_give_weapon(self, userid):
		try:
			player = Player.from_userid(userid)
			if not player.address or player.steamid == 'BOT':
				return
			if player.team not in (2,3):
				return
			# get player team
			pteam = self.get_player_team(userid)
			pdata = self.get_player_data(userid)
			for index in player.weapon_indexes():
				weapon = Entity(index)
				player.drop_weapon(weapon.pointer, player.origin, player.origin)
				weapon.remove()
			# get new weapons
			player.give_named_item('weapon_knife', 0, None, True)
			if pteam in pdata['loadout1']:
				if str(pdata['class']) in pdata['loadout1'][pteam]:
					if 'primary' in pdata['loadout1'][pteam][str(pdata['class'])]:
						player.give_named_item(pdata['loadout1'][pteam][str(pdata['class'])]['primary'], 0, None, True)
					if 'secondary' in pdata['loadout1'][pteam][str(pdata['class'])]:
						player.give_named_item(pdata['loadout1'][pteam][str(pdata['class'])]['secondary'], 0, None, True)
					for item in self.weapons:
						if int(self.weapons[item]['rank']) <= int(pdata['rank'][str(pdata['class'])]) and int(self.weapons[item]['type']) == 3 and pteam == self.weapons[item]['team'] and int(pdata['class']) == self.weapons[item]['class']:
							for x in range(0, self.weapons[item]['amount']):
								Delay(0, player.give_named_item, self.weapons[item]['slug'], 0, None, True)
			# give kevlar (and helmet on lvl 20 or above)
			if int(pdata['rank'][str(pdata['class'])]) < 20:
				player.give_named_item('item_kevlar', 0, None, True)
			else:
				player.give_named_item('item_assaultsuit', 0, None, True)
			# ready for spawn let other plugins know
			self.callbacks.execute('player_is_spawned', player.userid)
		except:
			msg('INFO', 'could not give weapon to player')
Example #4
0
	def bomb_dropped(self, userid, bombentindex):
		# get c4
		tmp_bomb = Entity(bombentindex)
		# get origin of c4
		vector = tmp_bomb.origin
		# remove c4
		tmp_bomb.remove()
		# proof for a medkit
		self.create_medkit(userid, bombentindex, vector)
		# proof for an ammobox
		self.create_ammobox(userid, bombentindex, vector)
		# proof for an tugs
		self.create_tugs(userid, bombentindex, vector)
Example #5
0
 def strip(self):
     for index in self.player.weapon_indexes():
         weapon = Entity(index)
         self.player.drop_weapon(weapon.pointer, NULL_VECTOR, NULL_VECTOR)
         weapon.remove()
Example #6
0
	def bomb_beep(self, bombentindex):
		# get c4
		tmp_bomb = Entity(bombentindex)
		# remove c4
		tmp_bomb.remove()