Raised This Month: $ Target: $400
 0% 

[Help] Damage Event


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
BhK
Junior Member
Join Date: Dec 2014
Location: India
Old 12-20-2014 , 11:54   [Help] Damage Event
Reply With Quote #1

I want to get the hit place on damage,
Using these:-
PHP Code:
register_event("Damage""On_Damage""b""2>0"
i don't want to use CSX Module !
BhK is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 12-20-2014 , 11:55   Re: [Help] Damage Event
Reply With Quote #2

Quote:
Originally Posted by BhK View Post
i don't want to use CSX Module !
Why?
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
BhK
Junior Member
Join Date: Dec 2014
Location: India
Old 12-20-2014 , 11:59   Re: [Help] Damage Event
Reply With Quote #3

I know it is done with CSX Module, but i want to know if it is possible to do it without CSX !
BhK is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 12-20-2014 , 12:17   Re: [Help] Damage Event
Reply With Quote #4

Yes, with Ham Sandwich
__________________

Last edited by Bugsy; 12-20-2014 at 12:17.
Bugsy is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 12-20-2014 , 12:29   Re: [Help] Damage Event
Reply With Quote #5

Quote:
Originally Posted by Bugsy View Post
Yes, with Ham Sandwich
Bugsy is back

Ham_TakeDamage is an alternative.
__________________
HamletEagle is offline
BhK
Junior Member
Join Date: Dec 2014
Location: India
Old 12-20-2014 , 13:20   Re: [Help] Damage Event
Reply With Quote #6

Quote:
Originally Posted by Bugsy View Post
Yes, with Ham Sandwich
Thanks,
After searching i have made these, tell if something going wrong !
Its working

PHP Code:
#define OFFSET_LAST_HIT_GROUP      75 
#define EXTRAOFFSET_PL_LINUX        5 

public fw_takedamage(victiminflictorattackerFloat:damagebits
{
    if(!
is_user_connectedattacker ) || inflictor != attacker)
        return 
HAM_IGNORED;
    
    new  
hitgroup get_pdata_int(victimOFFSET_LAST_HIT_GROUPEXTRAOFFSET_PL_LINUX
    
    switch( 
hitgroup )
    {
        case 
HIT_HEAD
        {
            
client_print(attackerprint_center"Head")
        }
        case 
HIT_CHEST
        {
            
client_print(attackerprint_center"Chest")
        }
        case 
HIT_STOMACH
        {
            
client_print(attackerprint_center"Stomach")
        }
        
// etc
    
}
    return 
HAM_IGNORED;

BhK is offline
Kuma77
Senior Member
Join Date: Sep 2014
Location: Behind PC
Old 12-20-2014 , 13:33   Re: [Help] Damage Event
Reply With Quote #7

Make sure you write

PHP Code:
#include <hamsandwich>
public plugin_init()
{
     
RegisterHam("Ham_TakeDamage""player""fw_takedamage")

__________________
SPACE TIME
Kuma77 is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 12-20-2014 , 13:35   Re: [Help] Damage Event
Reply With Quote #8

What are your intentions with this?
PHP Code:
if( !is_user_connectedattacker ) || inflictor != attacker )
        return 
HAM_IGNORED
__________________

Last edited by Bugsy; 12-20-2014 at 13:35.
Bugsy is offline
BhK
Junior Member
Join Date: Dec 2014
Location: India
Old 12-20-2014 , 13:52   Re: [Help] Damage Event
Reply With Quote #9

Quote:
Originally Posted by Bugsy View Post
What are your intentions with this?
PHP Code:
if( !is_user_connectedattacker ) || inflictor != attacker )
        return 
HAM_IGNORED
Checking if attacker is connected and the damage is done by the attacker !
is something wrong ?
Or should I only write ?
PHP Code:
if( inflictor != attacker )
        return 
HAM_IGNORED
BhK is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 12-20-2014 , 14:13   Re: [Help] Damage Event
Reply With Quote #10

Quote:
Originally Posted by BhK View Post
Checking if attacker is connected and the damage is done by the attacker !
is something wrong ?
Or should I only write ?
PHP Code:
if( inflictor != attacker )
        return 
HAM_IGNORED
Why are you using inflictor? inflictor is the same as attacker except for when it's grenade damage. I'm guessing you want to check that the victim was hurt by another player? Better to compare victim to attacker.
PHP Code:
if ( !is_user_connectedattacker ) || ( victim == attacker ) )
        return 
HAM_IGNORED
__________________

Last edited by Bugsy; 12-20-2014 at 14:17.
Bugsy 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 15:23.


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