PHP Code:
#include <amxmodx>
#define PLUGIN "BestPlayer"
#define VERSION "1.0"
#define AUTHOR "KaMaZZ"
new kills[33]
new bestplayer = 0, g_iMaxPlayers;
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_event("DeathMsg", "death_event", "a", "1>0");
register_logevent("wyczysc", 2, "1=Round_Start")
register_logevent("wiadomosc",2,"1=Round_End")
g_iMaxPlayers = get_maxplayers();
}
public client_connect(id)
{
kills[id] = 0
}
public death_event()
{
static killer;
if( ( killer = read_data( 1 ) ) != read_data( 2 ) )
{
kills[ read_data( 1 ) ]++;
}
}
public wiadomosc()
{
if(get_playersnum() < 2)
return
new deaths;
for(new i=1; i <= g_iMaxPlayers; i++)
{
deaths = get_user_deaths( i );
kills[i] -= deaths; // kills[i] = kills[i] - deaths.
if(kills[i] >= kills[bestplayer])
bestplayer = i;
}
new name[32];
get_user_name(bestplayer, name, 31);
client_print(0, print_chat, "Najlepszy gracz rundy: %s", name)
client_print(0, print_chat, "Zdobyl %d fragow", kills[bestplayer] + deaths)
// client_print(0, print_chat, "Trafil %d razy w leb", hsfrag)
}
public wyczysc()
{
for( new i = 1 ; i <= g_iMaxPlayers ; i++ )
{
kills[ i ] = 0;
}
}
Sorry, hleV was faster, but try whatever you like(I think there's a mistake or two in hleV's code, like he said himself).
__________________