SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 10/06/2017, 02:21 PM   #1
Dayrion
High-roller
 
Dayrion's Avatar
 
Join Date: Jan 2016
Location: France
Posts: 1,918
Reputation: 258
Default [Y_Hooks] Callback's name replacement

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 Code:
// 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 Code:
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?
__________________
actor_plus - v5.0.2
I'm a goner, somebody catch my breath,
I'm a goner, somebody catch my breath
Dayrion is offline   Reply With Quote
Old 10/06/2017, 09:49 PM   #2
Nicow
Big Clucker
 
Nicow's Avatar
 
Join Date: Oct 2012
Location: France
Posts: 95
Reputation: 60
Default Re: [Y_Hooks] Callback's name replacement

This is really weird
__________________

Nicow is offline   Reply With Quote
Old 10/06/2017, 11:16 PM   #3
OneDay
Huge Clucker
 
Join Date: Sep 2015
Posts: 293
Reputation: 134
Default Re: [Y_Hooks] Callback's name replacement

Why you shorten them, they are not 32 character
OneDay is offline   Reply With Quote
Old 11/06/2017, 12:47 AM   #4
Dayrion
High-roller
 
Dayrion's Avatar
 
Join Date: Jan 2016
Location: France
Posts: 1,918
Reputation: 258
Default Re: [Y_Hooks] Callback's name replacement

Quote:
Originally Posted by OneDay View Post
Why you shorten them, they are not 32 character
You don't know, certainly, how y_hooks works.
Let's show an example :
Code:
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.
__________________
actor_plus - v5.0.2
I'm a goner, somebody catch my breath,
I'm a goner, somebody catch my breath
Dayrion is offline   Reply With Quote
Old 11/06/2017, 01:29 PM   #5
Nicow
Big Clucker
 
Nicow's Avatar
 
Join Date: Oct 2012
Location: France
Posts: 95
Reputation: 60
Default Re: [Y_Hooks] Callback's name replacement

It doesn't work with OnVehicleDmgStatusUpd (OnVehicleDamageStatusUpdate) neither
__________________

Nicow is offline   Reply With Quote
Old 12/06/2017, 12:00 AM   #6
Dayrion
High-roller
 
Dayrion's Avatar
 
Join Date: Jan 2016
Location: France
Posts: 1,918
Reputation: 258
Default Re: [Y_Hooks] Callback's name replacement

Quote:
Originally Posted by ****** View Post
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.
__________________
actor_plus - v5.0.2
I'm a goner, somebody catch my breath,
I'm a goner, somebody catch my breath
Dayrion is offline   Reply With Quote
Old 12/06/2017, 07:30 PM   #7
Nicow
Big Clucker
 
Nicow's Avatar
 
Join Date: Oct 2012
Location: France
Posts: 95
Reputation: 60
Default Re: [Y_Hooks] Callback's name replacement

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
__________________

Nicow is offline   Reply With Quote
Old 13/06/2017, 02:43 AM   #8
Dayrion
High-roller
 
Dayrion's Avatar
 
Join Date: Jan 2016
Location: France
Posts: 1,918
Reputation: 258
Default Re: [Y_Hooks] Callback's name replacement

Quote:
Originally Posted by ****** View Post
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 Code:
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.
__________________
actor_plus - v5.0.2
I'm a goner, somebody catch my breath,
I'm a goner, somebody catch my breath
Dayrion is offline   Reply With Quote
Old 13/06/2017, 06:21 AM   #9
Nicow
Big Clucker
 
Nicow's Avatar
 
Join Date: Oct 2012
Location: France
Posts: 95
Reputation: 60
Default Re: [Y_Hooks] Callback's name replacement

Thanks a lot !
__________________

Nicow is offline   Reply With Quote
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


Similar Threads
Thread Thread Starter Forum Replies Last Post
y_hooks hook stops the original callback from executing CaveDweller Scripting Help 2 16/12/2014 03:29 PM
Replacement help weedxd Scripting Help 0 17/05/2014 09:49 AM
Replacement for this? CrossWindGaming Scripting Help 3 26/09/2013 11:10 AM


All times are GMT. The time now is 02:41 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.