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

Tibia Anti-Idle

Notoriouss

New Member
Joined
Nov 7, 2009
Messages
12
Reaction score
0
Location
Brazil
Made for fun, good for studying Windows API
Btw, it only works on Windows ...

The inexistence of the Tibia window will not stop it but it will only works on the opened Tibia window

And there's no way to stop it, unfortunately you'll have to close it at the Task Manager, due to the command Sleep that lock the console and makes impossible to detect a key press at the right time

Code:
#include <iostream>
#define _WIN32_WINNT 0x0500
#include <windows.h>
using namespace std;

const int CONST_DIR_DELAY 500
enum DIRS_T
{
    DIR_LEFT = VK_LEFT,
    DIR_UP = VK_UP,
    DIR_RIGHT = VK_RIGHT,
    DIR_DOWN = VK_DOWN   
};

HWND GetTibiaWindow()
{
    HWND Tibia = FindWindow(NULL, "Tibia");
    return Tibia;  
}

bool SetPlayerDirection(DIRS_T Dir)
{
    HWND Tibia = GetTibiaWindow();
    if (Tibia != NULL)     
        if (PostMessage(Tibia, WM_KEYDOWN, VK_CONTROL, 0) && PostMessage(Tibia, WM_KEYDOWN, Dir, 0))
            return true;
    
    return false;
}

void MovePlayer()
{
    for (UINT Dir = DIR_LEFT; Dir <= DIR_DOWN; Dir++)
    {
        SetPlayerDirection((DIRS_T)Dir);
        Sleep(CONST_DIR_DELAY);
    }
}

bool IsStringNumber(string Str) { return (atoi(Str.c_str()) != 0); }
int GetIntervalInput()
{
    string Interval;
    while (!IsStringNumber(Interval)) {
        cout << "Type the interval in seconds: ";
        cin >> Interval; 
        system("CLS");
    }
    return atoi(Interval.c_str());
}

int main(int argc, char *argv[])
{
    SetConsoleTitle("Notorious Anti-Idle");
    int Interval = GetIntervalInput();
    ShowWindow( GetConsoleWindow(), SW_HIDE );
    SwitchToThisWindow( GetTibiaWindow(), true );

    while (true) 
    {
        Sleep(Interval*1000);
        MovePlayer();  
    }

    return true;
}

Improvements are welcome
 
Last edited:
Back
Top