Raised This Month: $ Target: $400
 0% 

Display previous round information in chat


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
deprale
Senior Member
Join Date: Oct 2018
Location: Leeds
Old 08-10-2021 , 23:34   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()
{
    
set_task0.1 "DelayRoundEnd" );
}

public 
DelayRoundEnd()
{
    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;
        }
    }



Quote:
Originally Posted by Bugsy View Post
@deprale - I think your comment regarding damage happening during freeze time is valid. I'm not sure why Natsheh thought otherwise. If the OP wants to exclude damage during this time window, I can make an edit.

I too used to always use clamp, not realizing there was a min/max native for a 'one-sided' clamp.
Regarding the delay, wouldn't it make more sense to make a cvar pointer for mp_round_restart_delay and subtract 0.1 from it then execute this so it happens RIGHT before a newround? Putting it to 0.1 is still not enough IMO, since there's like 4.9 more seconds for people to damage each other.
__________________
deprale 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