Might be mistakes. Going to sleep now. -.-
Code:
#include <amxmodx>
#define PLUGIN "The Best Player of Round"
#define VERSION "1.0"
#define AUTHOR "hleV"
new g_iKills[33], g_iDeaths[33], g_iMaxPlayers;
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR);
register_event("HLTV", "eHLTV", "a", "1=0", "2=0");
register_event("DeathMsg", "eDeathMsg", "a", "1>0");
register_logevent("eRoundEnd", 2, "1=Round_End");
g_iMaxPlayers = get_maxplayers();
}
public eHLTV()
for (new i = 1; i <= g_iMaxPlayers; i++)
g_iKills[i] = 0;
public eDeathMsg()
{
new iKiller = read_data(1), iVictim = read_data(2);
if (iKiller == iVictim)
return;
g_iKills[iKiller]++;
g_iDeaths[iVictim]++;
}
public eRoundEnd()
{
new iKills, iDeaths, iBest, szName[32], iPlayers[32], iNum, id;
get_players(iPlayers, iNum);
if (iNum < 2)
return;
for (new i = 0; i < iNum; i++)
{
id = iPlayers[i];
if (g_iKills[id] > iKills || g_iKills[id] == iKills && g_iDeaths[id] < iDeaths)
{
iBest = id;
g_iKills[id] = iKills;
}
}
get_user_name(iBest, szName, sizeof(szName) - 1);
client_print(0, print_chat, "Najlepszy gracz rundy: %s", szName);
client_print(0, print_chat, "Zdobyl %d fragow", iKills);
}