Ejemplo n.º 1
0
int CServer::DelClientCallback(int ClientID, const char *pReason, void *pUser)
{
	CServer *pThis = (CServer *)pUser;

	NETADDR Addr = pThis->m_NetServer.ClientAddr(ClientID);
	char aAddrStr[NETADDR_MAXSTRSIZE];
	net_addr_str(&Addr, aAddrStr, sizeof(aAddrStr));
	char aBuf[256];
	str_format(aBuf, sizeof(aBuf), "client dropped. cid=%d addr=%s reason='%s'", ClientID, aAddrStr,	pReason);
	pThis->Console()->Print(IConsole::OUTPUT_LEVEL_ADDINFO, "server", aBuf);

	// notify the mod about the drop
	if(pThis->m_aClients[ClientID].m_State >= CClient::STATE_READY)
		pThis->GameServer()->OnClientDrop(ClientID, pReason);

	pThis->m_aClients[ClientID].m_State = CClient::STATE_EMPTY;
	pThis->m_aClients[ClientID].m_aName[0] = 0;
	pThis->m_aClients[ClientID].m_aClan[0] = 0;
	pThis->m_aClients[ClientID].m_Country = -1;
	pThis->m_aClients[ClientID].m_Authed = AUTHED_NO;
	pThis->m_aClients[ClientID].m_AuthTries = 0;
	pThis->m_aClients[ClientID].m_pRconCmdToSend = 0;
	pThis->m_aClients[ClientID].m_Snapshots.PurgeAll();
	return 0;
}
Ejemplo n.º 2
0
int CServer::DelClientCallback(int ClientId, const char *pReason, void *pUser)
{
	CServer *pThis = (CServer *)pUser;
	
	NETADDR Addr = pThis->m_NetServer.ClientAddr(ClientId);
	char aBuf[256];
	str_format(aBuf, sizeof(aBuf), "client dropped. cid=%d ip=%d.%d.%d.%d reason=\"%s\"",
		ClientId,
		Addr.ip[0], Addr.ip[1], Addr.ip[2], Addr.ip[3],
		pReason
	);
	pThis->Console()->Print(IConsole::OUTPUT_LEVEL_ADDINFO, "server", aBuf);

	// notify the mod about the drop
	if(pThis->m_aClients[ClientId].m_State >= CClient::STATE_READY)
		pThis->GameServer()->OnClientDrop(ClientId);
	
	pThis->m_aClients[ClientId].m_State = CClient::STATE_EMPTY;
	pThis->m_aClients[ClientId].m_aName[0] = 0;
	pThis->m_aClients[ClientId].m_aClan[0] = 0;
	pThis->m_aClients[ClientId].m_Authed = 0;
	pThis->m_aClients[ClientId].m_AuthTries = 0;
	pThis->m_aClients[ClientId].m_Snapshots.PurgeAll();
	return 0;
}
Ejemplo n.º 3
0
void CGameContext::ConLogOut(IConsole::IResult *pResult, void *pUserData)
{
	CGameContext *pSelf = (CGameContext *)pUserData;
	CServer* pServer = (CServer*)pSelf->Server();

	int Victim;
	if(pResult->NumArguments() == 0)
		Victim = pResult->m_ClientID;
	else
		Victim = pResult->GetInteger(0);

	if(!CheckRights(pResult->m_ClientID, Victim, (CGameContext *)pUserData))
		return;

	/*if (g_Config.m_SvRconScore)
		pSelf->m_apPlayers[Victim]->m_Score = 0;*/

	// logout from membertile
	pSelf->m_apPlayers[Victim]->m_IsMember = false;
	pSelf->m_apPlayers[Victim]->m_IsLoggedIn = false;

	// DDRace level reset
	pSelf->OnSetAuthed(Victim, pServer->AUTHED_NO);

	// from server.cpp
	if(pServer->m_aClients[Victim].m_State != CServer::CClient::STATE_EMPTY)
	{
		CMsgPacker Msg(NETMSG_RCON_AUTH_STATUS);
		Msg.AddInt(0);	//authed
		Msg.AddInt(0);	//cmdlist
		pServer->SendMsgEx(&Msg, MSGFLAG_VITAL, Victim, true);

		pServer->m_aClients[Victim].m_Authed = pServer->AUTHED_NO;
		pServer->m_aClients[Victim].m_pRconCmdToSend = 0;
		pServer->SendRconLine(Victim, "Logout successful.");
		char aBuf[32];
		str_format(aBuf, sizeof(aBuf), "ClientID=%d logged out", Victim);
		pServer->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "server", aBuf);
	}
}