weapons.restrictions module

Provides player weapon restriction functionality.

class weapons.restrictions.WeaponRestrictionHandler[source]

Bases: core.AutoUnload

Class used to handle player and team restrictions.

__init__()[source]

Initialize the instance and add it to the manager.

add_player_restrictions(player, *weapons)[source]

Add the weapons to the player’s restriction set.

Parameters:
  • player (Player) – The player to add the restrictions to.
  • weapons (str) – A weapon or any number of weapons to add as restricted for the player.
add_team_restrictions(team, *weapons)[source]

Add the weapons to the team’s restriction set.

Parameters:
  • team (int) – The team to add the restrictions to. Value can also be a team alias (ie t/ct).
  • weapons (str) – A weapon or any number of weapons to add as restricted for the team.
clear()[source]

Remove all team and player restrictions.

is_player_restricted(player, weapon)[source]

Return whether the player is restricted from the weapon.

Parameters:
  • player (Player) – The player to check against restriction.
  • weapon (str) – The name of the weapon to check against restriction.
Return type:

bool

is_team_restricted(team, weapon)[source]

Return whether the team is restricted from the weapon.

Parameters:
  • team (int) – The team to check for restriction. Value can also be a str alias for the team (ie t/ct).
  • weapon (str) – The name of the weapon to check for restriction.
Return type:

bool

on_player_bumping_weapon(player, weapon)[source]

Return whether the player can bump the weapon.

Parameters:
  • player (Player) – The player that is bumping the weapon.
  • weapon (str) – The name of the weapon the player is bumping.
Return type:

bool

static on_player_carrying_restricted_weapon(player, weapon)[source]

Force the player to drop the weapon.

Parameters:
  • player (Player) – The player that is carrying a restricted weapon.
  • weapon (Weapon) – The weapon that the player is carrying and is newly restricted.
on_player_purchasing_weapon(player, weapon)[source]

Return whether the player can purchase the weapon.

Parameters:
  • player (Player) – The player that is purchasing the weapon.
  • weapon (str) – The name of the weapon the player is purchasing.
Return type:

bool

on_player_restriction_added(player, weapon)[source]

Notify the handler if the player is carrying the weapon.

Parameters:
  • player (Player) – The player that just had a restriction added.
  • weapon (str) – The weapon that was just restricted.
on_team_restriction_added(team, weapon)[source]

Notify the handler of each player on the restricted team.

Parameters:
  • team (int) – The team that just had a restriction added.
  • weapon (str) – The weapon that was just restricted.
remove_player_restrictions(player, *weapons)[source]

Remove the weapons from the player’s restriction set.

Parameters:
  • player (Player) – The player to remove the restrictions from.
  • weapons (str) – A weapon or any number of weapons to remove as restricted for the player.
remove_team_restrictions(team, *weapons)[source]

Remove the weapons from the team’s restriction set.

Parameters:
  • team (int) – The team to remove the restrictions from. Value can also be a team alias (ie t/ct).
  • weapons (str) – A weapon or any number of weapons to remove as restricted for the team.
weapons.restrictions.weapon_restriction_handler

The base instance of the WeaponRestrictionHandler class that is used internally by the players.entity.Player class.

weapons.restrictions.weapon_restriction_manager

The singleton object of the _WeaponRestrictionManager class.