Код:
log_amx( "ONPLAYERDISCONNECT REMOVE SENTRIES START" );
new iEntHead = -1;
while( ( iEntHead = fm_find_ent_by_class( iEntHead, CLASSNAME_HEAD ) ) ) {
if( !pev_valid( iEntHead ) )
continue;
if( GetSentryPeople( iEntHead, OWNER ) != id )
continue;
if( pev( iEntHead, pev_iuser4 ) )
continue;
if( pev_valid( GetSentryBase( iEntHead ) ) )
set_pev( GetSentryBase( iEntHead ), pev_flags, pev( GetSentryBase( iEntHead ), pev_flags ) | FL_KILLME );
set_pev( iEntHead, pev_flags, pev( iEntHead, pev_flags ) | FL_KILLME );
}
log_amx( "ONPLAYERDISCONNECT REMOVE SENTRYHEAD END" );
if( g_bInBuilding[ id ] ) {
new iEntBase = -1;
while( ( iEntBase = fm_find_ent_by_class( iEntBase, CLASSNAME_BASE ) ) ) {
if( !pev_valid( iEntBase ) )
continue;
if( GetSentryPeople( iEntBase, OWNER ) != id )
continue;
remove_task( iEntBase + TASK_SENTRY );
set_pev( iEntBase, pev_flags, pev( iEntBase, pev_flags ) | FL_KILLME );
}
g_bInBuilding[ id ] = false;
}
log_amx( "ONPLAYERDISCONNECT REMOVE SENTRYBASE BUILDING END" );
ClearUpgraders( id );
Код:
public fw_PlayerSpawn_Post( victim ) {
if( !is_user_connected( victim ) )
return HAM_IGNORED;
log_amx( "ONPLAYERSPAWN REMOVE SENTRIES START [%d]", victim );
new iEntHead = -1;
while( ( iEntHead = fm_find_ent_by_class( iEntHead, CLASSNAME_HEAD ) ) ) {
if( !pev_valid( iEntHead ) )
continue;
if( GetSentryPeople( iEntHead, OWNER ) != victim )
continue;
if( pev( iEntHead, pev_iuser4 ) )
continue;
log_amx( "fw_PlayerSpawn_Post FIRST WHILE REMOVE ENTBASE - %d", GetSentryBase( iEntHead ) );
if( pev_valid( GetSentryBase( iEntHead ) ) )
set_pev( GetSentryBase( iEntHead ), pev_flags, pev( GetSentryBase( iEntHead ), pev_flags ) | FL_KILLME );
log_amx( "fw_PlayerSpawn_Post FIRST WHILE REMOVE HEAD - %d", iEntHead );
set_pev( iEntHead, pev_flags, pev( iEntHead, pev_flags ) | FL_KILLME );
}
log_amx( "ONPLAYERSPAWN REMOVE SENTRYHEAD END [%d]", victim );
if( g_bInBuilding[ victim ] ) {
new iEntBase = -1;
while( ( iEntBase = fm_find_ent_by_class( iEntBase, CLASSNAME_BASE ) ) ) {
if( !pev_valid( iEntBase ) )
continue;
if( GetSentryPeople( iEntBase, OWNER ) != victim )
continue;
log_amx( "fw_PlayerSpawn_Post SECOND WHILE REMOVE BASE - %d", iEntBase );
remove_task( iEntBase + TASK_SENTRY );
set_pev( iEntBase, pev_flags, pev( iEntBase, pev_flags ) | FL_KILLME );
}
g_bInBuilding[ victim ] = false;
}
log_amx( "ONPLAYERSPAWN REMOVE SENTRYBASE BUILDING END [%d]", victim );
return HAM_IGNORED;
}
Эти два куска кода вызывают краши сервера. Не знаю, что уже делать..
Обычно краш на client_disconnected происходит, когда меняется мапа. Второй краш (fw_player_spawn) происходит абсолютно рандомно