Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dropped weapons are not removed #4

Closed
Ayuto opened this issue Dec 22, 2017 · 1 comment
Closed

Dropped weapons are not removed #4

Ayuto opened this issue Dec 22, 2017 · 1 comment
Labels

Comments

@Ayuto
Copy link

Ayuto commented Dec 22, 2017

Dropped weapons are not removed on Windows due to an exception in on_post_drop_weapon. There are two different exception, caused by the same reason.

[SP] Caught an Exception:
Traceback (most recent call last):
  File "..\addons\source-python\plugins\udm\udm.py", line 312, in on_post_drop_weapon
    player = make_object(PlayerEntity, stack_data[0])

ValueError: Pointer is NULL.
[SP] Caught an Exception:
Traceback (most recent call last):
  File "..\addons\source-python\plugins\udm\udm.py", line 312, in on_post_drop_weapon
    player = make_object(PlayerEntity, stack_data[0])
  File "..\addons\source-python\packages\source-python\entities\_base.py", line 218, in _obj
    return cls(index_from_pointer(ptr))

ValueError: Conversion from "Pointer" (<_memory.Pointer object at 0x1DD8C470>) to "Index" failed.

The reason and a workaround for this is described here:
https://forums.sourcepython.com/viewtopic.php?p=7542#p7542

Since you are delaying the removal code anyway, you might want to use a pre-hook.

@thetredev
Copy link
Owner

Thanks! I'll check it out.

thetredev pushed a commit that referenced this issue Dec 27, 2017
Fixed by replacing on_post_weapon_drop() with on_pre_weapon_drop()
 (EntityPostHook => EntityPreHook on 'drop_weapon')

Signed-off-by: BackRaw <backraw@gmx.de>
@thetredev thetredev added the bug label Dec 27, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants