#include <amxmodx>
#include <cstrike>
#define PLUGIN "Best Player"
#define VERSION "1.0"
#define AUTHOR "RedRobster"
#define IsPlayer(%1) (1 <= %1 <= gMaxPlayers)
new gKills[33]
new gMaxPlayers
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_logevent("RoundStart", 2, "1=Round_Start")
register_logevent("RoundEnd", 2, "1=Round_End")
register_event("DeathMsg", "FwdDeathMsgEvent", "a")
gMaxPlayers = get_maxplayers()
}
public client_connect(id)
gKills[id] = 0
public FwdDeathMsgEvent()
{
new attacker = read_data(1)
new victim = read_data(2)
if(attacker != victim && IsPlayer(attacker) && cs_get_user_team(attacker) != cs_get_user_team(victim))
gKills[attacker]++
}
public RoundStart()
arrayset(gKills, 0, 33)
public RoundEnd()
{
new name[34]
new bestplayer, bestscore
for(new i; i < sizeof(gKills); i++)
{
if(gKills > bestscore)
{
bestplayer = i
bestscore = gKills
}
}
get_user_name(bestplayer, name, 33)
set_hudmessage(0, 255, 0, -1.0, 0.9)
show_hudmessage(0, "Best player of the round: %s", name) //^nKills: %i", name, bestscore)
}