What is wrong with this code?
When the round ends only appears: Best Player: nothing more
Code:
#include <amxmodx>
#include <cstrike>
#define PLUGIN "Best Player"
#define VERSION "1.0"
#define AUTHOR "pauSe"
#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 DeathMsg()
{
new attacker = read_data(1)
new victim = read_data(2)
if(attacker != victim && cs_get_user_team(attacker) != cs_get_user_team(victim) && IsPlayer(attacker))
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[i] > bestscore)
{
bestplayer = i
bestscore = gKills[i]
}
}
get_user_name(bestplayer, name, 33)
set_hudmessage(255, 0, 0, -1.0, 0.01)
show_hudmessage(0, "Best Player: %s ^nKills: %i", name, bestscore)
}