Burgershot
  • Home
  • Members
  • Team
  • Help
  • Search
  • Register
  • Login
  • Home
  • Members
  • Help
  • Search
Burgershot SA-MP Pawn Scripting [Pawn] What exactly is hooking??

 
  • 0 Vote(s) - 0 Average
Pawn What exactly is hooking??
Metro
Offline

Burgershot Member
Posts: 37
Threads: 13
Joined: Apr 2019
Reputation: 1
#1
2019-04-23, 01:18 PM
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?
Y_Less
Offline

Administrator

Posts: 323
Threads: 16
Joined: Feb 2019
Reputation: 90
#2
2019-04-23, 02:07 PM
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.
Sasino97
Offline

Software Developer
Posts: 108
Threads: 16
Joined: Apr 2019
Reputation: 7
Location: Tampa, FL
#3
2019-04-25, 06:48 AM
(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.
Y_Less
Offline

Administrator

Posts: 323
Threads: 16
Joined: Feb 2019
Reputation: 90
#4
2019-04-27, 06:43 AM
They are sequential, yes.
« Next Oldest | Next Newest »



  • View a Printable Version
  • Subscribe to this thread
Forum Jump:

© Burgershot - Powered by our Community and MyBB Original Theme by Emerald

Linear Mode
Threaded Mode