Raised This Month: $ Target: $400
 0% 

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


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Xevious
Senior Member
Join Date: Sep 2009
Location: Computer Chair
Old 10-13-2009 , 02:38   [HELP] How to get a player was attacked at leg ?
Reply With Quote #1

How to get a player was attacked at leg ?
__________________
Nothing possible when you are not hardworking
Xevious is offline
Send a message via MSN to Xevious
ot_207
Veteran Member
Join Date: Jan 2008
Location: Romania The Love Country
Old 10-13-2009 , 02:53   Re: [HELP] How to get a player was attacked at leg ?
Reply With Quote #2

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

__________________
My approved plug-ins | Good for newbies! | Problems?

Back, will come around when I have time.

Last edited by ot_207; 10-13-2009 at 03:49.
ot_207 is offline
Magici3n
BANNED
Join Date: Oct 2009
Location: Beautiful Beach
Old 10-13-2009 , 03:29   Re: [HELP] How to get a player was attacked at leg ?
Reply With Quote #3

How to get a player was attacked by Headshot ?
Magici3n is offline
ot_207
Veteran Member
Join Date: Jan 2008
Location: Romania The Love Country
Old 10-13-2009 , 03:49   Re: [HELP] How to get a player was attacked at leg ?
Reply With Quote #4

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 

__________________
My approved plug-ins | Good for newbies! | Problems?

Back, will come around when I have time.
ot_207 is offline
uxMal
Member
Join Date: Oct 2007
Old 10-13-2009 , 07:00   Re: [HELP] How to get a player was attacked at leg ?
Reply With Quote #5

or just in your damage hook
Code:
get_user_attacker(victim,&weapon,&bodypart)
Then compare bodypart with one of the HIT_* constants
uxMal is offline
ot_207
Veteran Member
Join Date: Jan 2008
Location: Romania The Love Country
Old 10-13-2009 , 07:26   Re: [HELP] How to get a player was attacked at leg ?
Reply With Quote #6

Quote:
Originally Posted by uxMal View Post
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 .
__________________
My approved plug-ins | Good for newbies! | Problems?

Back, will come around when I have time.
ot_207 is offline
Magici3n
BANNED
Join Date: Oct 2009
Location: Beautiful Beach
Old 10-13-2009 , 08:20   Re: [HELP] How to get a player was attacked at leg ?
Reply With Quote #7

Quote:
Originally Posted by ot_207 View Post
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
Magici3n is offline
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 10-13-2009 , 08:29   Re: [HELP] How to get a player was attacked at leg ?
Reply With Quote #8

Quote:
Originally Posted by Magici3n View Post
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
__________________
One is offline
Send a message via ICQ to One Send a message via AIM to One Send a message via MSN to One Send a message via Yahoo to One Send a message via Skype™ to One
vitorrd
Senior Member
Join Date: Jul 2009
Old 10-13-2009 , 08:34   Re: [HELP] How to get a player was attacked at leg ?
Reply With Quote #9

Quote:
Originally Posted by Magici3n View Post
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.
vitorrd is offline
Magici3n
BANNED
Join Date: Oct 2009
Location: Beautiful Beach
Old 10-13-2009 , 08:53   Re: [HELP] How to get a player was attacked at leg ?
Reply With Quote #10

Quote:
Originally Posted by vitorrd View Post
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
Magici3n is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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