AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Module Coding (https://forums.alliedmods.net/forumdisplay.php?f=9)
-   -   func vs func_POST (https://forums.alliedmods.net/showthread.php?t=309424)

redivcram 07-25-2018 14:34

func vs func_POST
 
What is the difference between these for example.

Quote:

void FN_ClientCommand(edict_t *pEntity);
and

Quote:

void FN_ClientCommand_Post(edict_t *pEntity);
If I'm not mistaken. By logic, the second one gets called and lets me handle the client's command? If not then which one of these is used to handle commands and to send commands?

fysiks 07-25-2018 14:46

Re: func vs func_POST
 
Generally, "post" means that your code will get executed after the event occurs. This means that you cannot modify the event itself because it already happened. If a hook is "pre" then your code gets executed before the event occurs which allows you to modify the event (depending on the event and type of hook it is).

redivcram 07-25-2018 15:52

Re: func vs func_POST
 
Oh, I see. Makes a lot of sense. Thanks.

meTaLiCroSS 07-25-2018 22:09

Re: func vs func_POST
 
Take a look at HLSDK code, you'll find all that references there. You might know you're hooking something as POST, but what happened inside? There's the answer.

joropito 07-26-2018 10:50

Re: func vs func_POST
 
Normally on the engine or game dll there're calls (ClientCommand for example).

Metamod hooks the call and replace with this:

Code:

ClientCommand_Hook() {
  call Metamod_Module_Client_Command()
  call Original_ClientCommand()
  call Metamod_Module_Client_Command_Post()
}

So not all _Post() calls can be useful, sometimes only works to know there was a call. The thing is you can't modify too much stuff after the original was called.


All times are GMT -4. The time now is 16:35.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.