AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   Changing the forwards' order? (https://forums.alliedmods.net/showthread.php?t=300349)

shavit 08-13-2017 19:27

Changing the forwards' order?
 
I have 2 plugins:
A.smx
B.smx

A.smx is a plugin that reads buttons from OnPlayerRunCmd.
B.smx is a plugin that modifies the buttons in OnPlayerRunCmd.

A.smx sees the pre-modify value (which is 0 for me).
To make A.smx see the value B.smx modifies, I need to reload A.smx.

Is there anything I can do to accomplish the bold scenario without reloading the plugins or without changing A.smx's name to be alphabetically after B.smx?

WildCard65 08-13-2017 20:20

Re: Changing the forwards' order?
 
It all depends on the order plugins were loaded in as the internal forward system for global forwards adds functions to forwards after the plugin is either compiled (before OnPluginStart) or after fully loaded (after OnPluginStart), not only that, there is no concrete order plugins are loaded in, it's undefined what the order will be.

hmmmmm 08-13-2017 21:34

Re: Changing the forwards' order?
 
Could call a forward from B.smx after buttons modified like OnPlayerRunCmdPost or something, and read in A.smx from there.

shavit 08-13-2017 21:45

Re: Changing the forwards' order?
 
Quote:

Originally Posted by hmmmmm (Post 2541422)
Could call a forward from B.smx after buttons modified like OnPlayerRunCmdPost or something, and read in A.smx from there.

Eh.. that seems overkill :/ guess I'll make a native to update the buttons instead then.

hmmmmm 08-13-2017 22:31

Re: Changing the forwards' order?
 
Relevant: https://github.com/alliedmodders/sourcemod/pull/591
You could try GetClientButtons on PostThink

Chdata 08-17-2017 13:21

Re: Changing the forwards' order?
 
merge A and B into one thing.

Kailo 08-17-2017 19:37

Re: Changing the forwards' order?
 
What if set dependence for plugin A from B. Will it do loading A only after B?
Also you can check in plugin A plugin loading order with plugin iterator and force A to reload if it loaded before B.

shavit 08-17-2017 20:24

Re: Changing the forwards' order?
 
Quote:

Originally Posted by Chdata (Post 2542161)
merge A and B into one thing.

No, that kills my purpose.

Powerlord 08-17-2017 20:36

Re: Changing the forwards' order?
 
That makes me wonder how many other function hooks SourceMod has where there is just a pre forward and no post forward.


All times are GMT -4. The time now is 00:54.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.