Page 1 of 1

[CS:GO] Problem with SourceMod plugin

Posted: Thu Jan 19, 2017 12:32 pm
by gorgitko
Hello, I am having problem with one SourceMod plugin when running SourcePython simultaneously. It's the plugin TeamGames. It works correctly without SP.

Code: Select all

L 01/19/2017 - 13:25:59: SourceMod error session started
L 01/19/2017 - 13:25:59: Info (map "jb_mountaincraft_v6") (file "errors_20170119.log")
L 01/19/2017 - 13:25:59: [SM] Exception reported: Entity Outputs are disabled - See error logs for details
L 01/19/2017 - 13:25:59: [SM] Blaming: TeamGames.smx
L 01/19/2017 - 13:25:59: [SM] Call stack trace:
L 01/19/2017 - 13:25:59: [SM]   [0] HookSingleEntityOutput
L 01/19/2017 - 13:25:59: [SM]   [1] Line 244, LaserFences.sp::CreateBrushTrigger
L 01/19/2017 - 13:25:59: [SM]   [2] Line 124, LaserFences.sp::CreateFence
L 01/19/2017 - 13:25:59: [SM]   [3] Line 85, LaserFences.sp::FencesMenu_Rectangle_Handler


LaserFences.sp: https://github.com/KissLick/TeamGames/b ... rFences.sp

SourceMod Version: 1.8.0.5967 (latest stable)
SP version: 530
OS: Linux-3.16.0-4-amd64-x86_64-with-debian-8.6

EDIT: No SP plugins are currently running.

Re: [CS:GO] Problem with SourceMod plugin

Posted: Thu Jan 19, 2017 2:08 pm
by Kill
If You run the plugin without SP loaded, the error does not show up?

Re: [CS:GO] Problem with SourceMod plugin

Posted: Thu Jan 19, 2017 2:17 pm
by gorgitko
Kill wrote:If You run the plugin without SP loaded, the error does not show up?


Yes, exactly.

Re: [CS:GO] Problem with SourceMod plugin

Posted: Thu Jan 19, 2017 7:31 pm
by L'In20Cible
Load SP after SM. Delete the ../addons/source-python.vdf file and add plugin_load source-python to your autoexec.cfg.

Now that CS:GO use signatures on Linux, this seems to be related to issue #108.

Re: [CS:GO] Problem with SourceMod plugin

Posted: Thu Jan 19, 2017 8:07 pm
by gorgitko
So I did it, but I'm getting the error: Unable to load plugin "source-python"
The error also appears when I call "plugin_load source-python" through rcon.

EDIT: I see there is a new version 535, I will try it.
EDIT2: So it doesn't help, still same error.

Re: [CS:GO] Problem with SourceMod plugin

Posted: Thu Jan 19, 2017 8:23 pm
by L'In20Cible
Don't use RCON. Add the line to your autoexec.cfg. You cannot load a plugin while a map is running.

Code: Select all

plugin_load source-python
plugin_load : cannot load a plugin while running a map

Re: [CS:GO] Problem with SourceMod plugin

Posted: Thu Jan 19, 2017 8:38 pm
by L'In20Cible
Okay, I just tested myself and now it seems you have to add the addons/ prefix to the command:

Code: Select all

plugin_load addons/source-python
I'm sure this wasn't a requirement before.

Re: [CS:GO] Problem with SourceMod plugin

Posted: Thu Jan 19, 2017 8:44 pm
by gorgitko
OK, SP loads now.

