AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Can someone explain this hook to me? (https://forums.alliedmods.net/showthread.php?t=190090)

Santaaa 07-14-2012 16:43

Can someone explain this hook to me?
 
Hey there,

I would like to know more about this event. Example how to catch the victim, how to set hitboxes. etc
PHP Code:

RegisterHam(Ham_TraceAttack"player""FwdTraceAttack"


<VeCo> 07-14-2012 16:53

Re: Can someone explain this hook to me?
 
PHP Code:

public FwdTraceAttack(idvictimidattackerFloat:damageFloat:direction[3], traceresultdamagebits

First param is the victim id.


To set the hitbox use:

PHP Code:

set_tr2(traceresult,TR_iHitGroup,HIT_*) 

Where HIT_* is the hitplace (see amxconst.inc):

PHP Code:

/* Parts of body for hits */
#define HIT_GENERIC  0 /* none */
#define HIT_HEAD  1
#define HIT_CHEST  2
#define HIT_STOMACH  3
#define HIT_LEFTARM  4
#define HIT_RIGHTARM  5
#define HIT_LEFTLEG  6
#define HIT_RIGHTLEG  7 


Santaaa 07-14-2012 17:28

Re: Can someone explain this hook to me?
 
So for example

PHP Code:

if (!get_tr2(traceTR_iHitGroup) == HIT_HEAD

Would block everything what is not hitting the head?

<VeCo> 07-15-2012 06:34

Re: Can someone explain this hook to me?
 
!=

So, yes, if you supercede the function you will block shooting the head.

ConnorMcLeod 07-15-2012 06:46

Re: Can someone explain this hook to me?
 
PHP Code:

#define HIT_SHIELD  8 



All times are GMT -4. The time now is 15:23.

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