Raised This Month: $32 Target: $400
 8% 

How to detect last player who got hit ?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Moody92
Veteran Member
Join Date: May 2011
Location: Oman
Old 06-18-2013 , 05:51   How to detect last player who got hit ?
Reply With Quote #1

Hi,
I've been looking around for last hit player.. couldn't find it
If you don't get it.
for example I hit x player, he's the last player who got hit.

Could someone help me out with it ?

Last edited by Moody92; 06-18-2013 at 05:52.
Moody92 is offline
Bos93
Veteran Member
Join Date: Jul 2010
Old 06-18-2013 , 06:05   Re: How to detect last player who got hit ?
Reply With Quote #2

get_pdata_int(victim, 75)
__________________
Bos93 is offline
Send a message via ICQ to Bos93 Send a message via Skype™ to Bos93
guipatinador
SourceMod Donner Party
Join Date: Oct 2009
Location: Poortugal
Old 06-18-2013 , 06:41   Re: How to detect last player who got hit ?
Reply With Quote #3

Quote:
Originally Posted by Bos93 View Post
get_pdata_int(victim, 75)
I don't think he want m_LastHitGroup.
guipatinador is offline
Old 06-18-2013, 07:18
Moody92
This message has been deleted by Moody92.
Bos93
Veteran Member
Join Date: Jul 2010
Old 06-18-2013 , 07:33   Re: How to detect last player who got hit ?
Reply With Quote #4

my poor english

PHP Code:
#include < amxmodx >
#include < cstrike >
#include < hamsandwich >

#define PLUGIN_NAME        "x"
#define PLUGIN_VERSION    "x"
#define PLUGIN_AUTHOR    "x"

new g_iMaxClients;

public 
plugin_init( )
{
    
register_plugin 
    

        
PLUGIN_NAME
        
PLUGIN_VERSION
        
PLUGIN_AUTHOR 
    
);

    
RegisterHamHam_TakeDamage"player""CBasePlayer__TakeDamage__Pre", .Post false );

    
g_iMaxClients get_maxplayers( );
}

public 
CBasePlayer__TakeDamage__PrepevVictimpevInflictorpevAttackerFloat:flDamageiDmgBits )
{
    static 
iCell 0;
    static 
iCT 0;
    static 
iTerrorists 0;

    for ( 
iCell 1iCell <= g_iMaxClientsiCell++ )
    {
        if( !
is_user_aliveiCell ) )
        {
            continue;
        }    

        switch( 
cs_get_user_teamiCell ) )
        {
            case 
CS_TEAM_TiTerrorists++;
            case 
CS_TEAM_CTiCT++;
        }
    }

    if( 
iTerrorists == || iCT == 1)
    {
        
//code
    
}

__________________

Last edited by Bos93; 06-18-2013 at 07:36.
Bos93 is offline
Send a message via ICQ to Bos93 Send a message via Skype™ to Bos93
guipatinador
SourceMod Donner Party
Join Date: Oct 2009
Location: Poortugal
Old 06-18-2013 , 08:38   Re: How to detect last player who got hit ?
Reply With Quote #5

PHP Code:
static iCell 0
static 
iCT 0
static 
iTerrorists 0
You can't do that because iCT and iTerrorists increase when CBasePlayer__TakeDamage__Pre is called.

This is the right way,
PHP Code:
static iCTiCT 0
static iTerroristsiTerrorists 

Last edited by guipatinador; 06-18-2013 at 08:38.
guipatinador is offline
joropito
AlliedModders Donor
Join Date: Mar 2009
Location: pfnAddToFullPack
Old 06-18-2013 , 09:56   Re: How to detect last player who got hit ?
Reply With Quote #6

Keep it simple. I don't thing it's worth to have such thing btw.

PHP Code:
#include < amxmodx > 
#include < cstrike > 
#include < hamsandwich > 

