Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Issues with new UrbanTerror43 ESP (help)

 
Post new topic   This topic is locked: you cannot edit posts or make replies.    Cheat Engine Forum Index -> General Gamehacking
View previous topic :: View next topic  
Author Message
drxxmz
How do I cheat?
Reputation: 0

Joined: 21 Jan 2025
Posts: 2

PostPosted: Mon Jan 27, 2025 9:29 am    Post subject: Issues with new UrbanTerror43 ESP (help) Reply with quote

Don't know what happenned to the other script i uploaded, it reverted back to a old game that i wasnt even fucking trying to upload when i went to copy it, the problem im having with my new script is that the esp worldtoscreen is totally off or in the right order:

Code:

#include <iostream>
#include <Windows.h>
#include <TlHelp32.h>
#include <iomanip>
#define PI 3.1415927f

struct Vector2 { float x, y; };
struct Vector3 { float x, y, z; };
struct Vector4 { float x, y, z, w; };
float viewMatrix[4][3];

DWORD GetProcessId(const char* processName) {
    HANDLE snapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
    PROCESSENTRY32 processEntry;
    processEntry.dwSize = sizeof(PROCESSENTRY32);

    if (Process32First(snapshot, &processEntry)) {
        do {
            if (!_stricmp(processEntry.szExeFile, processName)) {
                std::cout << "Process found: " << processEntry.szExeFile
                    << " (PID: " << processEntry.th32ProcessID << ")" << std::endl;
                CloseHandle(snapshot);
                return processEntry.th32ProcessID;
            }
        } while (Process32Next(snapshot, &processEntry));
    }

    std::cerr << "Process not found: " << processName << std::endl;
    CloseHandle(snapshot);
    return 0;
}
Vector2 WorldToScreen(const Vector3& playerPos, float viewMatrix[4][3], int screenWidth, int screenHeight) {
    // Calculate transformed coordinates using the view matrix (4x3)
    float transformedX = playerPos.x * viewMatrix[0][0] +
        playerPos.y * viewMatrix[1][0] +
        playerPos.z * viewMatrix[2][0] +
        viewMatrix[3][0]; // Translation from last column

    float transformedY = playerPos.x * viewMatrix[0][1] +
        playerPos.y * viewMatrix[1][1] +
        playerPos.z * viewMatrix[2][1] +
        viewMatrix[3][1];

    float transformedZ = playerPos.x * viewMatrix[0][2] +
        playerPos.y * viewMatrix[1][2] +
        playerPos.z * viewMatrix[2][2] +
        viewMatrix[3][2];

    // Debugging output for transformedZ
    std::cout << "Transformed Z: " << transformedZ << std::endl;

    // Perspective division check
    if (transformedZ < 0.1f) return { -1, -1 }; // Avoid division by zero or negative depth

    // Normalize x and y by z
    transformedX /= transformedZ;
    transformedY /= transformedZ;

    // Map to screen coordinates
    float screenX = (transformedX * 0.5f + 0.5f) * screenWidth; // Convert from normalized device coordinates to screen space
    float screenY = (0.5f - transformedY * 0.5f) * screenHeight; // Invert Y for screen coordinates

    return { screenX, screenY };
}

void DrawESP(HDC hdc, Vector3 screenPos) {
    HPEN pen = CreatePen(PS_SOLID, 2, RGB(255, 0, 0));
    HGDIOBJ oldPen = SelectObject(hdc, pen);

    Rectangle(hdc,
        screenPos.x - 25,
        screenPos.y - 25,
        screenPos.x + 25,
        screenPos.y + 25
    );

    SelectObject(hdc, oldPen);
    DeleteObject(pen);
}

int main() {
    const char* processName = "Quake3-UrT.exe";
    DWORD processId = GetProcessId(processName);

    if (!processId) {
        std::cerr << "Failed to get process ID" << std::endl;
        return 1;
    }

    HANDLE processHandle = OpenProcess(PROCESS_VM_READ, FALSE, processId);
    if (!processHandle) {
        std::cerr << "Failed to open process. Error: " << GetLastError() << std::endl;
        return 1;
    }

    HWND gameWindow = FindWindowA(NULL, "Quake3-UrT");
    if (!gameWindow) {
        std::cerr << "Game window not found" << std::endl;
        CloseHandle(processHandle);
        return 1;
    }

    HDC gameDC = GetDC(gameWindow);
    if (!gameDC) {
        std::cerr << "Failed to get DC. Error: " << GetLastError() << std::endl;
        CloseHandle(processHandle);
        return 1;
    }

    DWORD viewMatrixAddress = 0xC7CA50;

    while (true) {
        ReadProcessMemory(processHandle, (LPVOID)0x0102521C, &viewMatrix, sizeof(viewMatrix), NULL);
        Vector2 ScreenPos = WorldToScreen({ 100,100,100 }, viewMatrix, 1024, 768);
        std::cout << ScreenPos.x << " : " << ScreenPos.y << "\n";
        DrawESP(gameDC, {ScreenPos.x, ScreenPos.y, 0});
        Sleep(1);
    }

    ReleaseDC(gameWindow, gameDC);
    CloseHandle(processHandle);

    return 0;
}


reps to anybody who can fix or literally just give me a reply... most of yall antisocial as a motherfucker or cannot read

youll have to fill in the view amtrix address manually but its easy unless ur a skid
Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8585
Location: 127.0.0.1

PostPosted: Mon Jan 27, 2025 1:33 pm    Post subject: Reply with quote

We do not support online/multiplayer hacking on this site.
https://forum.cheatengine.org/faq.php#0

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   This topic is locked: you cannot edit posts or make replies.    Cheat Engine Forum Index -> General Gamehacking All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites