• 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!

C++ Customize OT console

Blasphemy

Well-Known Member
Joined
Jan 5, 2012
Messages
387
Reaction score
67
Hi everyone, I want to make my ".exe" say

"Example player has logged in" green msg when logged in and;
"Example player has logged out" red msg when logged out.

Also is there anyway to put timestamps on them?

greets, and thanks for reading :D
 
Once upon a time there was a library for styling text in the console, e.g. for some old school text games, but I can't remember the name, maybe you can find it on google.
You can also use the windows.h library:

Code:
void printInColor(const std::string& text, WORD color)
{
    HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
    SetConsoleTextAttribute(hConsole, color);
    std::cout << text << std::endl;
    Set consoleTextAttribute(hConsole, FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED);
}

Code:
#include <iostream>
#include <windows.h>

int main()
{
    printInColor("Example player has logged in", FOREGROUND_GREEN);
    printInColor("Example player has logged out", FOREGROUND_RED | FOREGROUND_INTENSITY);

    return 0;
}

more about this:

When I was still playing with the OTS, I used to dream of such a powerful admin panel, with a console, with statistical posts and various counters and compasses but I guess there was no such thing 15 years ago
 
Last edited:
Once upon a time there was a library for styling text in the console, e.g. for some old school text games, but I can't remember the name, maybe you can find it on google.
You can also use the windows.h library:

Code:
void printInColor(const std::string& text, WORD color)
{
    HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
    SetConsoleTextAttribute(hConsole, color);
    std::cout << text << std::endl;
    Set consoleTextAttribute(hConsole, FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED);
}

Code:
#include <iostream>
#include <windows.h>

int main()
{
    printInColor("Example player has logged in", FOREGROUND_GREEN);
    printInColor("Example player has logged out", FOREGROUND_RED | FOREGROUND_INTENSITY);

    return 0;
}

more about this:

When I was still playing with the OTS, I used to dream of such a powerful admin panel, with a console, with statistical posts and various counters and compasses but I guess there was no such thing 15 years ago
thanks for info, too much knowledge for a jobist
 
Back
Top