Raised This Month: $ Target: $400
 0% 

Catch legs and arms shot


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Doc-Holiday
AlliedModders Donor
Join Date: Jul 2007
Old 01-16-2009 , 00:39   Catch legs and arms shot
Reply With Quote #1

i need a functin that will catch the following
HIT_LEFTLEG
HIT_RIGHTLEG
HIT_LEFTARM
HIT_RIGHTARM
PHP Code:
public ham_traceattack_player(iVictimiAttackerFloat:damageFloat:direction[3], traceresultdamagebitsid)
{
 if(
get_tr2(traceresultTR_iHitgroup) == HIT_LEFTLEG)
 {
            
//shot in legs?
 
}
else if(
get_tr2(traceresultTR_iHitgrou) == HIT_LEFTARM)
{
            
//shot in arms?
}
 return 
HAM_IGNORED


Last edited by Doc-Holiday; 01-16-2009 at 00:50.
Doc-Holiday is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 01-16-2009 , 01:11   Re: Catch legs and arms shot
Reply With Quote #2

If this doesn't work, try to post register.
PHP Code:
new g_iMaxPlayers

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)

    
RegisterHam(Ham_TraceAttack"player""Player_TraceAttack")

    
g_iMaxPlayers get_maxplayers()
}

public 
Player_TraceAttack(ididattackerFloat:damageFloat:direction[3], trdamagebits)
{
    if( !(
<= idattacker <= g_iMaxPlayers) )
    {
        return
    }

    switch( 
get_tr2(trTR_iHitgroup) )
    {
        case 
HIT_LEFTARM:
        case 
HIT_RIGHTARM:
        case 
HIT_LEFTLEG:
        case 
HIT_RIGHTLEG:
    }

__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Doc-Holiday
AlliedModders Donor
Join Date: Jul 2007
Old 01-16-2009 , 01:21   Re: Catch legs and arms shot
Reply With Quote #3

say i want HIT_RIGHTARM and HIT_LEFTARM to call this function

and the legs to call anohter how would i do that i dont really understand thiskinda stuff to behonest withyou guys...

Just trying to expand on my VR(Virtual Reality) plugin
Doc-Holiday is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 01-16-2009 , 01:57   Re: Catch legs and arms shot
Reply With Quote #4

Quote:
Originally Posted by NcB_Sav View Post
say i want HIT_RIGHTARM and HIT_LEFTARM to call this function

and the legs to call anohter how would i do that i dont really understand thiskinda stuff to behonest withyou guys...

Just trying to expand on my VR(Virtual Reality) plugin
Using ConnorMcLeods code, edit the portion to this:

PHP Code:
    switch( get_tr2(trTR_iHitgroup) )
    {
        case 
HIT_LEFTARM ,HIT_RIGHTARM:
        {
            
//call arm hit function
        
}
        case 
HIT_LEFTLEG,HIT_RIGHTLEG:
        {
            
//call leg hit function
        
}
    } 
__________________
Bugsy is offline
Doc-Holiday
AlliedModders Donor
Join Date: Jul 2007
Old 01-16-2009 , 02:20   Re: Catch legs and arms shot
Reply With Quote #5

Thanks but it gives me these errors

/home/groups/amxmodx/tmp3/phpmySI2v.sma(60 -- 61) : error 029: invalid expression, assumed zero
/home/groups/amxmodx/tmp3/phpmySI2v.sma(66 -- 67) : error 029: invalid expression, assumed zero


on those 2 case's

edit... i lied lol didnt see :

Last edited by Doc-Holiday; 01-16-2009 at 02:34.
Doc-Holiday is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 01-16-2009 , 06:51   Re: Catch legs and arms shot
Reply With Quote #6

Dunno what you exactly do, but i could be better to only hook TakeDamage POST, then retrieve the actual damage with pev_dmg_take, and hitgroup with offset 75 :

75 - m_LastHitGroup
76 - m_bitsDamageType

http://forums.alliedmods.net/showthread.php?t=68113
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Reply


Thread Tools
Display Modes

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 01:40.


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