AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [HELP] How to get a player was attacked at leg ? (https://forums.alliedmods.net/showthread.php?t=106265)

Xevious 10-13-2009 02:38

[HELP] How to get a player was attacked at leg ?
 
How to get a player was attacked at leg ? :)

ot_207 10-13-2009 02:53

Re: [HELP] How to get a player was attacked at leg ?
 
PHP Code:

// plugin_init()
RegisterHam(Ham_TraceAttack"player""fw_trace")

public 
fw_trace(victimattackerFloat:damageFloat:dir[3], ptrbits)
{
 if (
get_tr2(ptrTR_iHitgroup) == HIT_LEFTLEG || get_tr2(ptrTR_iHitgroup) == HIT_RIGHTLEG)
 {
  
client_print(victimprint_chat"SHOT IN FOOT!")
 }
 return 
HAM_IGNORED



Magici3n 10-13-2009 03:29

Re: [HELP] How to get a player was attacked at leg ?
 
How to get a player was attacked by Headshot ? :)

ot_207 10-13-2009 03:49

Re: [HELP] How to get a player was attacked at leg ?
 
PHP Code:

// plugin_init() 
RegisterHam(Ham_TraceAttack"player""fw_trace"

public 
fw_trace(victimattackerFloat:damageFloat:dir[3], ptrbits

 if (
get_tr2(ptrTR_iHitgroup) == HIT_HEAD
 { 
  
client_print(victimprint_chat"HEAD HURTS!!!"
 } 
 return 
HAM_IGNORED 



uxMal 10-13-2009 07:00

Re: [HELP] How to get a player was attacked at leg ?
 
or just in your damage hook
Code:

get_user_attacker(victim,&weapon,&bodypart)
Then compare bodypart with one of the HIT_* constants

ot_207 10-13-2009 07:26

Re: [HELP] How to get a player was attacked at leg ?
 
Quote:

Originally Posted by uxMal (Post 960650)
or just in your damage hook
Code:

get_user_attacker(victim,&weapon,&bodypart)
Then compare bodypart with one of the HIT_* constants

That works too but it isn't as accurate as the one I posted above :wink:.

Magici3n 10-13-2009 08:20

Re: [HELP] How to get a player was attacked at leg ?
 
Quote:

Originally Posted by ot_207 (Post 960608)
PHP Code:

// plugin_init() 
RegisterHam(Ham_TraceAttack"player""fw_trace"

public 
fw_trace(victimattackerFloat:damageFloat:dir[3], ptrbits

 if (
get_tr2(ptrTR_iHitgroup) == HIT_HEAD
 { 
  
client_print(victimprint_chat"HEAD HURTS!!!"
 } 
 return 
HAM_IGNORED 




It Should only show when there is Headshot.but it is showing when head is hit 1 time.not headshot

One 10-13-2009 08:29

Re: [HELP] How to get a player was attacked at leg ?
 
Quote:

Originally Posted by Magici3n (Post 960679)
It Should only show when there is Headshot.but it is showing when head is hit 1 time.not headshot

just check if is the victim dead.or get vistims hp & check if is the damage which made >= vitim's HP

vitorrd 10-13-2009 08:34

Re: [HELP] How to get a player was attacked at leg ?
 
Quote:

Originally Posted by Magici3n (Post 960679)
It Should only show when there is Headshot.but it is showing when head is hit 1 time.not headshot

A headshot is a hit in the head, not a kill with a shot in the head. If you want to detect headshots, you can hook DeathMsg which uses isHeadshot as a parameter.

Magici3n 10-13-2009 08:53

Re: [HELP] How to get a player was attacked at leg ?
 
Quote:

Originally Posted by vitorrd (Post 960689)
A headshot is a hit in the head, not a kill with a shot in the head. If you want to detect headshots, you can hook DeathMsg which uses isHeadshot as a parameter.


Right but can u show me by giving code


All times are GMT -4. The time now is 22:36.

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