Hook not being called -
wallee - 18.01.2017
This is my code:
Код:
hook OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
{
new Text3D:id = Create3DTextLabel("test", 0xFFFFFFFF, fX, fY, fZ, 40.0, 0, 0);
printf("created %i", _:id);
return 1;
}
It's included in the main script and yet it's not being called at all...
When i make it a public it works.
Anybody know why this is?
Re: Hook not being called -
Luicy. - 18.01.2017
Hooks aren't made to be called from one and a same file I guess.. If it should work eitherway, then make sure you have include y_hooks. (Assuming you're using y_hooks.)
Re: Hook not being called -
wallee - 18.01.2017
They aren't in a same file... different file. A hook above this one works fine. :/
Re: Hook not being called -
renatog - 18.01.2017
Are you returning -1 or -2 in any of these hooks? Returning (-1) will break the chain and return 0, returning (-2) will break the chain and return 1;
Re: Hook not being called -
wallee - 18.01.2017
Just what you see in the original post. I also tried without any returns doesn't work either.
Re: Hook not being called -
wallee - 19.01.2017
Still can't make it work.
Re: Hook not being called -
Misiur - 19.01.2017
Ya, the only case it wouldn't fire is when some other hook returns either Y_HOOKS_BREAK_RETURN_0 (-1) or Y_HOOKS_BREAK_RETURN_1 (-2). Double check that none of your files has it (those in pawno/includes as well). If that doesn't yield any results, then
1. Tell us what version of YSI are you using
2. Compile your script with -l (lowercase "L"). Then you'll get an .lst file - in it search for last occurence of OnPlayerWeaponShot, it should look something like
Quote:
@yH_OnPlayerWeaponShot@001(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ);@yH_OnPlayerWeaponShot@001(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
|
Paste it here whatever it might look like
Re: Hook not being called -
wallee - 19.01.2017
1) The old one, i think it's 3.1?
2) This is the only occurence in the entire file:
Код:
#line 423
forward OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ);
Re: Hook not being called -
Luicy. - 19.01.2017
Quote:
Originally Posted by wallee
1) The old one, i think it's 3.1?
2) This is the only occurence in the entire file:
Код:
#line 423
forward OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ);
|
Yeah remove that forward, why would you forward something that already exists in a native in a_samp?
Re: Hook not being called -
Misiur - 19.01.2017
That IS the forward from a_samp.
OP: Bad news, YSI 3 is not updated for some time, and OnPlayerWeaponShot was added in 0.3z, only callbacks from
this list are available. I had a long break from PAWN and I forgot 90% of doing stuff with #emit, so I can't help.