I was working on this untill i got interupted yesterday. As there's been suggested a few alternatives, i won't be finishing it, but i'll share what i've got so far, in case someone else would like to finish it or use it for their own purposes.
PHP Code:
/* Sublime AMXX Editor v2.2 */
#include <amxmodx>
// #include <amxmisc>
#include <cstrike>
// #include <engine>
// #include <fakemeta>
// #include <hamsandwich>
#include <fun>
// #include <xs>
// #include <sqlx>
#pragma semicolon 1
new const g_szVersion[] = "1.0.0";
enum _: g_eInfo
{
g_iTerWin,
g_iCtWin
};
new g_iInfo[g_eInfo];
static const g_szMessages[] =
{
"#Terrorists_Win",
"#CTs_Win",
"#Round_Draw",
"#Game_Commencing",
"#Game_will_restart_in"
};
new g_iMsg;
new g_pWinStreak;
new g_pPlayerTransferAmount;
public plugin_init()
{
register_plugin("Team Balancer", g_szVersion, "NapoleoN#");
g_iMsg = get_user_msgid("TextMsg");
register_message(g_iMsg, "checkWinner");
g_pWinStreak = register_cvar("tb_winstreak", "5");
g_pPlayerTransferAmount = register_cvar("tb_transferamount", "2");
}
public checkWinner(const iMsg, const iDest, const iMsgEntity)
{
static szMsg[32];
get_msg_arg_string(2, szMsg, charsmax(szMsg));
new iMaxWinStreak = get_pcvar_num(g_pWinStreak);
if(equal(szMsg, g_szMessages[0]))
{
if(++g_iInfo[g_iTerWin] == iMaxWinStreak)
{
balanceTeams();
}
}
else if(equal(szMsg, g_szMessages[1]))
{
if(++g_iInfo[g_iCtWin] == iMaxWinStreak)
{
balanceTeams();
}
}
else
{
g_iInfo[g_iTerWin] = 0;
g_iInfo[g_iCtWin] = 0;
}
}
public balanceTeams()
{
new iPlayers[32], iCount, iKills[33];
get_players(iPlayers, iCount, "che", "TERRORIST");
for(new i; i < iCount; i++)
{
iKills[iPlayers[i]] = get_user_frags(iPlayers[i]);
}
SortIntegers(iKills, sizeof(iKills), Sort_Descending);
}
Keep in mind that this plugin will not be working, the only thing it's doing now, is keeping track of the winstreaks.
__________________