• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Pawn] What exactly is hooking??
#1
I've been learning the basics of pawn and SAMP scripting over the past couple weeks through Y_Less's guide, the pawn language manual and SAMP wiki and I've come across the concept of hooking functions.?



Now there's a few tutorials on how to hook, but as far as I've searched there's not many tutorials explaining what exactly hooking is for to beginners like me.?

From my understanding it seems to be?some sort of method to replace certain native functions, but I'm still not sure and I can't think of any possible use cases.



Is there any documentation that would help me understand the basics of hooking?
  Reply
#2
A hook is a function called at the same time as another one. So if you want to do your own code every time someone calls `SetPlayerHealth`, you write a hook. If you want to use `OnPlayerConnect` in two files, you write a hook (or two). They basically just extend functions to do more stuff.
  Reply
#3
(2019-04-23, 02:07 PM)Y_Less Wrote: A hook is a function called at the same time as another one. ?So if you want to do your own code every time someone calls `SetPlayerHealth`, you write a hook. ?If you want to use `OnPlayerConnect` in two files, you write a hook (or two). ?They basically just extend functions to do more stuff.



Is it correct to say that they are called at the same time? I think they are called one after the other.
  Reply
#4
They are sequential, yes.
  Reply


Forum Jump: