AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [HELP] Ham Reload Post (https://forums.alliedmods.net/showthread.php?t=278572)

Depresie 02-03-2016 14:20

[HELP] Ham Reload Post
 
So im trying to hook that moment when the weapon is done reloading in order to set a custom clip to a weapon

i have tried this, but for some reason it is called when reload is triggered, not when it ends, any ideea why?

Code:

    RegisterHam(Ham_Weapon_Reload, "weapon_deagle", "Ham_Weapon_Reload_Post", 1)

Craxor 02-04-2016 01:52

Re: [HELP] Ham Reload Post
 
Quote:

Originally Posted by Depresie (Post 2389674)
So im trying to hook that moment when the weapon is done reloading in order to set a custom clip to a weapon

i have tried this, but for some reason it is called when reload is triggered, not when it ends, any ideea why?

Code:

    RegisterHam(Ham_Weapon_Reload, "weapon_deagle", "Ham_Weapon_Reload_Post", 1)

What do you try to create?

That's what i found: https://forums.alliedmods.net/showth...ht=hook+reload

klippy 02-04-2016 02:13

Re: [HELP] Ham Reload Post
 
Reload is called when a user presses +reload (R by default). Looks like you don't really understand what a "post" hook is.
If you register a hook as "pre", you are able to intercept (supercede) it, or change original function call's arguments and return value. It means that your hook is called before the original function.
"Post" means that your hook is called after the original function call. There are no special cases like "Pre-hook happens before reload happens, and post-hook happens when the reload ends".

Depresie 02-04-2016 06:29

Re: [HELP] Ham Reload Post
 
Thanks craxor, xPaw's tutorial made it clear for me, ham reload post is called after releasing the R button, not after the reload is done..

Kippy, you didnt understand what i meant above...

klippy 02-04-2016 07:22

Re: [HELP] Ham Reload Post
 
Quote:

Originally Posted by Depresie (Post 2389871)
Thanks craxor, xPaw's tutorial made it clear for me, ham reload post is called after releasing the R button, not after the reload is done..

Kippy, you didnt understand what i meant above...

I answered your question "any idea why?", and wrote exactly what you just wrote to Craxor. I surely understood what you meant.

Depresie 02-04-2016 10:22

Re: [HELP] Ham Reload Post
 
ohh, i guess i didnt read your post properly... xD
sorry, i just woke up when i wrote that.. =P


All times are GMT -4. The time now is 09:34.

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