#define PLUGIN_NAME        "x" 
#define PLUGIN_VERSION    "x" 
#define PLUGIN_AUTHOR    "x" 

new g_LastDamage

public 
plugin_init( ) 

    
register_plugin  
    
(  
        
PLUGIN_NAME,  
        
PLUGIN_VERSION,  
        
PLUGIN_AUTHOR  
    
); 

    
RegisterHamHam_TakeDamage"player""CBasePlayer__TakeDamage__Pre", .Post false ); 



public 
CBasePlayer__TakeDamage__PrepevVictimpevInflictorpevAttackerFloat:flDamageiDmgBits 
{
    
g_LastDamage pevVictim;

__________________

Divide et vinces
approved plugins | steam account

I don't accept PM for support. Just ask on forums.
If you're looking for private work, PM me.

Last edited by joropito; 06-18-2013 at 09:57.
joropito is offline
Send a message via MSN to joropito
EpicMonkey
buttmonkey
Join Date: Feb 2012
Old 06-18-2013 , 10:06   Re: How to detect last player who got hit ?
Reply With Quote #7

Quote:
Originally Posted by joropito View Post
Keep it simple. I don't thing it's worth to have such thing btw.

PHP Code:
#include < amxmodx > 
#include < cstrike > 
#include < hamsandwich > 

#define PLUGIN_NAME        "x" 
#define PLUGIN_VERSION    "x" 
#define PLUGIN_AUTHOR    "x" 

new g_LastDamage

public 
plugin_init( ) 

    
register_plugin  
    
(  
        
PLUGIN_NAME,  
        
PLUGIN_VERSION,  
        
PLUGIN_AUTHOR  
    
); 

    
RegisterHamHam_TakeDamage"player""CBasePlayer__TakeDamage__Pre", .Post false ); 



public 
CBasePlayer__TakeDamage__PrepevVictimpevInflictorpevAttackerFloat:flDamageiDmgBits 
{
    
g_LastDamage pevVictim;

as simple as that
EpicMonkey is offline
Moody92
Veteran Member
Join Date: May 2011
Location: Oman
Old 06-18-2013 , 11:58   Re: How to detect last player who got hit ?
Reply With Quote #8

Quote:
Originally Posted by joropito View Post
Keep it simple. I don't thing it's worth to have such thing btw.

PHP Code:
#include < amxmodx > 
#include < cstrike > 
#include < hamsandwich > 

#define PLUGIN_NAME        "x" 
#define PLUGIN_VERSION    "x" 
#define PLUGIN_AUTHOR    "x" 

new g_LastDamage

public 
plugin_init( ) 

    
register_plugin  
    
(  
        
PLUGIN_NAME,  
        
PLUGIN_VERSION,  
        
PLUGIN_AUTHOR  
    
); 

    
RegisterHamHam_TakeDamage"player""CBasePlayer__TakeDamage__Pre", .Post false ); 



public 
CBasePlayer__TakeDamage__PrepevVictimpevInflictorpevAttackerFloat:flDamageiDmgBits 
{
    
g_LastDamage pevVictim;

Thank you Mr. joropito
Moody92 is offline
joropito
AlliedModders Donor
Join Date: Mar 2009
Location: pfnAddToFullPack
Old 06-18-2013 , 13:10   Re: How to detect last player who got hit ?
Reply With Quote #9

Quote:
Originally Posted by EpicMonkey View Post
as simple as that
Yes, don't go deeper than necessary
__________________

Divide et vinces
approved plugins | steam account

I don't accept PM for support. Just ask on forums.
If you're looking for private work, PM me.
joropito is offline
Send a message via MSN to joropito
EpicMonkey
buttmonkey
Join Date: Feb 2012
Old 06-18-2013 , 13:26   Re: How to detect last player who got hit ?
Reply With Quote #10

Quote:
Originally Posted by joropito View Post
Yes, don't go deeper than necessary
they were confused regarding what the op requested
EpicMonkey 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 12:32.


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