Hook not being called
#1

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?
Reply
#2

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.)
Reply
#3

They aren't in a same file... different file. A hook above this one works fine. :/
Reply
#4

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;
Reply
#5

Just what you see in the original post. I also tried without any returns doesn't work either.
Reply
#6

Still can't make it work.
Reply
#7

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
Reply
#8

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);
Reply
#9

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?
Reply
#10

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


Forum Jump:


Users browsing this thread: 1 Guest(s)