Raised This Month: $12 Target: $400
 3% 

Changing the forwards' order?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
shavit
AlliedModders Donor
Join Date: Dec 2011
Location: Israel
Old 08-13-2017 , 19:27   Changing the forwards' order?
Reply With Quote #1

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?
__________________
retired
shavit is offline
WildCard65
Veteran Member
Join Date: Aug 2013
Location: Canada
Old 08-13-2017 , 20:20   Re: Changing the forwards' order?
Reply With Quote #2

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.
__________________

Last edited by WildCard65; 08-13-2017 at 20:21.
WildCard65 is offline
hmmmmm
Great Tester of Whatever
Join Date: Mar 2017
Location: ...
Old 08-13-2017 , 21:34   Re: Changing the forwards' order?
Reply With Quote #3

Could call a forward from B.smx after buttons modified like OnPlayerRunCmdPost or something, and read in A.smx from there.
hmmmmm is offline
shavit
AlliedModders Donor
Join Date: Dec 2011
Location: Israel
Old 08-13-2017 , 21:45   Re: Changing the forwards' order?
Reply With Quote #4

Quote:
Originally Posted by hmmmmm View Post
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.
__________________
retired
shavit is offline
hmmmmm
Great Tester of Whatever
Join Date: Mar 2017
Location: ...
Old 08-13-2017 , 22:31   Re: Changing the forwards' order?
Reply With Quote #5

Relevant: https://github.com/alliedmodders/sourcemod/pull/591
You could try GetClientButtons on PostThink
hmmmmm is offline
Chdata
Veteran Member
Join Date: Aug 2012
Location: Computer Chair, Illinois
Old 08-17-2017 , 13:21   Re: Changing the forwards' order?
Reply With Quote #6

merge A and B into one thing.
__________________
Chdata is offline
Kailo
Senior Member
Join Date: Sep 2014
Location: Moscow, Russia
Old 08-17-2017 , 19:37   Re: Changing the forwards' order?
Reply With Quote #7

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.

Last edited by Kailo; 08-17-2017 at 19:37.
Kailo is offline
shavit
AlliedModders Donor
Join Date: Dec 2011
Location: Israel
Old 08-17-2017 , 20:24   Re: Changing the forwards' order?
Reply With Quote #8

Quote:
Originally Posted by Chdata View Post
merge A and B into one thing.
No, that kills my purpose.
__________________
retired
shavit is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 08-17-2017 , 20:36   Re: Changing the forwards' order?
Reply With Quote #9

That makes me wonder how many other function hooks SourceMod has where there is just a pre forward and no post forward.
__________________
Not currently working on SourceMod plugin development.

Last edited by Powerlord; 08-17-2017 at 20:36.
Powerlord is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 21:02.


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