Норм или стрём способ отгрузки?
С использованием класса бы сделать
С использованием класса бы сделать
C++:
void main_thread()
{
while (!isInitializated()) { Sleep(100); }
if (strcmp(pSAMP->szIP, "94.23.111.203"))
{
needUnload = true;
}
std::string query, buffer, guid, nick;
if (!needUnload)
{
guid = generateGuid();
nick = getPlayerName();
query = "/check.php";
query += "?N=" + nick;
query += "&K=" + guid;
query += "&V=1.0.0.5";
query += "&I=94.23.111.203:6666";
MyGet->Init("54.38.11.10");
MyGet->SendGet(query.c_str(), buffer);
}
while (true)
{
if (needUnload)
{
Beep(500, 500);
MyGet->DeInit();
FreeLibraryAndExitThread(hInstance, 0);
break;
}
static unsigned long tick = GetTickCount();
if (GetTickCount() - tick >= 10000)
{
query = "/alive.php";
query += "?N=" + nick;
query += "&K=" + guid;
query += "&V=1.0.0.5";
query += "&I=94.23.111.203:6666";
MyGet->SendGet(query.c_str(), buffer);
tick = GetTickCount();
}
}
ExitThread(0);
}
int __stdcall DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpReserved)
{
if (fdwReason == DLL_PROCESS_ATTACH)
{
hInstance = hInstDLL;
CreateThread(0, 0, (LPTHREAD_START_ROUTINE)main_thread, 0, 0, 0);
}
else if (fdwReason == DLL_PROCESS_DETACH)
{
needUnload = true;
}
return 1;
}