Turk Yapti aq esp + aimbot
This script should not be not be installed directly. It is a library for other scripts to include with the meta directive // @require https://update.greasyfork.org/scripts/575338/1807932/Berkayin%20Aimbotu.js
// ==UserScript==
// @name Berkayin Aimbotu
// @namespace http://tampermonkey.net/
// @version 1.0.0
// @description Turk Yapti aq esp + aimbot
// @author You
// @match https://tribals.io/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=tribals.io
// @grant none
// @run-at document-end
// ==/UserScript==
console.log('[EVENT] Tribals Client Loaded v1.0.0');
/* Safe logging helper: stores simple debug messages locally */
function sendLogSafe(msg) {
try {
console.log('[HACK-LOG]', msg);
const key = 'tribals_cheat_logs_v1';
const logs = JSON.parse(localStorage.getItem(key) || '[]');
logs.push({ ts: Date.now(), text: String(msg) });
localStorage.setItem(key, JSON.stringify(logs.slice(-200)));
} catch (e) {
console.error('[HACK-LOG] failed', e);
}
}
/* UI HTML / CSS - Vanilla JS */
function initializeUI() {
// Create style element
const style = document.createElement('style');
style.textContent = `
#tribals-hack {
position: absolute;
top: 100px;
left: 15px;
z-index: 9999;
font-family: Arial, sans-serif;
cursor: move;
background-color: rgba(0, 0, 0, 0.0);
user-select: none;
}
#esp-status {
background-color: rgba(0, 0, 0, 0.3);
border: 2px solid #00ff00;
color: #00ff00;
font-size: 16px;
padding: 4px 10px;
border-radius: 5px;
box-shadow: 0 0 10px #00ff00;
display: inline-block;
font-weight: bold;
backdrop-filter: blur(3px);
}
#esp {
font-weight: bold;
}
`;
document.head.appendChild(style);
// Create UI element
const uiDiv = document.createElement('div');
uiDiv.id = 'tribals-hack';
uiDiv.innerHTML = '<p id="esp-status">ESP: <span id="esp">Disabled</span></p>';
document.body.appendChild(uiDiv);
// Make draggable
let isDragging = false;
let offsetX = 0;
let offsetY = 0;
uiDiv.addEventListener('mousedown', function(e) {
isDragging = true;
offsetX = e.clientX - uiDiv.offsetLeft;
offsetY = e.clientY - uiDiv.offsetTop;
e.preventDefault();
});
document.addEventListener('mousemove', function(e) {
if (!isDragging) return;
uiDiv.style.left = (e.clientX - offsetX) + 'px';
uiDiv.style.top = (e.clientY - offsetY) + 'px';
});
document.addEventListener('mouseup', function() {
isDragging = false;
});
// Key control: 'e' toggles ESP/Aimbot
document.addEventListener('keydown', function(e) {
if (e.key === 'e' || e.key === 'E') {
window.toggleESP();
const espText = document.getElementById('esp');
if (espText) {
espText.innerHTML = window.espEnabled ? 'Enabled' : 'Disabled';
espText.style.color = window.espEnabled ? '#00ff00' : 'red';
addGlowEffect(espText);
}
}
});
console.log('[UI] Initialized successfully');
}
function addGlowEffect(element) {
element.style.textShadow = window.espEnabled
? '0 0 5px #00ff00, 0 0 10px #00ff00, 0 0 20px #00ff00'
: '0 0 5px red, 0 0 10px red, 0 0 20px red';
}
// Initialize when DOM is ready
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', initializeUI);
} else {
initializeUI();
}
// ===================== ESP & AIMBOT =====================
window.tribals = {
players: [],
localPlayer: {},
espDelay: 16
};
window.espEnabled = false;
let espInterval;
let originalCameraState = null;
const AIMBOT_MAX_PITCH = (Math.PI / 2) - 0.01;
const RAD_TO_DEG = 180 / Math.PI;
function cloneQuat(quat) {
if (!quat) return null;
return {
x: Number(quat.x) || 0,
y: Number(quat.y) || 0,
z: Number(quat.z) || 0,
w: Number.isFinite(Number(quat.w)) ? Number(quat.w) : 1
};
}
function getAimNode(cameraEntity) {
if (!cameraEntity) return null;
if (typeof cameraEntity.setLocalEulerAngles === 'function' ||
typeof cameraEntity.setLocalRotation === 'function' ||
cameraEntity.quaternion) {
return cameraEntity;
}
if (cameraEntity.entity) {
return cameraEntity.entity;
}
if (cameraEntity.camera && cameraEntity.camera.entity) {
return cameraEntity.camera.entity;
}
return cameraEntity;
}
function getNodeWorldPosition(node) {
if (!node) return null;
if (typeof node.getPosition === 'function') {
return node.getPosition().clone();
}
if (node.position) {
return typeof node.position.clone === 'function'
? node.position.clone()
: { x: Number(node.position.x) || 0, y: Number(node.position.y) || 0, z: Number(node.position.z) || 0 };
}
if (node.entity) {
return getNodeWorldPosition(node.entity);
}
return null;
}
function getNodeLocalQuaternion(node) {
if (!node) return null;
if (typeof node.getLocalRotation === 'function') {
return cloneQuat(node.getLocalRotation());
}
if (node.quaternion) {
return cloneQuat(node.quaternion);
}
if (node.entity) {
return getNodeLocalQuaternion(node.entity);
}
return null;
}
function getNodeParentQuaternion(node) {
if (!node) return null;
const parent = node.parent || (node.entity && node.entity.parent) || (node.camera && node.camera.entity && node.camera.entity.parent);
if (!parent) return null;
if (typeof parent.getRotation === 'function') {
return cloneQuat(parent.getRotation());
}
if (parent.quaternion) {
return cloneQuat(parent.quaternion);
}
return null;
}
function setNodeLocalQuaternion(node, quat) {
if (!node || !quat) return false;
if (typeof node.setLocalEulerAngles === 'function') {
const forward = rotateVecByQuat({ x: 0, y: 0, z: -1 }, quat);
const pitch = Math.atan2(forward.y, Math.hypot(forward.x, forward.z));
const yaw = Math.atan2(-forward.x, -forward.z);
node.setLocalEulerAngles(pitch * RAD_TO_DEG, yaw * RAD_TO_DEG, 0);
return true;
}
if (typeof node.setLocalRotation === 'function' && window.pc && typeof window.pc.Quat === 'function') {
node.setLocalRotation(new window.pc.Quat(quat.x, quat.y, quat.z, quat.w));
return true;
}
if (node.quaternion) {
if (typeof node.quaternion.set === 'function') {
node.quaternion.set(quat.x, quat.y, quat.z, quat.w);
} else {
node.quaternion.x = quat.x;
node.quaternion.y = quat.y;
node.quaternion.z = quat.z;
node.quaternion.w = quat.w;
}
return true;
}
return false;
}
function normalizeVec3(vec) {
const length = Math.hypot(vec.x, vec.y, vec.z);
if (!length) return null;
return {
x: vec.x / length,
y: vec.y / length,
z: vec.z / length
};
}
function invertQuat(quat) {
const lengthSq = (quat.x * quat.x) + (quat.y * quat.y) + (quat.z * quat.z) + (quat.w * quat.w) || 1;
return {
x: -quat.x / lengthSq,
y: -quat.y / lengthSq,
z: -quat.z / lengthSq,
w: quat.w / lengthSq
};
}
function rotateVecByQuat(vec, quat) {
const qx = quat.x;
const qy = quat.y;
const qz = quat.z;
const qw = quat.w;
const vx = vec.x;
const vy = vec.y;
const vz = vec.z;
const ix = (qw * vx) + (qy * vz) - (qz * vy);
const iy = (qw * vy) + (qz * vx) - (qx * vz);
const iz = (qw * vz) + (qx * vy) - (qy * vx);
const iw = (-qx * vx) - (qy * vy) - (qz * vz);
return {
x: (ix * qw) + (iw * -qx) + (iy * -qz) - (iz * -qy),
y: (iy * qw) + (iw * -qy) + (iz * -qx) - (ix * -qz),
z: (iz * qw) + (iw * -qz) + (ix * -qy) - (iy * -qx)
};
}
function crossVec3(a, b) {
return {
x: (a.y * b.z) - (a.z * b.y),
y: (a.z * b.x) - (a.x * b.z),
z: (a.x * b.y) - (a.y * b.x)
};
}
function quatFromBasis(right, up, back) {
const m00 = right.x;
const m01 = up.x;
const m02 = back.x;
const m10 = right.y;
const m11 = up.y;
const m12 = back.y;
const m20 = right.z;
const m21 = up.z;
const m22 = back.z;
const trace = m00 + m11 + m22;
let x;
let y;
let z;
let w;
if (trace > 0) {
const s = Math.sqrt(trace + 1) * 2;
w = 0.25 * s;
x = (m21 - m12) / s;
y = (m02 - m20) / s;
z = (m10 - m01) / s;
} else if (m00 > m11 && m00 > m22) {
const s = Math.sqrt(1 + m00 - m11 - m22) * 2;
w = (m21 - m12) / s;
x = 0.25 * s;
y = (m01 + m10) / s;
z = (m02 + m20) / s;
} else if (m11 > m22) {
const s = Math.sqrt(1 + m11 - m00 - m22) * 2;
w = (m02 - m20) / s;
x = (m01 + m10) / s;
y = 0.25 * s;
z = (m12 + m21) / s;
} else {
const s = Math.sqrt(1 + m22 - m00 - m11) * 2;
w = (m10 - m01) / s;
x = (m02 + m20) / s;
y = (m12 + m21) / s;
z = 0.25 * s;
}
return cloneQuat({ x, y, z, w });
}
function quatFromLookDirection(direction) {
const forward = normalizeVec3(direction);
if (!forward) return null;
let right = normalizeVec3(crossVec3(forward, { x: 0, y: 1, z: 0 }));
if (!right) {
right = { x: 1, y: 0, z: 0 };
}
const up = normalizeVec3(crossVec3(right, forward)) || { x: 0, y: 1, z: 0 };
return quatFromBasis(right, up, {
x: -forward.x,
y: -forward.y,
z: -forward.z
});
}
function aimNodeAtTarget(cameraEntity, targetPosition) {
const aimNode = getAimNode(cameraEntity);
const worldPosition = getNodeWorldPosition(aimNode);
if (!aimNode || !worldPosition || !targetPosition) return false;
const worldDirection = normalizeVec3({
x: (Number(targetPosition.x) || 0) - worldPosition.x,
y: (Number(targetPosition.y) || 0) - worldPosition.y,
z: (Number(targetPosition.z) || 0) - worldPosition.z
});
if (!worldDirection) return false;
const parentQuat = getNodeParentQuaternion(aimNode);
const localDirection = parentQuat
? normalizeVec3(rotateVecByQuat(worldDirection, invertQuat(parentQuat)))
: worldDirection;
if (!localDirection) return false;
const pitch = Math.max(-AIMBOT_MAX_PITCH, Math.min(AIMBOT_MAX_PITCH, Math.atan2(localDirection.y, Math.hypot(localDirection.x, localDirection.z))));
const yaw = Math.atan2(-localDirection.x, -localDirection.z);
const clampedDirection = normalizeVec3({
x: -Math.sin(yaw) * Math.cos(pitch),
y: Math.sin(pitch),
z: -Math.cos(yaw) * Math.cos(pitch)
});
if (!clampedDirection) return false;
const localQuat = quatFromLookDirection(clampedDirection);
return setNodeLocalQuaternion(aimNode, localQuat);
}
const sym = Symbol('Local Player Hook');
Object.defineProperty(Object.prototype, 'isSleeping', {
set(data) {
this[sym] = data;
if (this.protected) {
window.tribals.localPlayer = this;
window.tribals.localPlayer.randomChecks = function () {};
}
if (this.username !== undefined) {
window.tribals.players.unshift({
username: this.username,
obj: this,
lastPosition: {
x: this.entity.position.x,
y: this.entity.position.y,
z: this.entity.position.z
},
lastMoveTime: Date.now()
});
}
}
});
window.getAllPlayers = function () {
let players = [];
window.tribals.players.forEach(plr => {
if (!players.some(p => p.username === plr.username)) {
players.unshift(plr);
}
});
return players;
};
window.toggleESP = function () {
window.espEnabled = !window.espEnabled;
if (window.espEnabled) {
const espCanvas = document.createElement('canvas');
espCanvas.id = 'espCanvas';
espCanvas.style.position = 'absolute';
espCanvas.style.top = '0';
espCanvas.style.left = '0';
espCanvas.style.zIndex = '2147483647';
espCanvas.style.pointerEvents = 'none';
document.body.appendChild(espCanvas);
const ctx = espCanvas.getContext('2d');
espInterval = setInterval(() => {
espCanvas.width = window.innerWidth;
espCanvas.height = window.innerHeight;
ctx.clearRect(0, 0, espCanvas.width, espCanvas.height);
// ESP drawing
window.getAllPlayers().forEach(plr => {
if (!plr.obj || !plr.obj.entity || !plr.obj.entity.position) return;
const currentPosition = plr.obj.entity.position;
const lastPosition = plr.lastPosition;
const distanceMoved = Math.hypot(
currentPosition.x - lastPosition.x,
currentPosition.y - lastPosition.y,
currentPosition.z - lastPosition.z
);
if (distanceMoved > 0) {
plr.lastMoveTime = Date.now();
plr.lastPosition = { ...currentPosition };
}
const timeSinceLastMove = Date.now() - plr.lastMoveTime;
if (timeSinceLastMove < 10000) {
if (!window.tribals.localPlayer || !window.tribals.localPlayer.cameraEntity) return;
const screen = window.tribals.localPlayer.cameraEntity.camera.worldToScreen(currentPosition.clone());
if (screen.z >= 1.0) {
const scale = 4 / screen.z;
const w = 60 * scale;
const h = 150 * scale;
const x = screen.x - w / 2;
const y = screen.y - h / 2;
ctx.shadowColor = 'cyan';
ctx.shadowBlur = 20;
ctx.strokeStyle = 'cyan';
ctx.lineWidth = 2;
ctx.strokeRect(x, y, w, h);
ctx.shadowBlur = 0;
ctx.font = 'bold 14px Arial';
ctx.fillStyle = 'cyan';
ctx.fillText(plr.username, screen.x - 30, screen.y - 30);
}
}
});
// ====== Aimbot logic ======
const centerX = window.innerWidth / 2;
const centerY = window.innerHeight / 2;
const radius = 120;
ctx.beginPath();
ctx.arc(centerX, centerY, radius, 0, 2 * Math.PI);
ctx.strokeStyle = 'yellow';
ctx.lineWidth = 2;
ctx.stroke();
let target = null;
let minDist = Infinity;
window.getAllPlayers().forEach(plr => {
if (!window.tribals.localPlayer) return;
if (plr.obj === window.tribals.localPlayer) return;
if (!plr.obj || !plr.obj.entity || !plr.obj.entity.position) return;
const screen = window.tribals.localPlayer.cameraEntity.camera.worldToScreen(plr.obj.entity.position.clone());
if (screen.z < 1.0) return;
const dx = screen.x - centerX;
const dy = screen.y - centerY;
const dist = Math.sqrt(dx*dx + dy*dy);
if (dist < radius && dist < minDist) {
target = plr;
minDist = dist;
}
});
const aimNode = getAimNode(window.tribals.localPlayer.cameraEntity);
if (target) {
if (!originalCameraState && aimNode) {
originalCameraState = {
quaternion: getNodeLocalQuaternion(aimNode)
};
}
aimNodeAtTarget(window.tribals.localPlayer.cameraEntity, target.obj.entity.position);
} else {
if (originalCameraState && aimNode && originalCameraState.quaternion) {
setNodeLocalQuaternion(aimNode, originalCameraState.quaternion);
originalCameraState = null;
}
}
}, window.tribals.espDelay);
sendLogSafe('ESP enabled');
} else {
clearInterval(espInterval);
const canvas = document.getElementById('espCanvas');
if (canvas) canvas.remove();
if (originalCameraState && window.tribals.localPlayer && window.tribals.localPlayer.cameraEntity) {
const aimNode = getAimNode(window.tribals.localPlayer.cameraEntity);
if (aimNode && originalCameraState.quaternion) {
setNodeLocalQuaternion(aimNode, originalCameraState.quaternion);
}
}
originalCameraState = null;
sendLogSafe('ESP disabled');
}
};