1 (edited by nozimc159 2016-10-14 18:48:21)

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;

2

Re: 'Server Dummy'

You should maybe state from where you got this, since you aren't the author of all that.

I'll quickly do that for you... http://teeworlds-friends.de/Forum/index … tID=172171

3

Re: 'Server Dummy'

Yea, that is some really old code I wrote? What's the issue with it?

Real programmers don't comment their code - it was hard to write, it should be hard to understand.
Proudly verkeckt since 2010.

4

Re: 'Server Dummy'

I have something relevant to this thread as well:
Stable dummies by Pikotee:
https://github.com/Shahan/teeworlds/com … bc77668bdd
And one more commit: https://github.com/Shahan/teeworlds/com … ddf967ac91

5

Re: 'Server Dummy'

Error compiling can help me?
skype: lololoshara.her