Skip to content

CS:S - Player.drop_weapon crash #373

Closed
@Frag1337

Description

@Frag1337

Hello,

when using following snippet while being on a team/alive on the server:

from filters.players import PlayerIter

for player in PlayerIter():
    print('Trying to remove weapons from {}..'.format(player.name))

    for weapon in player.weapons():
        print('Found {} from {}. Lets drop it.'.format(weapon.classname, player.name))

        player.drop_weapon(weapon)

        print('Aaand remove it..')

        weapon.remove()

I get following crash:

sp plugin load test
[SP] Loading plugin 'test'...
Trying to remove weapons from Frag..
Found weapon_knife from Frag. Lets drop it.
Segmentation fault (core dumped)
Add "-debug" to the ./srcds_run command line to generate a debug.log to help with solving this problem
Mon Dec 14 19:40:46 UTC 2020: Server restart in 10 seconds
sp info

IMPORTANT: Please copy the full output.
--------------------------------------------------------
Checksum      : 17af3a55546e8fed9c8e9b322e817b97
Date          : 2020-12-14 19:43:07.359723
OS            : Linux-5.4.0-58-generic-x86_64-with-debian-bullseye-sid
Game          : css
SP version    : 702
Github commit : 99ed4dca7b439f5fc4ade054355767b23af497df
Server plugins:
   00: Source.Python, (C) 2012-2020, Source.Python Team.
SP plugins:
--------------------------------------------------------

The server also crashes on

weapon.remove()

by uncommenting player.drop_weapon(weapon)

sp plugin load test
[SP] Loading plugin 'test'...
Trying to remove weapons from Frag..
Found weapon_knife from Frag. Lets drop it.
Aaand remove it..
Segmentation fault (core dumped)
Add "-debug" to the ./srcds_run command line to generate a debug.log to help with solving this problem
Mon Dec 14 19:45:04 UTC 2020: Server restart in 10 seconds

Not sure if its helpful, but I've used this fix to make Source.Python work:

https://forums.sourcepython.com/viewtopic.php?p=13976#p13976 Method 2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions