Raised This Month: $ Target: $400
 0% 

Display previous round information in chat


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
theuser
Member
Join Date: Jul 2020
Old 08-11-2021 , 07:03   Re: Display previous round information in chat
Reply With Quote #11

Quote:
Originally Posted by Bugsy View Post
Try this:
PHP Code:
#include <amxmodx>
#include <hamsandwich>
#include <fakemeta>

new const Version[] = "0.3";

#define MAX_PLAYERS 32
#define MAX_NAME_LENGTH 32

enum PlayerStats
{
    
Shots,
    
DamageGiven
}

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_pzStatsattacker ][ victim ][ DamageGiven ] += iActualDamage;
    }
}

public 
RoundEnd()
{
    new 
iPlayers32 ] , iNum iPlayer iOtherPlayer iDamageGiven iDamageTaken iHealthMAX_PLAYERS ] , szNameMAX_PLAYERS ][ 32 ];

    
get_playersiPlayers iNum );

    for ( new 
iNum i++ )
    {
        
iPlayer iPlayers];
        
        for ( new 
iNum p++ )
        {
            
iOtherPlayer iPlayers];
            
            if ( ( 
!= ) && g_pzStatsiPlayer ][ iOtherPlayer ][ DamageGiven ] || g_pzStatsiOtherPlayer ][ iPlayer ][ DamageGiven ] )
            {
                
iDamageGiven ming_pzStatsiPlayer ][ iOtherPlayer ][ DamageGiven ] , 100 );
                
iDamageTaken ming_pzStatsiOtherPlayer ][ iPlayer ][ DamageGiven ] , 100 );
            
                if ( 
iDamageGiven || iDamageTaken )
                {
                    if ( !
iHealthiOtherPlayer ] )
                        
iHealthiOtherPlayer ] = is_user_aliveiOtherPlayer ) ? get_user_healthiOtherPlayer ) : 0;
                        
                    if ( 
szNameiOtherPlayer ][ ] == EOS )
                        
get_user_nameiOtherPlayer szNameiOtherPlayer ] , charsmaxszName[] ) );
                        
                    
client_printiPlayer print_chat "(%d with %d) damage, (%d with %d) taken, %s (%dHP)" is_user_aliveiOtherPlayer ) ? iDamageGiven 100 g_pzStatsiPlayer ][ iOtherPlayer ][ Shots ] , iDamageTaken g_pzStatsiOtherPlayer ][ iPlayer ][ Shots ] , szNameiOtherPlayer ] , iHealthiOtherPlayer ] );
                    
                }
            }
        }
    }

    
ClearArray();
}

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

In this case, a maximum of 100 is printed.
But you forgot:
A player's damage is 70 and I shoot him with an awp arrow, 100 damages are printed in chat, while 70 damages should be printed.
theuser is offline
 


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


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