[Cs:s] How to block weapon pick up
-
- Senior Member
- Posts: 315
- Joined: Sun May 17, 2020 7:56 am
- Location: Finland
- Contact:
[Cs:s] How to block weapon pick up
Hi, how i can block weapon pick up, that only ct's can use weapon, but terorist only use knife?
Re: [Cs:s] How to block weapon pick up
Hey, I think SourcePython has exactly the functionality you are looking for.
http://wiki.sourcepython.com/developing ... strictions
http://wiki.sourcepython.com/developing ... strictions
-
- Senior Member
- Posts: 315
- Joined: Sun May 17, 2020 7:56 am
- Location: Finland
- Contact:
Re: [Cs:s] How to block weapon pick up
Hi Kami, i tried use that, but i don't get/understand how i can use it to block weapon pickup
Re: [Cs:s] How to block weapon pick up
There's an excellent post by satoon101 describing how weapon restriction works. This is what you're looking for:
You could also do something like this:
Syntax: Select all
# ../weapon_restrict_example/weapon_restrict_example.py
# Source.Python
from filters.weapons import WeaponClassIter
from weapons.restrictions import WeaponRestrictionHandler
my_handler = WeaponRestrictionHandler()
# Restrict Terrorists from using any weapon besides their knife.
my_handler.add_team_restrictions(
2, *[weapon.basename for weapon in WeaponClassIter(not_filters='knife')])
You could also do something like this:
Syntax: Select all
# ../weapon_restrict_example2/weapon_restrict_example2.py
# Source.Python
from events import Event
from players.entity import Player
from filters.weapons import WeaponClassIter
# List containing every weapon name except the knife.
weapons = [weapon.basename for weapon in WeaponClassIter(not_filters='knife')]
@Event('player_spawn')
def player_spawn(event):
"""Called when a player spawns."""
player = Player.from_userid(event['userid'])
# Is this a terrorist?
if player.team == 2:
# You need to pass the list of restricted weapons as a string.
# (e.g. ['awp', 'ak47', 'm4a1'] -> 'awp ak47 m4a1')
player.restrict_weapons(*weapons)
-
- Senior Member
- Posts: 315
- Joined: Sun May 17, 2020 7:56 am
- Location: Finland
- Contact:
Re: [Cs:s] How to block weapon pick up
Thank You VinciT, now i got it work, it works perfectly
Return to “Plugin Development Support”
Who is online
Users browsing this forum: No registered users and 87 guests