Raised This Month: $ Target: $400
 0% 

Display previous round information in chat


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 08-08-2021 , 22:32   Re: Display previous round information in chat
Reply With Quote #11

Try this.

1. Minor update applied for get_user_health() efficiency

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

new const Version[] = "0.2";

#define MAX_PLAYERS 32
#define MAX_NAME_LENGTH 32

enum PlayerStats
{
    
Shots,
    
DamageGiven,
    
DamageReceived
}

new 
g_pzStatsMAX_PLAYERS ][ MAX_PLAYERS ][ PlayerStats ];
new 
g_pEnabled;

public 
plugin_init() 
{
    
register_plugin"Round Damage" Version "bugsy" );
    
    
RegisterHamHam_TakeDamage "player" "HamTakeDamage" true );
    
register_logevent"RoundEnd" "1=Round_End" ); 
    
    
g_pEnabled register_cvar"rd_enabled" "1" );
}

public 
HamTakeDamagevictim inflictor attacker Float:fDamage bitDamage 
{     
    if ( 
get_pcvar_numg_pEnabled ) )
    {
        new 
iActualDamage pevvictim pev_dmg_take ); 

        
g_pzStatsattacker ][ victim ][ Shots ]++;
        
g_pzStatsvictim ][ attacker ][ DamageReceived ] += iActualDamage;
        
g_pzStatsattacker ][ victim ][ DamageGiven ] += iActualDamage;
    }
}

public 
RoundEnd()
{
    new 
iPlayers32 ] , iNum iAttackerPlayer iVictimPlayer iDamageGiven iDamageTaken iHealthMAX_PLAYERS ] , szNameMAX_PLAYERS ][ 32 ];
    
    
get_playersiPlayers iNum );
    
    for ( new 
iNum i++ )
    {
        
iAttackerPlayer iPlayers];
        
        for ( new 
iNum p++ )
        {
            
iVictimPlayer iPlayers];
            
            if ( ( 
!= ) && g_pzStatsiAttackerPlayer ][ iVictimPlayer ][ DamageGiven ] || g_pzStatsiAttackerPlayer ][ iVictimPlayer ][ DamageReceived ] )
            {
                
iDamageGiven ming_pzStatsiAttackerPlayer ][ iVictimPlayer ][ DamageGiven ] , 100 );
                
iDamageTaken ming_pzStatsiAttackerPlayer ][ iVictimPlayer ][ DamageReceived ] , 100 );
            
                if ( 
iDamageGiven || iDamageTaken )
                {
                    if ( !
iHealthiVictimPlayer ] )
                        
iHealthiVictimPlayer ] = is_user_aliveiVictimPlayer ) ? get_user_healthiVictimPlayer ) : -1;
                        
                    if ( 
szNameiVictimPlayer ][ ] == EOS )
                        
get_user_nameiVictimPlayer szNameiVictimPlayer ] , charsmaxszName[] ) );
                        
                    
client_printiAttackerPlayer print_chat "(%d with %d) damage, (%d with %d) taken, %s (%dHP)" iDamageGiven g_pzStatsiAttackerPlayer ][ iVictimPlayer ][ Shots ] , iDamageTaken g_pzStatsiVictimPlayer ][ iAttackerPlayer ][ Shots ] , szNameiVictimPlayer ] , iHealthiVictimPlayer ] == -iHealthiVictimPlayer ] );
                }
            }
        }
    }

    
ClearArray();
}

ClearArray()
{
    for ( new 
<= MAX_PLAYERS i++ )
    {
        for ( new 
<= MAX_PLAYERS p++ )
        {
            
g_pzStats][ ][ Shots ] = 0;
            
g_pzStats][ ][ DamageGiven ] = 0;
            
g_pzStats][ ][ DamageReceived ] = 0;
        }
    }

__________________

Last edited by Bugsy; 08-10-2021 at 21:30.
Bugsy is offline
 



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 20:38.


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