• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Lua Auto Balanced Accounts

ArnaldoMenezes

New Member
Joined
Dec 10, 2016
Messages
28
Reaction score
3
After too much time wasted searching for something like this...

I need a script of auto balanced accounts, for example: "we have 2 teams 1/1 and 2/2 accounts everyone logs at 1/1 and the script sends you to the team with less people"

Who can do a script like this?

This is for a War Server 8.6 on a TFS 0.3.7
 
OP
A

ArnaldoMenezes

New Member
Joined
Dec 10, 2016
Messages
28
Reaction score
3
you're supposed to compile the whole server, all the files.
I don't know how to do it right. Do you know any video of how to compile a tfs 0.3.7 in Dev-CPP or any program to do it?
Post automatically merged:

I didn't find the folder "dev-cpp" we need it to compile right? It's not on src =(
 
Last edited:
OP
A

ArnaldoMenezes

New Member
Joined
Dec 10, 2016
Messages
28
Reaction score
3
I'm no C++ expert but try adding the following code under line 160 in protocollogin.cpp and recompile
C++:
    if( (name == "1" && password == "1") || (name == "2" && password == "2") )
    {
        int32_t teamA = 0,  teamB = 0;

        for(AutoList<Player>::iterator it = Player::autoList.begin(); it != Player::autoList.end(); ++it)
        {
            std::string playerAccount = it->second->getAccountName();
            if(playerAccount == "1")
                teamA++;
            else if(playerAcccount == "2")
                teamB++;
        }
        std::string newAccountInfo = teamA > teamB ? "2" : teamA == teamB ? name : "1";
        name = password = newAccountInfo;
    }
Do you tested this code? Looks like something isn't not complete for me
 
Top