| 493 | } |
| 494 | |
| 495 | bool PlayerManager::OnClientConnect(edict_t *pEntity, const char *pszName, const char *pszAddress, char *reject, int maxrejectlen) |
| 496 | { |
| 497 | int client = IndexOfEdict(pEntity); |
| 498 | CPlayer *pPlayer = &m_Players[client]; |
| 499 | ++m_PlayersSinceActive; |
| 500 | |
| 501 | if (pPlayer->IsConnected()) |
| 502 | { |
| 503 | if (sm_debug_connect.GetBool()) |
| 504 | { |
| 505 | const char *pAuth = pPlayer->GetAuthString(false); |
| 506 | if (pAuth == NULL) |
| 507 | { |
| 508 | pAuth = ""; |
| 509 | } |
| 510 | |
| 511 | logger->LogMessage("\"%s<%d><%s><>\" was already connected to the server.", pPlayer->GetName(), pPlayer->GetUserId(), pAuth); |
| 512 | } |
| 513 | |
| 514 | OnClientDisconnect(pPlayer->GetEdict()); |
| 515 | OnClientDisconnect_Post(pPlayer->GetEdict()); |
| 516 | } |
| 517 | |
| 518 | pPlayer->Initialize(pszName, pszAddress, pEntity); |
| 519 | |
| 520 | /* Get the client's language */ |
| 521 | if (m_QueryLang) |
| 522 | { |
| 523 | #if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_BLADE || SOURCE_ENGINE == SE_MCV |
| 524 | pPlayer->m_LangId = translator->GetServerLanguage(); |
| 525 | #else |
| 526 | const char *name; |
| 527 | if (!pPlayer->IsFakeClient() && (name=engine->GetClientConVarValue(client, "cl_language"))) |
| 528 | { |
| 529 | unsigned int langid; |
| 530 | pPlayer->m_LangId = (translator->GetLanguageByName(name, &langid)) ? langid : translator->GetServerLanguage(); |
| 531 | |
| 532 | OnClientLanguageChanged(client, pPlayer->m_LangId); |
| 533 | } else { |
| 534 | pPlayer->m_LangId = translator->GetServerLanguage(); |
| 535 | } |
| 536 | #endif |
| 537 | pPlayer->m_OriginalLangId = pPlayer->m_LangId; |
| 538 | } |
| 539 | |
| 540 | List<IClientListener *>::iterator iter; |
| 541 | IClientListener *pListener = NULL; |
| 542 | for (iter=m_hooks.begin(); iter!=m_hooks.end(); iter++) |
| 543 | { |
| 544 | pListener = (*iter); |
| 545 | if (!pListener->InterceptClientConnect(client, reject, maxrejectlen)) |
| 546 | { |
| 547 | RETURN_META_VALUE(MRES_SUPERCEDE, false); |
| 548 | } |
| 549 | } |
| 550 | |
| 551 | cell_t res = 1; |
| 552 |
nothing calls this directly
no test coverage detected