Untitled
unknown
plain_text
7 months ago
2.2 kB
7
Indexable
bool loggedIn = false;
bool commandsSent = false;
bool sendingFilterCommand = true;
bool sendingPublicCommand = false;
struct timeval currTime;
int timeDiff;
while( 1 )
{
if( gGProxy->Update( 40000 ) )
break;
// Check if user is logged in
if (!loggedIn && gGProxy->m_BNET->GetLoggedIn())
{
loggedIn = true;
}
// Send commands after login
if (loggedIn && !commandsSent)
{
if (sendingFilterCommand)
{
// Automatically input the command /filter pd
gInputBuffer = "/filter pd";
gInputWindowChanged = true;
CONSOLE_Draw();
// Simulate Enter key press
int c = 10; // LF character
// Process the input buffer as if Enter was pressed
if (c == 10 || c == 13)
{
string Command = gInputBuffer;
transform(Command.begin(), Command.end(), Command.begin(), (int(*)(int))tolower);
if (Command.size() >= 9 && Command.substr(0, 8) == "/filter ")
{
string Filter = gInputBuffer.substr(8);
if (!Filter.empty() && Filter.size() <= 31)
{
gGProxy->m_BNET->SetPublicGameFilter(Filter);
CONSOLE_Print("[BNET] started filtering public game names for \"" + Filter + "\"");
}
}
gInputBuffer.clear();
sendingFilterCommand = false;
sendingPublicCommand = true;
}
}
else if (sendingPublicCommand)
{
// Automatically input the command /public
gInputBuffer = "/public";
gInputWindowChanged = true;
CONSOLE_Draw();
// Simulate Enter key press
int c = 10; // LF character
// Process the input buffer as if Enter was pressed
if (c == 10 || c == 13)
{
string Command = gInputBuffer;
transform(Command.begin(), Command.end(), Command.begin(), (int(*)(int))tolower);
if (Command == "/public" || Command == "/publicon" || Command == "/public on" || Command == "/list" || Command == "/liston" || Command == "/list on")
{
gGProxy->m_BNET->SetListPublicGames(true);
CONSOLE_Print("[BNET] listing of public games enabled");
}
gInputBuffer.clear();
sendingPublicCommand = false;
commandsSent = true; // All commands sent
}
}
}Editor is loading...
Leave a Comment