-
Автор темы
- #1
C++:
char const* get_server_type ( ) {
char const* server_type = "offline";
if ( i::engine->is_playing_demo ( ) )
server_type = "demo";
else if ( i::engine->is_client_local_to_active_server ( ) )
server_type = "local";
else if ( i::engine->is_in_game ( ) ) {
i_net_channel_info* info = i::engine->get_net_channel_info ( );
bool is_p2p = ( netadr_t ( info ? info->get_address ( ) : "127.0.0.1" ).get_port ( ) == 1 );
if ( i::engine->is_hltv ( ) ) {
if ( i::game_rules && i::game_rules->is_valve_ds ( ) )
server_type = "official gotv";
else if ( is_p2p )
server_type = "p2p gotv";
else
server_type = "gotv";
} else {
if ( i::game_rules && i::game_rules->is_valve_ds ( ) )
server_type = "valve";
else if ( is_p2p )
server_type = "p2p";
else
server_type = "online";
}
}
else if ( i::engine->is_connected ( ) )
server_type = "loading";
return server_type;
}