But unfortunately the error log is now even longer :(

Code: Select all

L 01/19/2017 - 21:40:18: SourceMod error session started
L 01/19/2017 - 21:40:18: Info (map "jb_mountaincraft_v6") (file "errors_20170119.log")
L 01/19/2017 - 21:40:18: [SDKTOOLS] Invalid detour address passed - Disabling detour to prevent crashes
L 01/19/2017 - 21:40:31: Error log file session closed.
L 01/19/2017 - 21:41:58: SourceMod error session started
L 01/19/2017 - 21:41:58: Info (map "jb_mountaincraft_v6") (file "errors_20170119.log")
L 01/19/2017 - 21:41:58: [SM] Exception reported: Entity Outputs are disabled - See error logs for details
L 01/19/2017 - 21:41:58: [SM] Blaming: TeamGames.smx
L 01/19/2017 - 21:41:58: [SM] Call stack trace:
L 01/19/2017 - 21:41:58: [SM]   [0] HookSingleEntityOutput
L 01/19/2017 - 21:41:58: [SM]   [1] Line 244, LaserFences.sp::CreateBrushTrigger
L 01/19/2017 - 21:41:58: [SM]   [2] Line 124, LaserFences.sp::CreateFence
L 01/19/2017 - 21:41:58: [SM]   [3] Line 85, LaserFences.sp::FencesMenu_Rectangle_Handler
L 01/19/2017 - 21:42:10: [SM] Exception reported: Entity Outputs are disabled - See error logs for details
L 01/19/2017 - 21:42:10: [SM] Blaming: TeamGames.smx
L 01/19/2017 - 21:42:10: [SM] Call stack trace:
L 01/19/2017 - 21:42:10: [SM]   [0] UnhookSingleEntityOutput
L 01/19/2017 - 21:42:10: [SM]   [1] Line 302, LaserFences.sp::DestroyBrushTriggerAndBeamRope
L 01/19/2017 - 21:42:10: [SM]   [2] Line 161, LaserFences.sp::DestroyFence
L 01/19/2017 - 21:42:10: [SM]   [3] Line 106, LaserFences.sp::CreateFence
L 01/19/2017 - 21:42:10: [SM]   [4] Line 85, LaserFences.sp::FencesMenu_Rectangle_Handler

Re: [CS:GO] Problem with SourceMod plugin

Posted: Thu Jan 19, 2017 10:13 pm
by L'In20Cible
This is definitely a conflit between CBaseEntityOutput::FireOutput hooks. If you are sure that SP is loaded after SM, then that means the plugin LaserFences is loaded later on. To confirm it, you could try to disable that hook for SP. To do so, delete everything after line 41 into ../addons/source-python/packages/source-python/listeners/_entity_output.py. Or replace the file with the one attached to this post.

Re: [CS:GO] Problem with SourceMod plugin

Posted: Thu Jan 19, 2017 10:27 pm
by gorgitko
I did exactly what you said:

- deleted ../addons/source-python.vdf
- created autoexec.cfg in /cfg
- added "plugin_load addons/source-python" to autoexec.cfg

So SP must be loaded after SM.
LaserFences in included in TeamGames.smx. SM plugins cannot be loaded all at once?
I will try your solution as soon as possible. But what if I need that code in _entity_output.py in the future?

Many thanks for help!

Re: [CS:GO] Problem with SourceMod plugin

Posted: Thu Jan 19, 2017 10:46 pm
by L'In20Cible
gorgitko wrote:So SP must be loaded after SM.
LaserFences in included in TeamGames.smx. SM plugins cannot be loaded all at once?

What I meant by that, is that while SP might be loaded after SM, that LaserFence plugin might be loaded after SP so their signature no longer match since SP has inserted its JMP already.

gorgitko wrote:I will try your solution as soon as possible. But what if I need that code in _entity_output.py in the future?
This is only to confirm it at first. A solution could be that we implement a way that only register the hook when a listener is registered on our end. That way, loading SP plugins after server boot (via server.cfg, for example) would give SM enough time to register its own (assuming at least one SM plugin registering it prior said SP plugin is loaded stay loaded at all time). Ideally, all conflicts would be solved if they were also looking for hooked signatures as fallback when their original ones are not found.

Re: [CS:GO] Problem with SourceMod plugin

Posted: Sat Jan 21, 2017 5:57 pm
by gorgitko
So I have commented that code you suggest and TeamGames plugin works fine now :)

But that means I am unable to use SP entity hooks now?

Re: [CS:GO] Problem with SourceMod plugin

Posted: Sun Jan 22, 2017 2:03 am
by L'In20Cible
gorgitko wrote:So I have commented that code you suggest and TeamGames plugin works fine now :)

But that means I am unable to use SP entity hooks now?
You can use entity hooks, this only disable the OnEntityOutput listener (registered callbacks will no longer be noticed).

Re: [CS:GO] Problem with SourceMod plugin

Posted: Sun Jan 22, 2017 10:04 am
by gorgitko
So it's output described here? I have nearly zero experience with SDK, so I just have feeling that entity output is very important. But for now I am not using any entity-manipulating SP plugin so it's OK.

Re: [CS:GO] Problem with SourceMod plugin

Posted: Sun Jan 22, 2017 10:16 am
by L'In20Cible
Well, you could always add the code you removed from the _entity_output.py file into a plugin. For example:

Syntax: Select all

# ../addons/source-python/output_listener/output_listener.py

# ============================================================================
# >> IMPORTS
# ============================================================================
# Source.Python Imports
# Core
from core import PLATFORM
# Entities
from entities.helpers import find_output_name
# Listeners
from listeners._entity_output import _fire_output
from listeners._entity_output import BaseEntityOutput
from listeners._entity_output import on_entity_output_listener_manager
# Memory
import memory
from memory.hooks import PreHook


# ============================================================================
# >> CALLBACKS
# ============================================================================
if _fire_output is not None:
@PreHook(BaseEntityOutput.fire_output)
def _pre_fire_output(args):
"""Called when an output is about to be fired."""
if not on_entity_output_listener_manager:
return

# Windows is a bit weird: the function takes 4 additional arguments...
if PLATFORM == 'windows':
args = (args[0],) + tuple(args)[5:]

caller_ptr = args[3]
if not caller_ptr:
# If we don't know the caller, we won't be able to retrieve the
# output name
return

# Done here to fix cyclic import...
from entities.entity import BaseEntity
caller = memory.make_object(BaseEntity, caller_ptr)
output_name = find_output_name(caller, args[0])
if output_name is None:
return None

# Done here to fix cyclic import...
from entities.entity import Entity
if caller.is_networked():
caller = memory.make_object(Entity, caller_ptr)

value_ptr = args[1]
value = (value_ptr or None) and memory.make_object(Variant, value_ptr)

activator_ptr = args[2]
activator = ((activator_ptr or None) and memory.make_object(
BaseEntity, activator_ptr))
if activator is not None and activator.is_networked():
activator = memory.make_object(Entity, activator_ptr)

delay = args[4]
on_entity_output_listener_manager.notify(
output_name, activator, caller, value, delay)
Then add sp plugin load output_listener to your server.cfg file. That way the listeners should be called and SP hook should be registered after SM did.

Re: [CS:GO] Problem with SourceMod plugin

Posted: Sun Jan 22, 2017 10:19 am
by gorgitko
Well that's true, didn't occur to me. Thanks!