void CookieManager::Unload() { /* If clients are connected we should try save their data */ for (int i = playerhelpers->GetMaxClients()+1; --i > 0;) { if (connected[i]) OnClientDisconnecting(i); } /* Find all cookies and delete them */ for (size_t iter = 0; iter < cookieList.length(); ++iter) delete cookieList[iter]; cookieList.clear(); }
void CookieManager::Unload() { /* If clients are connected we should try save their data */ int maxclients = playerhelpers->GetMaxClients(); for (int i=1; i<=maxclients; i++) { if (connected[i]) { OnClientDisconnecting(i); } } /* Find all cookies and delete them */ SourceHook::List<Cookie *>::iterator _iter; Cookie *current; _iter = cookieList.begin(); while (_iter != cookieList.end()) { current = (Cookie *)*_iter; if (current == NULL) { _iter++; continue; } g_ClientPrefs.cookieMutex->Lock(); if (current->usedInQuery) { current->shouldDelete = true; g_ClientPrefs.cookieMutex->Unlock(); } else { g_ClientPrefs.cookieMutex->Unlock(); delete current; } _iter = cookieList.erase(_iter); } }
void CHookManager::OnPluginUnloaded(IPlugin *plugin) { if (!PRCH_enabled) return; if (!PRCH_used) return; if (m_usercmdsFwd->GetFunctionCount()) return; int MaxClients = playerhelpers->GetMaxClients(); for (int i = 1; i <= MaxClients; i++) { if (playerhelpers->GetGamePlayer(i)->IsInGame()) { OnClientDisconnecting(i); } } PRCH_used = false; }