Y Hooks (Order of the callbacks)
#1

Basically I want to fix the order of the way the flow of control goes from the public callback to the hooked callback.

i.e.
public OnGameModeInit
printf("OGMI");

hook OnGameModeInit()
printf("hook OGMI");

OUTPUT:

hook OGMI
OGMI

---------------------------------

What I want is that the OUTPUT be like

OGMI
hook OGMI

---------------------------------

Any help would be appreciated.
Reply
#2

You can take a hook into the main public callback.
Not possible to take public callback to a hook(?)


For making the order, you can just put the line upper to load first.


Like..

PHP код:
function(){};
public 
OnGameModeInit()
{
function():

Reply
#3

Quote:
Originally Posted by SoFahim
Посмотреть сообщение
You can take a hook into the main public callback.
Not possible to take public callback to a hook(?)


For making the order, you can just put the line upper to load first.


Like..

PHP код:
function(){};
public 
OnGameModeInit()
{
function():

I'm not sure I understood you.
Reply
#4

Quote:
Originally Posted by [HLF]Southclaw
Посмотреть сообщение
And I'm not sure he understood you, the answer wasn't really relevant...

Anyway, you can control hook order by ordering the hooks themselves. The public will always come last (though ALS can complicate this).

Hook function names are compiled to something like `OnGameModeInit@001` where `001` is the hook number, this is incremented each time you include y_hooks - that's how each function gets a new name. Because of this, the hooks are called in that order.

There was a way to guarantee a first call but I'm not sure it works any more - it required adding the first public above the first y_hooks include.
Tried that. Putting the public callback above the first hook include. Didn't work.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)