Try this, should work.
Code:
#include <amxmodx>
#include <amxmisc>
#define PLUGIN "Most Kills"
#define VERSION "1.0"
#define AUTHOR "MadMaurice"
#define MAX_PLAYERS 32
new player_kills[MAX_PLAYERS + 1];
new most_kills;
public plugin_init()
{
register_plugin( PLUGIN, VERSION, AUTHOR );
register_event( "DeathMsg", "count_kill", "a" );
register_event( "HLTV", "eNewRound", "a", "1=0", "2=0" );
most_kills = register_cvar( "sv_most_kills", "1" );
}
public resetcounter()
{
arrayset( player_kills, 0, MAX_PLAYERS + 1 )
}
public count_kill()
{
if( !get_pcvar_num( most_kills ) )
return;
new iKiller = read_data( 1 );
new iVictim = read_data( 2 );
if( iKiller == iVictim )
{
client_print( iKiller, print_chat, "[Most Kills] Team Kills are not counted!" );
}
else
{
player_kills[iKiller]++;
client_print( iKiller, print_chat, "[Most Kills] You have %d kills yet!", player_kills[iKiller] );
}
}
public get_most_kills_id()
{
new mkid, lkills = 0, i;
for( i = 0; i < MAX_PLAYERS + 1; i++ )
{
if( player_kills[i] > lkills )
{
mkid = i;
lkills = player_kills[i];
}
}
return mkid;
}
public client_disconnect( id )
{
player_kills[id] = 0;
}
public eNewRound()
{
if( !get_pcvar_num( most_kills ) )
return;
new mkid = get_most_kills_id();
static name[32];
get_user_name( mkid, name, 31 );
if( mkid > 0 )
{
client_print( 0, print_chat,"[Most Kills] Kill King is %s with %d kills! Congratulations!", name, player_kills[mkid] );
static iPlayers[32], iNum, pid;
get_players( iPlayers, iNum, "c" );
for( new i = 0; i < iNum; i++ )
{
pid = iPlayers[i];
client_print( pid, print_chat, "[Most Kills] You had %d kills!", player_kills[i] );
}
}
else
client_print( 0, print_chat,"[Most Kills] No kills this round!" );
resetcounter();
}