struct stConnectInfo
{
DWORD dwTimer = 0;
//TODO: прикрутить список серверов
} ConnectInfo;
void RejTimer()
{
if (ConnectInfo.dwTimer == 0)
return;
if (ConnectInfo.dwTimer > GetTickCount())
return;
SF->getSAMP()->getInfo()->RestartGame();
SF->getSAMP()->getInfo()->iGameState = GAMESTATE_WAIT_CONNECT;
ConnectInfo.dwTimer = 0;
}
void CALLBACK Reconnect(int KeyClicked)
{
std::string nick = MENU.connects->InputBoxes->GetInputBoxText(0);
if (nick.length() > 3 && nick.length() < 26)
SF->getSAMP()->getPlayers()->SetLocalPlayerName(nick.c_str());
SF->getSAMP()->disconnect(100);
ConnectInfo.dwTimer = atoi(MENU.connects->InputBoxes->GetInputBoxText(1).c_str()) * 1000 + GetTickCount();
}
void ConnectsInit()
{
MENU.connects = new Menu("Подключения", -1, -1, 500, 200, 0xDD202040, -1, false);
MENU.connects->Elements->AddElement("Ник:", 5, 5, NULL);
MENU.connects->InputBoxes->AddInputBox(45, 5, 450);
//MENU.connects->InputBoxes->SetInputBoxText(0, SF->getSAMP()->getPlayers()->pszLocalPlayerName);
MENU.connects->Elements->AddElement("Задержка:", 5, 25, NULL);
MENU.connects->InputBoxes->AddInputBox(95, 25, 400);
MENU.connects->InputBoxes->SetInputBoxText(1, "15");
MENU.connects->Elements->AddElement("{0080FF}Реконнект", 5, 40, Reconnect);
}