|
Author
|
Message
|
|
Junior Member
|

10-12-2014
, 15:18
Re: Kills per round
|
#1
|
Quote:
Originally Posted by HENNESSY
Here you go (not tested)
PHP Code:
#include < amxmodx >
new g_iKills[ 33 ];
new g_iMaxPlayers;
public plugin_init( )
{
register_logevent( "LogEvent_RoundEnd", 2, "1=Round_End" );
register_logevent( "LogEvent_RoundStart", 2, "1=Round_Start" );
register_event( "DeathMsg", "Event_DeathMsg", "a" );
g_iMaxPlayers = get_maxplayers( );
}
public LogEvent_RoundEnd( )
{
new iBest = 0;
for( new i = 1; i <= g_iMaxPlayers; ++i )
{
if( !is_user_connected( i ) )
continue;
if( g_iKills[ i ] > g_iKills[ iBest ] )
{
iBest = i;
}
}
new szName[ 32 ];
get_user_name( iBest, szName, charsmax( szName ) );
client_print( 0, print_chat, "%s did the most kills this round.", szName );
}
public LogEvent_RoundStart( )
{
arrayset( g_iKills, 0, 32 );
}
public Event_DeathMsg( )
{
new iKiller = read_data( 1 );
new iVictim = read_data( 2 );
if( iKiller == iVictim || get_user_team( iKiller ) == get_user_team( iVictim ) )
return;
++g_iKills[ iKiller ];
}
|
you can avoid hooking new round and reset your array when the round ends, after you printed what you've wanted.
|
|
|
|