[Y_Hooks] Callback's name replacement
#1

Hello.
I've some problems with y_hooks. As you know, you can replace any name part of a callback by a diminutive to prevent the error of 32 characters.
This code is in the YSI's include:
PHP код:
// Create the default replacements.
DEFINE_HOOK_REPLACEMENT(CheckpointCP );
DEFINE_HOOK_REPLACEMENT(Container Cnt);
DEFINE_HOOK_REPLACEMENT(Inventory Inv);
DEFINE_HOOK_REPLACEMENT(Dynamic   Dyn);
DEFINE_HOOK_REPLACEMENT(TextDraw  TD );
DEFINE_HOOK_REPLACEMENT(Update    Upd);
DEFINE_HOOK_REPLACEMENT(Object    Obj);
DEFINE_HOOK_REPLACEMENT(Command   Cmd);
DEFINE_HOOK_REPLACEMENT(DynamicCP DynamicCP);
DEFINE_HOOK_REPLACEMENT(SpawnSpw); 
The problem is, no one of my hook is called when I use replacement.
PHP код:
hook OnPlayerSpw(playerid)
{
    
printf("[DEBUGG] OnPlayerSpw CALLED");
    return 
Y_HOOKS_CONTINUE_RETURN_1;
}
hook OnPlayerCmdPerformed(playeridcmdtext[], success)
{
    
printf("OnPlayerCmdPerformed: '%s'"cmdtext);
    return 
Y_HOOKS_CONTINUE_RETURN_1;

Of course, I did not modify the include (except adding 'DEFINE_HOOK_REPLACEMENT(Spawn, Spw)').
Have you some suggestions? Ideas or something?
Reply
#2

This is really weird
Reply
#3

Why you shorten them, they are not 32 character
Reply
#4

Quote:
Originally Posted by OneDay
Посмотреть сообщение
Why you shorten them, they are not 32 character
You don't know, certainly, how y_hooks works.
Let's show an example :
Код:
warning 200: symbol "@yH_OnPlayerEnterRaceCheckpoint" is truncated to 31 characters
So, to avoid this warning and prevent y_hooks to works perfectly; ****** made shortcut but they dont work for me.
Reply
#5

It doesn't work with OnVehicleDmgStatusUpd (OnVehicleDamageStatusUpdate) neither
Reply
#6

Quote:
Originally Posted by ******
Посмотреть сообщение
I did some playing and may have found a bug in the scanner. For now, just don't shorten names that don't need it.
As Nicow said, we need it for OnVehicleDamageStatusUpdate. Any temporary fix or manipulation to do?
Thank you for your answer.
Reply
#7

Thank you for your answer, I saw your commit about fixes.inc support for y_hooks

So i tried to hook OnVehicleDamageStatusUpdate without fixes and without updating YSI/AMX and still the same issue
Then I tried to update YSI and amx, with and without fixes but same problem
Reply
#8

Quote:
Originally Posted by ******
Посмотреть сообщение
Try the version of YSI I just uploaded. I've tracked and patched some bugs. I won't say "FIXED", I can imagine some corner-cases where the fix might fail, but I'm not even sure how to construct a test for those cases.
Just tried and it worked!
PHP код:
hook OnVehicleDmgStatusUpd(vehicleidplayerid)
{
    print(
"[DEBUG] OnVehicleDamageStatusUpdate called from hook.");
    return 
Y_HOOKS_CONTINUE_RETURN_1;
}
----
DEFINE_HOOK_REPLACEMENT(DamageDmg); 
If we get another problem about Y_Hooks, we will post there or on your GIT.
Thank you for your precious help.
Reply
#9

Thanks a lot !
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)