Есть автобаланс балансирует админов с определеным флагом. но вот суть он не работает. Система 1.10.550.
Поправьте пожалуйста. версия csdm мода csdm. Может его как то упростить.[DOUBLEPOST=1553187369][/DOUBLEPOST]Ой может не в той теме написал
Код:
#include <amxmodx>
#include <cstrike>
#include <csdm>
#if AMXX_VERSION_NUM < 183
#include <colorchat>
#else
#define DontChange print_team_default
#endif
new bool:g_bConnected[33], bool:g_bAdmin[33];
new g_iPlayers, CsTeams:g_iNewTeam[33];
public plugin_init()
register_plugin("CSDM Auto Balance", "1", "inco");
public client_putinserver(id)
{
if(get_user_flags(id) & ADMIN_RESERVATION )
g_bAdmin[id] = true;
g_iNewTeam[id] = CS_TEAM_UNASSIGNED;
g_bConnected[id] = true;
g_iPlayers++;
}
public client_disconnects(id)
{
g_bConnected[id] = g_bAdmin[id] = false;
g_iPlayers--;
}
public csdm_PostDeath(iKiller, id, HeadShot, const szWeapon[])
{
if(g_iPlayers < 4 || iKiller == id || !g_bConnected[id]) return;
set_task(0.5, "check_teams_and_transfer", id);
}
public csdm_PostSpawn(id, bool:bFake)
{
if(g_iNewTeam[id] > CS_TEAM_UNASSIGNED)
{
static szName[32]; get_user_name(id, szName, charsmax(szName));
client_print_color(0, DontChange, "^4[Balance] ^1%s ^3%s ^1был перемещен за команду ^3%s", g_bAdmin[id] ? "Админ" : "Игрок", szName, g_iNewTeam[id] == CS_TEAM_T ? "Террористов" : "Контр-Террористов");
static iMsgScreenFade;
if(!iMsgScreenFade) iMsgScreenFade = get_user_msgid("ScreenFade");
message_begin( MSG_ONE_UNRELIABLE, iMsgScreenFade, _, id );
write_short(2000);
write_short(2000);
write_short(0);
write_byte(g_iNewTeam[id] == CS_TEAM_T ? 175 : 0);
write_byte(0);
write_byte(g_iNewTeam[id] == CS_TEAM_CT ? 175 : 0);
write_byte(175);
message_end();
g_iNewTeam[id] = CS_TEAM_UNASSIGNED;
}
}
public check_teams_and_transfer(id)
{
static players[32], pnum, iNumCT, iNumTT;
if(g_bAdmin[id])
{
iNumCT = iNumTT = 0; get_players(players, pnum);
for(new i; i < pnum; i++)
{
if(!g_bAdmin[players[i]]) continue;
switch(cs_get_user_team(players[i]))
{
case CS_TEAM_T: iNumTT++;
case CS_TEAM_CT: iNumCT++;
}
}
}
else
{
get_players(players, iNumCT, "e", "CT");
get_players(players, iNumTT, "e", "TERRORIST");
}
OpersNumsPL(id, iNumCT, iNumTT);
}
OpersNumsPL(const id, const CT, const TT)
{
if(!is_user_connected(id))
return true
static CsTeams:NewTeam, iDiff; iDiff = CT - TT;
if(iDiff > 0) NewTeam = CS_TEAM_T;
else if(iDiff < 0) NewTeam = CS_TEAM_CT;
else return true;
if(abs(iDiff) >= 2 && cs_get_user_team(id) != NewTeam)
{
cs_set_user_team(id, NewTeam);
g_iNewTeam[id] = NewTeam;
}
return true
}