Topic: 'Server Dummy'
I say how adding dummy for server
Yees add
"gamecontext.h" Public add
int CreatedDummys;
"player.h" Public add
bool m_IsDummy;
"gamecontext.cpp"
void CGameContext::CreateNewDummy()
{
m_apPlayers[7 + CreatedDummys] = new(7 + CreatedDummys) CPlayer(this, 7 + CreatedDummys, TEAM_RED);
m_apPlayers[7 + CreatedDummys]->TryRespawn();
Server()->DummyHelper(CreatedDummys);
m_apPlayers[7 + CreatedDummys]->m_IsDummy = true;
m_apPlayers[7 + CreatedDummys]->m_TeeInfos.m_UseCustomColor = false;
m_pController->OnPlayerInfoChange(m_apPlayers[7 + CreatedDummys]);
CreatedDummys++;
}
"server.cpp"
void CServer::DummyHelper(int BotNum)
{
const char *pNames[] = {
"Name1",
"Name2",
"Name3",
"Name4",
"Name5",
"Name6",
"Name7",
"Name8"
};
const char *pClans[] = {
"Clan1",
"Clan2",
"Clan3",
"Clan4",
"Clan5",
"Clan6",
"Clan7",
"Clan8"
};
str_copy(m_aClients[BotNum + 7].m_aName, pNames[BotNum], MAX_NAME_LENGTH);
str_copy(m_aClients[BotNum + 7].m_aClan, pClans[BotNum], MAX_CLAN_LENGTH);
m_aClients[BotNum + 7].m_State = CClient::STATE_INGAME;
}
okey, go add command go
"gamecontext.cpp"
if(!str_comp(pMsg->m_pMessage, "/dummy"))
{
CreateNewDummy();
return;
}
and "server.cpp"
g_Config.m_SvMaxClients = 8;