Kyron
walking
Desenvolvido por Raphael Carnaúba.
Substitua por:
Se você usa Forgotten Server ou Evolutions:
Procure por:
Substitua por:
Auto IP Terminado
Agora se você quer algo diferente como por exemplo você colocar
no seu ip no config.lua seuserver.servegame.com
Use esse codigo:
(SVN)
Procure por:
E substitua por :
Se você usa Evolutions ou Forgotten Server:
Troque:
por:
Creditos:
Raphael Carnaúba
[/code]
Code:
Fiz esse code a 2 dias atrás, mais não quiz liberar...depois de meus amigos pedirem descidi liberar pro OTplanet
(SVN)
Vá em otserv.cpp e procure por :
[code] if(argc > 1)
ip = argv[1];
else
ip = g_config.getString(ConfigManager::IP);
Substitua por:
Code:
if( g_config.getString(ConfigManager::IP) == "auto" )
{
if( gethostname( szHostName , 128) == 0 )
{
struct hostent* he = gethostbyname( szHostName );
if( he != NULL )
{
ip = inet_ntoa( * ( reinterpret_cast< in_addr* >( he->h_addr )));
}
}
}
else{
if(argc > 1)
ip = argv[1];
else
ip = g_config.getString(ConfigManager::IP);
}
Se você usa Forgotten Server ou Evolutions:
Procure por:
Code:
ip = g_config.getString(ConfigManager::IP);
Substitua por:
Code:
if( g_config.getString(ConfigManager::IP) == "auto" )
{
if( gethostname( szHostName , 128) == 0 )
{
struct hostent* he = gethostbyname( szHostName );
if( he != NULL )
{
ip = inet_ntoa( * ( reinterpret_cast< in_addr* >( he->h_addr )));
}
}
}
else{
ip = g_config.getString(ConfigManager::IP);
}
Auto IP Terminado
Agora se você quer algo diferente como por exemplo você colocar
no seu ip no config.lua seuserver.servegame.com
Use esse codigo:
(SVN)
Procure por:
Code:
if(argc > 1)
ip = argv[1];
else
ip = g_config.getString(ConfigManager::IP);
E substitua por :
Code:
struct hostent* he = gethostbyname(g_config.getString(ConfigManager::IP));
if( he != NULL )
{
ip = inet_ntoa( * ( reinterpret_cast< in_addr* >( he->h_addr )));
}
else{
std::cout << "Could not resolve host address " << ip << std::endl;
std::cout << "IP now is 127.0.0.1" << std::endl;
ip = "127.0.0.1";
}
Se você usa Evolutions ou Forgotten Server:
Troque:
Code:
ip = g_config.getString(ConfigManager::IP);
Code:
struct hostent* he = gethostbyname(g_config.getString(ConfigManager::IP));
if( he != NULL )
{
ip = inet_ntoa( * ( reinterpret_cast< in_addr* >( he->h_addr )));
}
else{
std::cout << "Could not resolve host address " << ip << std::endl;
std::cout << "IP now is 127.0.0.1" << std::endl;
ip = "127.0.0.1";
}
Creditos:
Raphael Carnaúba
[/code]