[Respawn] Problem with team balancer

Статус
В этой теме нельзя размещать новые ответы.
Сообщения
22
Реакции
2
Ошибка
The plugin stops doing its job in the last 15 minutes of the game. The amxx list says it is running but does not balance the teams. At the beginning of the game it works perfectly.
ОС
Linux
Билд
Protocol version 48
Exe version 1.1.2.7/Stdio (cstrike)
ReHLDS version: 3.3.0.628-dev
Build date: 13:49:36 Dec 20 2017 (1348)
ReGamedll
ReGameDLL version: 5.3.0.279-dev
Build date: 12:34:05 Dec 17 2017
Build from: https://github.com/s1lentq/ReGameDLL_CS/commit/565e9cd
Список метамодулей
[ 1] SafeNameAndChat  RUN   -    SafeNameAndChat.so          v1.1             ini  ANY   ANY
[ 2] ReSemiclip RUN - resemiclip_mm_i386.so v2.3.9 ini Chlvl ANY
[ 3] AMX Mod X RUN - amxmodx_mm_i386.so v1.8.3-dev+5123 ini Start ANY
[ 4] Reunion RUN - reunion_mm_i386.so v0.1.75 ini Start Never
[ 5] VoiceTranscoder RUN - VoiceTranscoder.so v2017RC3 ini ANY ANY
[ 6] ReAuthCheck RUN - reauthcheck_mm_i386.so v0.1.6 ini Start Never
[ 7] hackdetector RUN - hackdetector_amxx_i386.so v0.15.328.lite pl3 ANY ANY
[ 8] FakeMeta RUN - fakemeta_amxx_i386.so v1.8.3-dev+5123 pl3 ANY ANY
[ 9] MySQL RUN - mysql_amxx_i386.so v1.8.3-dev+5123 pl3 ANY ANY
[10] ReAimDetector RUN - reaimdetector_amxx_i386.so v0.2.0 pl3 ANY Never
[11] CStrike RUN - cstrike_amxx_i386.so v1.8.3-dev+5123 pl3 ANY ANY
[12] Engine RUN - engine_amxx_i386.so v1.8.3-dev+5123 pl3 ANY ANY
[13] Ham Sandwich RUN - hamsandwich_amxx_i386.so v1.8.3-dev+5123 pl3 ANY ANY
[14] CSX RUN - csx_amxx_i386.so v1.8.3-dev+5123 pl3 ANY ANY
[15] Fun RUN - fun_amxx_i386.so v1.8.3-dev+5123 pl3 ANY ANY
15 plugins, 15 running
Список плагинов
name                    version     author            file             status
[ 1] AMXBans: Main Gm 1.6 Larte Team amxbans_main.am running
[ 2] AMXBans Core Gm 1.5.1 GmStaff & xPaw amxbans_core.am running
[ 3] ReAimDetector API 0.2.0 ReHLDS Team reaimdetector.a running
[ 4] CallAdmin Mysql 3.0 MAD.XayC calladmin.amxx running
[ 6] Gag System 1.0 uknown gagsystem.amxx running
[ 7] Mute 1.0 muter mute.amxx running
[ 8] Anti-Ad 0.1 Mati antiad.amxx running
[ 9] Admin Spectator ESP 1.3 KoST admin_spec_esp. running
[ 10] Admin Commands 1.8.3-Re AMXX Dev Team admincmd.amxx running
[ 11] Commands Menu 1.8.1.3746 AMXX Dev Team cmdmenu.amxx running
[ 12] Players Menu 1.8.3-dev+ AMXX Dev Team plmenu.amxx running
[ 13] Maps Menu 1.8.1.3746 AMXX Dev Team mapsmenu.amxx running
[ 14] Menus Front-End 1.8.1.3746 AMXX Dev Team menufront.amxx running
[ 15] Anti Flood 1.8.1.3746 AMXX Dev Team antiflood.amxx running
[ 16] Admin Chat 1.8.3-dev uknown adminchat.amxx running
[ 17] Admin Votes 1.8.1.3746 AMXX Dev Team adminvote.amxx running
[ 18] TimeLeft 1.8.3 AMXX Dev Team timeleft.amxx running
[ 19] NextMap 1.8.3 AMXX Dev Team nextmap.amxx running
[ 20] StatsX 1.8.3-dev+ AMXX Dev Team statsx.amxx running
[ 21] Stats Configuration 1.8.1.3746 AMXX Dev Team statscfg.amxx running
[ 23] Weapon Menu 0.0.9 SavSin CSDM_Style_Gun_ running
[ 24] ADV. QUAKE SOUNDS 5.0 HATTRICK (HTTRCK quakesounds.amx running
[ 25] Descriptive 'Fire in t 0.1 VEN fire_in_the_hol running
[ 26] Golden Ak 47 1.0 AlejandroSk GoldenAk.amxx running
[ 27] Vampire 1.0c Shalfey vampire.amxx running
[ 28] Refill Weapon On Kill 0.0.2 ConnorMcLeod refill_ammo.amx running
[ 29] No Objectives 0.3 VEN noobjectives.am running
[ 30] Map Spawns Editor 1.0.16 iG_os Map_Spawns_Edit running
[ 31] Autoresponder/Advertis 0.5 MaximusBrood ad_manager.amxx running
[ 32] Simple Demo Recorder 1.0 unknown amx_demorecorde running
[ 33] Ultimate IP Shower 2.0 unknown amx_show_ip.amx running
[ 34] xREDIRECT 1.0.3.4[Mo x0R + ~UN!CORN~ xredirect.amxx running
[ 35] AMX Admin Model 1.1.1 whitemike amx_adminmodel. running
[ 36] ResetScore 1.0 uknown rs.amxx running
[ 37] Admins are VIP's 1.0 PHP++ admins-with-vip running
[ 38] Spec Switch 0.1.3 many Spec_Switch.amx running
[ 39] MOTD Commands 1.0 unknown motdcommand.amxx running
[ 40] Block cheat key 2.1 9 rpamm!? & maeS block_key.amxx running
[ 41] Ultimate SS Taker V 2.1 navir amx_ss.amxx running
[ 42] No Name Change 1.0 No_Change_name. running
Исходный код
#include < amxmodx >
#include < cstrike >
#include < hamsandwich >

#define BALANCE_IMMUNITY ADMIN_IMMUNITY

/*
auto_balance
- 0: Disabled
- 1: Enabled
- 2: Enabled, obey immunity
*/

new bool:g_bConnected[ 33 ], bool:g_bImmunity[ 33 ], CsTeams:g_iNewTeam[ 33 ];
new g_pCvar, g_iMaxPlayers, g_iMsgSayText, g_iMsgScreenFade, g_iPlayers;

public plugin_init( ) {
register_plugin( "Auto Balance", "1.0", "xPaw" );

RegisterHam( Ham_Spawn, "player", "eventPlayerSpawnPre", 0 );
register_event( "DeathMsg", "eventDeathMsg", "a" );
g_pCvar = register_cvar( "auto_balance", "2" );

g_iMsgScreenFade = get_user_msgid( "ScreenFade" );
g_iMsgSayText = get_user_msgid( "SayText" );
g_iMaxPlayers = get_maxplayers( );
}

public client_putinserver( id ) {
g_bConnected[ id ] = true; // bool:!is_user_bot( id );
g_bImmunity[ id ] = bool:( get_user_flags( id ) & BALANCE_IMMUNITY );
g_iPlayers++;
}

public client_disconnect( id ) {
g_iNewTeam[ id ] = CS_TEAM_UNASSIGNED;
g_bImmunity[ id ] = false;
g_bConnected[ id ] = false;
g_iPlayers--;
}

public eventDeathMsg( ) {
new iKiller = read_data(1);
new iVictim = read_data(2);

if( g_iPlayers < 4 || iKiller == iVictim || !g_bConnected[ iVictim ] )
return;

new iCvar = get_pcvar_num( g_pCvar );

if( iCvar <= 0 || iCvar == 2 && g_bImmunity[ iVictim ] )
return;

hasDifference(iVictim)
}

public eventPlayerSpawnPre( id ) {
new CsTeams:iNewTeam = g_iNewTeam[ id ];

if ( iNewTeam > CS_TEAM_UNASSIGNED ) {
if (!hasDifference(id))
{
g_iNewTeam[id] = CS_TEAM_UNASSIGNED
return
}

cs_set_user_team(id, iNewTeam)

new szName[ 32 ];
get_user_name( id, szName, 31 );

set_hudmessage( 0, 127, 255, 0.42, 0.53, 2, 6.0, 4.0, 0.1, 0.2, -1 );

if ( iNewTeam == CS_TEAM_T ) {
show_hudmessage( id, "You have been transfered to Terrorists!" );
UTIL_GreenPrintAll( id, "^4[CSDM]^3 %s^1 has been transfered to^3 Terrorists^1.", szName );
UTIL_ScreenFade( id, 175, 0, 0 );
} else {
show_hudmessage( id, "You have been transfered to Counter-Terrorists!" );
UTIL_GreenPrintAll( id, "^4[CSDM]^3 %s^1 has been transfered to^3 Counter-Terrorists^1.", szName );
UTIL_ScreenFade( id, 0, 0, 175 );
}

g_iNewTeam[id] = CS_TEAM_UNASSIGNED
}
}

bool:hasDifference(id)
{
new iPlayers[ 2 ];

for( new i = 1; i <= g_iMaxPlayers; i++ ) {
if( !g_bConnected[ i ] )
continue;

switch( cs_get_user_team( i ) ) {
case CS_TEAM_T: iPlayers[ 0 ]++;
case CS_TEAM_CT: iPlayers[ 1 ]++;
}
}

new CsTeams:iCheck, iDifference = iPlayers[ 1 ] - iPlayers[ 0 ];

if( iDifference > 0 )
iCheck = CS_TEAM_T;
else if( iDifference < 0 )
iCheck = CS_TEAM_CT;
else
return false;

if( abs( iDifference ) < 2 || cs_get_user_team(id) == iCheck )
return false;

g_iNewTeam[id] = iCheck;

return true
}

UTIL_GreenPrintAll( const iSender, const Message[ ], any:... ) {
new szMessage[ 192 ];
vformat( szMessage, 191, Message, 3 );

message_begin( MSG_BROADCAST, g_iMsgSayText );
write_byte( iSender );
write_string( szMessage );
message_end( );
}

UTIL_ScreenFade( const id, const iRed, const iGreen, const iBlue ) {
message_begin( MSG_ONE_UNRELIABLE, g_iMsgScreenFade, _, id );
write_short( 2000 );
write_short( 2000 );
write_short( 0 );
write_byte( iRed );
write_byte( iGreen );
write_byte( iBlue );
write_byte( 175 );
message_end( );
}
Thanks for the help.
 
В этой теме было размещено решение! Перейти к решению.
Статус
В этой теме нельзя размещать новые ответы.

Пользователи, просматривающие эту тему

Сейчас на форуме нет ни одного пользователя.
Сверху Снизу