// ==UserScript==
// @name Survev-KrityHack
// @namespace https://github.com/Drino955/survev-krityhack
// @version 0.2.21
// @description Aimbot, xray, tracer, better zoom, smoke/obstacle opacity, autoloot, player names...
// @author KrityTeam
// @license GPL3
// @match *://survev.io/*
// @match *://resurviv.biz/*
// @match *://eu-comp.net/*
// @match *://zurviv.io/*
// @match *://50v50.online/*
// @match *://67.217.244.178/*
// @icon https://www.google.com/s2/favicons?domain=survev.io
// @run-at document-end
// @webRequest [{"selector":"*app-*.js","action":"cancel"}]
// @webRequest [{"selector":"*shared-*.js","action":"cancel"}]
// @grant GM_xmlhttpRequest
// @grant unsafeWindow
// @grant GM_setValue
// @grant GM_getValue
// @require https://cdnjs.cloudflare.com/ajax/libs/pixi.js/7.0.3/pixi.min.js
// @homepageURL https://github.com/Drino955/survev-krityhack
// @updateURL https://raw.githubusercontent.com/Drino955/survev-krityhack/main/krityhack.user.js
// @downloadURL https://raw.githubusercontent.com/Drino955/survev-krityhack/main/krityhack.user.js
// @supportURL https://github.com/Drino955/survev-krityhack/issues
// ==/UserScript==
(function () {
'use strict';
function alertMsgAndcleanPage(){
const not_supported_msg = `This extension is not supported, install the "Tamperokey Legacy MV2", NOT "TamperMonkey"!!!
And check that you have not installed the script for "Tampermonkey", the script needs to be installed ONLY for "Tamperokey Legacy MV2"!!!`;
alert(not_supported_msg);
unsafeWindow.stop();
document.write(not_supported_msg);
}
if (typeof GM_info !== 'undefined' && GM_info.scriptHandler === 'Tampermonkey') {
if (GM_info.version <= '5.1.1' || GM_info.userAgentData.brands[0].brand == 'Firefox') {
console.log('The script is launched at Tampermonkey Legacy');
} else {
alertMsgAndcleanPage();
}
} else {
console.log('The script is not launched at Tampermonkey');
alertMsgAndcleanPage();
}
// colors
const GREEN = 0x00ff00;
const BLUE = 0x00f3f3;
const RED = 0xff0000;
const WHITE = 0xffffff;
// tampermonkey
const version = GM_info.script.version;
const newFeaturesKey = `newFeaturesShown_${version}`;
const newFeaturesShown = GM_getValue(newFeaturesKey, false);
if (!newFeaturesShown) {
const message = `
🎉 What's New:
- 🌐 Script now works on all survev forks
- 🕹️ Added a cheats menu that activates with the ESC key
- 🔫 New "UseOneGun" feature, you can lock the weapon and shoot only from it using autoswitch. When you have a shotgun and a rifle, and the enemy is far away, it is useful to lock the rifle and shoot at them.
- 📈 Increased objects on the map
- 🔦 Fixed bugs with the flashlight(laser a.k.a blue/grey wide lines), it will no longer remain on the map
- 🛡️ Protection against installing the wrong Tampermonkey extension
- 🛠️ AimBot works by default on downed players
- 🛠️ Refactored code (useful for developers)
- 🚀 Added runtime code injection to avoid DMCA bans on platforms like GitHub and GreasyFork
📢 Subscribe to our Telegram channel and group, as GitHub and GreasyFork have banned us, and the Discord server might be next. Telegram is a safer platform for this kind of content and cheats. Plus, the author loves Telegram.
`;
const overlay = document.createElement('div');
overlay.style.position = 'fixed';
overlay.style.top = '0';
overlay.style.left = '0';
overlay.style.width = '100%';
overlay.style.height = '100%';
overlay.style.backgroundColor = 'rgba(0, 0, 0, 0.75)';
overlay.style.zIndex = '999';
const notification = document.createElement('div');
notification.innerHTML = message;
notification.style.position = 'fixed';
notification.style.top = '50%';
notification.style.left = '50%';
notification.style.transform = 'translate(-50%, -50%)';
notification.style.backgroundColor = 'rgb(20, 20, 20)';
notification.style.color = '#fff';
notification.style.padding = '20px';
notification.style.boxShadow = '0 0 10px rgba(0, 0, 0, 0.5)';
notification.style.zIndex = '1000';
notification.style.borderRadius = '10px';
notification.style.maxWidth = '500px';
notification.style.width = '80%';
notification.style.textAlign = 'center';
notification.style.fontSize = '17px';
notification.style.overflow = 'auto';
notification.style.maxHeight = '90%';
notification.style.margin = '10px';
const closeButton = document.createElement('button');
closeButton.textContent = 'Close';
closeButton.style.margin = '20px auto 0 auto';
closeButton.style.padding = '10px 20px';
closeButton.style.border = 'none';
closeButton.style.backgroundColor = '#007bff';
closeButton.style.color = '#fff';
closeButton.style.borderRadius = '5px';
closeButton.style.cursor = 'pointer';
closeButton.style.display = 'block';
closeButton.addEventListener('click', () => {
document.body.removeChild(notification);
document.body.removeChild(overlay);
GM_setValue(newFeaturesKey, true);
});
notification.appendChild(closeButton);
document.body.appendChild(overlay);
document.body.appendChild(notification);
}
let state = {
isAimBotEnabled: true,
isAimAtKnockedOutEnabled: true,
get aimAtKnockedOutStatus() {
return this.isAimBotEnabled && this.isAimAtKnockedOutEnabled;
},
isZoomEnabled: true,
isMeleeAttackEnabled: true,
get meleeStatus() {
return this.isAimBotEnabled && this.isMeleeAttackEnabled;
},
isSpinBotEnabled: false,
isAutoSwitchEnabled: true,
isUseOneGunEnabled: false,
focusedEnemy: null,
get focusedEnemyStatus() {
return this.isAimBotEnabled && this.focusedEnemy;
},
isXrayEnabled: true,
friends: [],
lastFrames: {},
enemyAimBot: null,
isLaserDrawerEnabled: true,
isLineDrawerEnabled: true,
isNadeDrawerEnabled: true,
isOverlayEnabled: true,
};
//loladk fucks up anticheat :DDDD
setInterval(() => {
const element = document.querySelector('div[style="position: fixed; top: 0px; left: 0px; width: 100%; height: 100%; background-color: black; z-index: 999999; display: block;"]');
if (element) element.remove();
}, 1000);
function getTeam(player) {
return Object.keys(game.playerBarn.teamInfo).find(team => game.playerBarn.teamInfo[team].playerIds.includes(player.__id));
}
function findWeap(player) {
const weapType = player.netData.activeWeapon;
return weapType && unsafeWindow.guns[weapType] ? unsafeWindow.guns[weapType] : null;
}
function findBullet(weapon) {
return weapon ? unsafeWindow.bullets[weapon.bulletType] : null;
}
const overlay = document.createElement('div');
overlay.className = 'krity-overlay';
const krityTitle = document.createElement('h3');
krityTitle.className = 'krity-title';
krityTitle.innerText = `KrityHack ${version}`;
const aimbotDot = document.createElement('div');
aimbotDot.className = 'aimbotDot';
function updateOverlay() {
overlay.innerHTML = ``;
const controls = [
[ '[B] AimBot:', state.isAimBotEnabled, state.isAimBotEnabled ? 'ON' : 'OFF' ],
[ '[Z] Zoom:', state.isZoomEnabled, state.isZoomEnabled ? 'ON' : 'OFF' ],
[ '[M] MeleeAtk:', state.meleeStatus, state.meleeStatus ? 'ON' : 'OFF' ],
[ '[Y] SpinBot:', state.isSpinBotEnabled, state.isSpinBotEnabled ? 'ON' : 'OFF' ],
[ '[T] FocusedEnemy:', state.focusedEnemyStatus, state.focusedEnemy?.nameText?._text ? state.focusedEnemy?.nameText?._text : 'OFF' ],
[ '[V] UseOneGun:', state.isUseOneGunEnabled, state.isUseOneGunEnabled ? 'ON' : 'OFF' ],
];
controls.forEach((control, index) => {
let [name, isEnabled, optionalText] = control;
const text = `${name} ${optionalText}`;
const line = document.createElement('p');
line.className = 'krity-control';
line.style.opacity = isEnabled ? 1 : 0.5;
line.textContent = text;
overlay.appendChild(line);
});
}
function overlayToggle(){
state.isOverlayEnabled = !state.isOverlayEnabled;
overlay.style.display = state.isOverlayEnabled ? 'block' : 'none';
}
document.querySelector('#ui-game').append(overlay);
document.querySelector('#ui-top-left').insertBefore(krityTitle, document.querySelector('#ui-top-left').firstChild);
document.querySelector('#ui-game').append(aimbotDot);
function aimBot() {
if (!state.isAimBotEnabled) return;
const players = unsafeWindow.game.playerBarn.playerPool.pool;
const me = unsafeWindow.game.activePlayer;
try {
const meTeam = getTeam(me);
let enemy = null;
let minDistanceToEnemyFromMouse = Infinity;
if (state.focusedEnemy && state.focusedEnemy.active && !state.focusedEnemy.netData.dead) {
enemy = state.focusedEnemy;
}else {
if (state.focusedEnemy){
state.focusedEnemy = null;
updateOverlay();
}
players.forEach((player) => {
// We miss inactive or dead players
if (!player.active || player.netData.dead || (!state.isAimAtKnockedOutEnabled && player.downed) || me.__id === player.__id || me.layer !== player.layer || getTeam(player) == meTeam || state.friends.includes(player.nameText._text)) return;
const screenPlayerPos = unsafeWindow.game.camera.pointToScreen({x: player.pos._x, y: player.pos._y});
// const distanceToEnemyFromMouse = Math.hypot(screenPlayerPos.x - unsafeWindow.game.input.mousePos._x, screenPlayerPos.y - unsafeWindow.game.input.mousePos._y);
const distanceToEnemyFromMouse = (screenPlayerPos.x - unsafeWindow.game.input.mousePos._x) ** 2 + (screenPlayerPos.y - unsafeWindow.game.input.mousePos._y) ** 2;
if (distanceToEnemyFromMouse < minDistanceToEnemyFromMouse) {
minDistanceToEnemyFromMouse = distanceToEnemyFromMouse;
enemy = player;
}
});
}
if (enemy) {
const meX = me.pos._x;
const meY = me.pos._y;
const enemyX = enemy.pos._x;
const enemyY = enemy.pos._y;
const distanceToEnemy = Math.hypot(meX - enemyX, meY - enemyY);
// const distanceToEnemy = (meX - enemyX) ** 2 + (meY - enemyY) ** 2;
if (enemy != state.enemyAimBot) {
state.enemyAimBot = enemy;
state.lastFrames[enemy.__id] = [];
}
const predictedEnemyPos = calculatePredictedPosForShoot(enemy, me);
if (!predictedEnemyPos) return;
unsafeWindow.lastAimPos = {
clientX: predictedEnemyPos.x,
clientY: predictedEnemyPos.y,
};
// AutoMelee
if(state.isMeleeAttackEnabled && distanceToEnemy <= 8) {
const moveAngle = calcAngle(enemy.pos, me.pos) + Math.PI;
unsafeWindow.aimTouchMoveDir = {
x: Math.cos(moveAngle),
y: Math.sin(moveAngle),
};
unsafeWindow.aimTouchDistanceToEnemy = distanceToEnemy;
}else {
unsafeWindow.aimTouchMoveDir = null;
unsafeWindow.aimTouchDistanceToEnemy = null;
}
if (aimbotDot.style.left !== predictedEnemyPos.x + 'px' || aimbotDot.style.top !== predictedEnemyPos.y + 'px') {
aimbotDot.style.left = predictedEnemyPos.x + 'px';
aimbotDot.style.top = predictedEnemyPos.y + 'px';
aimbotDot.style.display = 'block';
}
}else {
unsafeWindow.aimTouchMoveDir = null;
unsafeWindow.lastAimPos = null;
aimbotDot.style.display = 'none';
}
} catch (error) {
console.error("Error in aimBot:", error);
}
}
function aimBotToggle(){
state.isAimBotEnabled = !state.isAimBotEnabled;
if (state.isAimBotEnabled) return;
aimbotDot.style.display = 'None';
unsafeWindow.lastAimPos = null;
unsafeWindow.aimTouchMoveDir = null;
}
function meleeAttackToggle(){
state.isMeleeAttackEnabled = !state.isMeleeAttackEnabled;
if (state.isMeleeAttackEnabled) return;
unsafeWindow.aimTouchMoveDir = null;
}
function calculatePredictedPosForShoot(enemy, curPlayer) {
if (!enemy || !curPlayer) {
console.log("Missing enemy or player data");
return null;
}
const { pos: enemyPos } = enemy;
const { pos: curPlayerPos } = curPlayer;
const dateNow = performance.now();
if ( !(enemy.__id in state.lastFrames) ) state.lastFrames[enemy.__id] = [];
state.lastFrames[enemy.__id].push([dateNow, { ...enemyPos }]);
if (state.lastFrames[enemy.__id].length < 30) {
console.log("Insufficient data for prediction, using current position");
return unsafeWindow.game.camera.pointToScreen({x: enemyPos._x, y: enemyPos._y});
}
if (state.lastFrames[enemy.__id].length > 30){
state.lastFrames[enemy.__id].shift();
}
const deltaTime = (dateNow - state.lastFrames[enemy.__id][0][0]) / 1000; // Time since last frame in seconds
const enemyVelocity = {
x: (enemyPos._x - state.lastFrames[enemy.__id][0][1]._x) / deltaTime,
y: (enemyPos._y - state.lastFrames[enemy.__id][0][1]._y) / deltaTime,
};
const weapon = findWeap(curPlayer);
const bullet = findBullet(weapon);
let bulletSpeed;
if (!bullet) {
bulletSpeed = 1000;
}else {
bulletSpeed = bullet.speed;
}
// Quadratic equation for time prediction
const vex = enemyVelocity.x;
const vey = enemyVelocity.y;
const dx = enemyPos._x - curPlayerPos._x;
const dy = enemyPos._y - curPlayerPos._y;
const vb = bulletSpeed;
const a = vb ** 2 - vex ** 2 - vey ** 2;
const b = -2 * (vex * dx + vey * dy);
const c = -(dx ** 2) - (dy ** 2);
let t;
if (Math.abs(a) < 1e-6) {
console.log('Linear solution bullet speed is much greater than velocity');
t = -c / b;
} else {
const discriminant = b ** 2 - 4 * a * c;
if (discriminant < 0) {
console.log("No solution, shooting at current position");
return unsafeWindow.game.camera.pointToScreen({x: enemyPos._x, y: enemyPos._y});
}
const sqrtD = Math.sqrt(discriminant);
const t1 = (-b - sqrtD) / (2 * a);
const t2 = (-b + sqrtD) / (2 * a);
t = Math.min(t1, t2) > 0 ? Math.min(t1, t2) : Math.max(t1, t2);
}
if (t < 0) {
console.log("Negative time, shooting at current position");
return unsafeWindow.game.camera.pointToScreen({x: enemyPos._x, y: enemyPos._y});
}
// console.log(`A bullet with the enemy will collide through ${t}`)
const predictedPos = {
x: enemyPos._x + vex * t,
y: enemyPos._y + vey * t,
};
return unsafeWindow.game.camera.pointToScreen(predictedPos);
}
function calcAngle(playerPos, mePos){
const dx = mePos._x - playerPos._x;
const dy = mePos._y - playerPos._y;
return Math.atan2(dy, dx);
}
// Создание элемента с заданными стилями
function createElement(tag, styles = {}, innerHTML = '') {
const element = document.createElement(tag);
Object.assign(element.style, styles);
element.innerHTML = innerHTML;
return element;
}
function updateButtonColors() {
const buttons = uiContainer.querySelectorAll('div[data-stateName]');
buttons.forEach(button => {
const stateName = button.getAttribute('data-stateName');
const role = button.getAttribute('data-role');
const isEnabled = state[stateName];
button.style.color = isEnabled && role === 'sub' ? '#a8a922' : isEnabled ? 'white' : '#3e3e3e';
});
}
// Создание кнопки функции
function createFeatureButton(name, clickHandler, stateName, role='sup') {
let button;
if (role === 'sup'){
button = createElement('div', {
fontFamily: 'Open Sans, sans-serif',
fontSize: '18px',
color: 'white',
textAlign: 'left',
cursor: 'pointer',
}, name);
}else if(role === 'sub'){
button = createElement('div', {
fontFamily: 'Open Sans, sans-serif',
fontSize: '16px',
color: '#a8a922',
textAlign: 'left',
paddingLeft: '14px',
cursor: 'pointer',
}, name);
}else {
throw new Error('Invalid role specified for feature button');
}
button.setAttribute('data-stateName', stateName);
button.setAttribute('data-role', role);
button.addEventListener('click', () => {
clickHandler();
updateOverlay();
updateButtonColors();
});
return button;
}
// Создание контейнера UI
const uiContainer = createElement('div', {
maxWidth: '400px',
maxHeight: '400px',
width: '30%',
height: '60%',
overflow: 'auto',
backgroundColor: '#010302',
borderRadius: '10px',
position: 'fixed',
left: '15px',
top: '50%',
transform: 'translateY(-50%)',
display: 'none',
zIndex: 2147483647,
userSelect: 'none',
transition: 'transform 0.2s ease-in-out'
});
uiContainer.addEventListener('mouseenter', () => {
unsafeWindow.game.inputBinds.menuHovered = true;
});
uiContainer.addEventListener('mouseleave', () => {
unsafeWindow.game.inputBinds.menuHovered = false;
});
// Создание заголовка
const headerSection = createElement('div', {
width: '100%',
backgroundColor: '#3e3e3e'
});
const headerText = createElement('div', {
fontFamily: 'Open Sans, sans-serif',
fontSize: '18px',
color: 'white',
textAlign: 'left',
padding: '10px 20px',
lineHeight: '100%'
}, `KrityHack v${version}`);
headerSection.appendChild(headerText);
// Создание содержимого
const bodyContent = createElement('div', {
padding: '12px 20px',
color: 'white',
fontFamily: 'Open Sans, sans-serif'
});
// Создание кнопок функций
const featureAimbot = createFeatureButton('AimBot', aimBotToggle, 'isAimBotEnabled');
/*
const meleeAttackText = createElement('div', {
fontFamily: 'Open Sans, sans-serif',
fontSize: '16px',
color: '#a8a922',
textAlign: 'left',
paddingLeft: '37px',
display: 'block',
transform: 'translateY(-2px)',
textTransform: 'lowercase',
transition: 'color 0.3s ease, transform 0.2s ease'
}, 'Melee Attack:');
const meleeAttackStatusText = createElement('span', {
fontFamily: 'Open Sans, sans-serif',
fontSize: '16px',
color: '#545d67',
paddingLeft: '3px'
}, state.isMeleeAttackEnabled ? ' on' : ' off');
meleeAttackText.appendChild(meleeAttackStatusText);
meleeAttackText.addEventListener('click', () => {
meleeAttackText.style.transform = 'scale(1.1)';
setTimeout(() => {
meleeAttackText.style.transform = 'scale(1)';
}, 200);
if (state.isMeleeAttackEnabled) {
meleeAttackStatusText.innerHTML = ' off';
meleeAttackToggle();
meleeAttackStatusText.style.color = '#d9534f';
} else {
meleeAttackStatusText.innerHTML = ' on';
state.isMeleeAttackEnabled = !state.isMeleeAttackEnabled;
meleeAttackStatusText.style.color = '#545d67';
}
});
*/
const featureTracers = createFeatureButton('Tracers', () => {
state.isLineDrawerEnabled = !state.isLineDrawerEnabled;
state.isNadeDrawerEnabled = !state.isNadeDrawerEnabled;
state.isLaserDrawerEnabled = !state.isLaserDrawerEnabled;
}, 'isLineDrawerEnabled');
const featureFlashlight = createFeatureButton('Flashlight', () => {
state.isLaserDrawerEnabled = !state.isLaserDrawerEnabled;
}, 'isLaserDrawerEnabled', 'sub');
const featureZoom = createFeatureButton('Zoom', () => {
state.isZoomEnabled = !state.isZoomEnabled;
}, 'isZoomEnabled');
const featureAimAtDowned = createFeatureButton('Aim at Downed', () => {
state.isAimAtKnockedOutEnabled = !state.isAimAtKnockedOutEnabled;
}, 'aimAtKnockedOutStatus', 'sub');
const featureMeleeAttack = createFeatureButton('Melee Attack', meleeAttackToggle, 'meleeStatus', 'sub');
const featureSpinBot= createFeatureButton('SpinBot', () => {
state.isSpinBotEnabled = !state.isSpinBotEnabled;
}, 'isSpinBotEnabled');
const featureUseOneGun = createFeatureButton('UseOneGun', () => {
state.isUseOneGunEnabled = !state.isUseOneGunEnabled;
}, 'isUseOneGunEnabled');
const featureOverlay = createFeatureButton('Overlay', overlayToggle, 'isOverlayEnabled');
// document.addEventListener('click', event => {
// const button = event.target.closest('[data-ice-feature-handler]');
// console.log('btn', button);
// if (button) {
// const currentColor = unsafeWindow.getComputedStyle(button).color;
// button.style.color = currentColor === 'rgb(255, 255, 255)' ? '#3e3e3e' : 'white';
// const handler = button.dataset.iceFeatureHandler;
// eval(handler);
// // if (typeof window[handler] === 'function') {
// // window[handler]();
// // }
// }
// });
uiContainer.appendChild(headerSection);
bodyContent.appendChild(featureAimbot);
bodyContent.appendChild(featureAimAtDowned);
bodyContent.appendChild(featureMeleeAttack);
// bodyContent.appendChild(meleeAttackText);
bodyContent.appendChild(featureZoom);
bodyContent.appendChild(featureTracers);
bodyContent.appendChild(featureFlashlight);
bodyContent.appendChild(featureSpinBot);
bodyContent.appendChild(featureUseOneGun);
bodyContent.appendChild(featureOverlay);
uiContainer.appendChild(bodyContent);
document.body.appendChild(uiContainer);
updateButtonColors();
function syncMenuVisibility() {
const gameMenu = document.getElementById('ui-game-menu');
if (gameMenu) {
const displayStyle = gameMenu.style.display;
uiContainer.style.display = displayStyle;
}
}
// Создаем наблюдатель за изменениями атрибутов
const observer = new MutationObserver(syncMenuVisibility);
// Начинаем наблюдение за изменениями атрибутов у элемента #ui-game-menu
const gameMenu = document.getElementById('ui-game-menu');
if (gameMenu) {
observer.observe(gameMenu, { attributes: true, attributeFilter: ['style'] });
}
// Добавление стилей анимации
const styleSheet = createElement('style');
styleSheet.innerHTML = `
@keyframes fadeIn {
0% { opacity: 0; }
100% { opacity: 1; }
}`;
document.head.appendChild(styleSheet);
class GameMod {
constructor() {
this.lastFrameTime = performance.now();
this.frameCount = 0;
this.fps = 0;
this.kills = 0;
this.setAnimationFrameCallback();
if (unsafeWindow.location.hostname !== 'resurviv.biz' && unsafeWindow.location.hostname !== 'zurviv.io' && unsafeWindow.location.hostname !== 'eu-comp.net'){
// cause they have fps counter, etc...
this.initCounter("fpsCounter");
this.initCounter("pingCounter");
this.initCounter("killsCounter");
}
this.initMenu(); // left menu in lobby page
this.initRules(); // right menu in lobby page
this.setupWeaponBorderHandler();
}
initCounter(id) {
this[id] = document.createElement("div");
this[id].id = id;
Object.assign(this[id].style, {
color: "white",
backgroundColor: "rgba(0, 0, 0, 0.2)",
padding: "5px 10px",
marginTop: "10px",
borderRadius: "5px",
fontFamily: "Arial, sans-serif",
fontSize: "14px",
zIndex: "10000",
pointerEvents: "none",
});
const uiTopLeft = document.getElementById("ui-top-left");
// const uiTeam = document.getElementById("ui-team");
if (uiTopLeft) {
// if (uiTeam) {
// uiTopLeft.insertBefore(this[id], uiTeam);
// uiTeam.style.marginTop = '20px';
// } else {
uiTopLeft.appendChild(this[id]);
// }
}
}
setAnimationFrameCallback() {
this.animationFrameCallback = (callback) => setTimeout(callback, 1);
}
getKills() {
const killElement = document.querySelector(
".ui-player-kills.js-ui-player-kills",
);
if (killElement) {
const kills = parseInt(killElement.textContent, 10);
return isNaN(kills) ? 0 : kills;
}
return 0;
}
startPingTest() {
const currentUrl = unsafeWindow.location.href;
const isSpecialUrl = /\/#\w+/.test(currentUrl);
const teamSelectElement = document.getElementById("team-server-select");
const mainSelectElement = document.getElementById("server-select-main");
const region =
isSpecialUrl && teamSelectElement
? teamSelectElement.value
: mainSelectElement
? mainSelectElement.value
: null;
if (region && region !== this.currentServer) {
this.currentServer = region;
this.resetPing();
let servers = unsafeWindow.servers;
if (!servers) return;
const selectedServer = servers.find(
(server) => region.toUpperCase() === server.region.toUpperCase(),
);
if (selectedServer) {
this.pingTest = new PingTest(selectedServer);
this.pingTest.startPingTest();
} else {
this.resetPing();
}
}
}
resetPing() {
if (this.pingTest && this.pingTest.test.ws) {
this.pingTest.test.ws.close();
this.pingTest.test.ws = null;
}
this.pingTest = null;
}
updateHealthBars() {
const healthBars = document.querySelectorAll("#ui-health-container");
healthBars.forEach((container) => {
const bar = container.querySelector("#ui-health-actual");
if (bar) {
const width = Math.round(parseFloat(bar.style.width));
let percentageText = container.querySelector(".health-text");
if (!percentageText) {
percentageText = document.createElement("span");
percentageText.classList.add("health-text");
Object.assign(percentageText.style, {
width: "100%",
textAlign: "center",
marginTop: "5px",
color: "#333",
fontSize: "20px",
fontWeight: "bold",
position: "absolute",
zIndex: "10",
});
container.appendChild(percentageText);
}
percentageText.textContent = `${width}%`;
}
});
}
updateBoostBars() {
const boostCounter = document.querySelector("#ui-boost-counter");
if (boostCounter) {
const boostBars = boostCounter.querySelectorAll(
".ui-boost-base .ui-bar-inner",
);
let totalBoost = 0;
const weights = [25, 25, 40, 10];
boostBars.forEach((bar, index) => {
const width = parseFloat(bar.style.width);
if (!isNaN(width)) {
totalBoost += width * (weights[index] / 100);
}
});
const averageBoost = Math.round(totalBoost);
let boostDisplay = boostCounter.querySelector(".boost-display");
if (!boostDisplay) {
boostDisplay = document.createElement("div");
boostDisplay.classList.add("boost-display");
Object.assign(boostDisplay.style, {
position: "absolute",
bottom: "75px",
right: "335px",
color: "#FF901A",
backgroundColor: "rgba(0, 0, 0, 0.4)",
padding: "5px 10px",
borderRadius: "5px",
fontFamily: "Arial, sans-serif",
fontSize: "14px",
zIndex: "10",
textAlign: "center",
});
boostCounter.appendChild(boostDisplay);
}
boostDisplay.textContent = `AD: ${averageBoost}%`;
}
}
setupWeaponBorderHandler() {
const weaponContainers = Array.from(
document.getElementsByClassName("ui-weapon-switch"),
);
weaponContainers.forEach((container) => {
if (container.id === "ui-weapon-id-4") {
container.style.border = "3px solid #2f4032";
} else {
container.style.border = "3px solid #FFFFFF";
}
});
const weaponNames = Array.from(
document.getElementsByClassName("ui-weapon-name"),
);
weaponNames.forEach((weaponNameElement) => {
const weaponContainer = weaponNameElement.closest(".ui-weapon-switch");
const observer = new MutationObserver(() => {
const weaponName = weaponNameElement.textContent.trim();
let border = "#FFFFFF";
switch (weaponName.toUpperCase()) {
//yellow
case "CZ-3A1": case "G18C": case "M9": case "M93R": case "MAC-10": case "MP5": case "P30L": case "DUAL P30L": case "UMP9": case "VECTOR": case "VSS": case "FLAMETHROWER": border = "#FFAE00"; break;
//blue
case "AK-47": case "OT-38": case "OTS-38": case "M39 EMR": case "DP-28": case "MOSIN-NAGANT": case "SCAR-H": case "SV-98": case "M1 GARAND": case "PKP PECHENEG": case "AN-94": case "BAR M1918": case "BLR 81": case "SVD-63": case "M134": case "GROZA": case "GROZA-S": border = "#007FFF"; break;
//green
case "FAMAS": case "M416": case "M249": case "QBB-97": case "MK 12 SPR": case "M4A1-S": case "SCOUT ELITE": case "L86A2": border = "#0f690d"; break;
//red
case "M870": case "MP220": case "SAIGA-12": case "SPAS-12": case "USAS-12": case "SUPER 90": case "LASR GUN": case "M1100": border = "#FF0000"; break;
//purple
case "MODEL 94": case "PEACEMAKER": case "VECTOR (.45 ACP)": case "M1911": case "M1A1": border = "#800080"; break;
//black
case "DEAGLE 50": case "RAINBOW BLASTER": border = "#000000"; break;
//olive
case "AWM-S": case "MK 20 SSR": border = "#808000"; break;
//brown
case "POTATO CANNON": case "SPUD GUN": border = "#A52A2A"; break;
//other Guns
case "FLARE GUN": border = "#FF4500"; break; case "M79": border = "#008080"; break; case "HEART CANNON": border = "#FFC0CB"; break;
default: border = "#FFFFFF"; break; }
if (weaponContainer.id !== "ui-weapon-id-4") {
weaponContainer.style.border = `3px solid ${border}`;
}
});
observer.observe(weaponNameElement, {
childList: true,
characterData: true,
subtree: true,
});
});
}
//menu
initMenu() {
const middleRow = document.querySelector("#start-row-top");
Object.assign(middleRow.style, {
display: "flex",
flexDirection: "row",
});
const menu = document.createElement("div");
menu.id = "KrityHack";
Object.assign(menu.style, {
backgroundColor: "rgba(0, 0, 0, 0.5)",
padding: "15px",
borderRadius: "10px",
boxShadow: "0 4px 10px rgba(0, 0, 0, 0.3)",
fontFamily: "Arial, sans-serif",
fontSize: "18px",
color: "#fff",
maxWidth: "300px",
height: "100%",
// maxHeight: "320px",
overflowY: "auto",
// marginTop: "20px",
marginRight: "30px",
boxSizing: "border-box",
});
const title = document.createElement("h2");
title.textContent = "Social networks";
title.className = 'news-header';
Object.assign(title.style, {
margin: "0 0 10px",
fontSize: "20px",
});
menu.append(title);
const description = document.createElement("p");
description.className = "news-paragraph";
description.style.fontSize = "14px";
description.innerHTML = `⭐ Star us on GitHub
📢 Join our Telegram group
🎮 Join our Discord server`;
menu.append(description);
const createSocialLink = (text) => {
const a = document.createElement("a");
a.textContent = `${text}`;
a.target = "_blank";
Object.assign(a.style, {
display: "block",
border: "none",
color: "#fff",
padding: "10px",
borderRadius: "5px",
marginBottom: "10px",
fontSize: "15px",
lineHeight: "14px",
cursor: "pointer",
textAlign: "center",
textDecoration: "none",
});
return a;
};
const githubLink = createSocialLink("");
githubLink.style.backgroundColor = "#0c1117";
githubLink.href = "https://github.com/Drino955/survev-krityhack";
githubLink.innerHTML = ` KrityHack`;
menu.append(githubLink);
const telegramLink = createSocialLink("");
telegramLink.style.backgroundColor = "#00a8e6";
telegramLink.href = "https://t.me/krityteam";
telegramLink.innerHTML = ` KrityTeam`;
menu.append(telegramLink);
const discordLink = createSocialLink("");
discordLink.style.backgroundColor = "#5865F2";
discordLink.href = "https://discord.gg/wPuvEySg3E";
discordLink.innerHTML = ` [HACK] League of Hackers`;
menu.append(discordLink);
const additionalDescription = document.createElement("p");
additionalDescription.className = "news-paragraph";
additionalDescription.style.fontSize = "14px";
additionalDescription.innerHTML = `Your support helps us develop the project and provide better updates!`;
menu.append(additionalDescription);
const leftColumn = document.querySelector('#left-column');
leftColumn.innerHTML = ``;
leftColumn.style.marginTop = "10px";
leftColumn.style.marginBottom = "27px";
leftColumn.append(menu);
this.menu = menu;
}
initRules() {
const newsBlock = document.querySelector("#news-block");
newsBlock.innerHTML = `
After installing the cheat, you can use the following features and hotkeys:
For more details, visit the GitHub page and join our Telegram group or Discord.