hartority Posted May 21, 2017 Posted May 21, 2017 (edited) Привет, я представляю вам мой скрипт, который делает нейм тег, бар жизней и брони похожими на GTA:Online. Для начала создадим переменные для настройки нейм тегов. const maxDistance = 25*25; const width = 0.03; const height = 0.0065; const border = 0.001; const color = [255,255,255,255]; Теперь отключим дефолтные нейм теги. mp.nametags.enabled = false; Далее нарисуем наши нейм теги. mp.events.add('render', (nametags) => { const graphics = mp.game.graphics; const screenRes = graphics.getScreenResolution(0, 0); nametags.forEach(nametag => { let [player, x, y, distance] = nametag; if(distance <= maxDistance) { let scale = (distance / maxDistance); if(scale < 0.6) scale = 0.6; var health = player.getHealth(); health = health < 100 ? 0 : ((health - 100) / 100); var armour = player.getArmour() / 100; y -= scale * (0.005 * (screenRes.y / 1080)); graphics.drawText(player.name.replace('_', ' '), 4, color, 0.4, 0.4, true, x, y); if(mp.game.player.isFreeAimingAtEntity(player.handle)) { let y2 = y + 0.042; if(armour > 0) { let x2 = x - width / 2 - border / 2; graphics.drawRect(x2, y2, width + border * 2, 0.0085, 0, 0, 0, 200); graphics.drawRect(x2, y2, width, height, 150, 150, 150, 255); graphics.drawRect(x2 - width / 2 * (1 - health), y2, width * health, height, 255, 255, 255, 200); x2 = x + width / 2 + border / 2; graphics.drawRect(x2, y2, width + border * 2, height + border * 2, 0, 0, 0, 200); graphics.drawRect(x2, y2, width, height, 41, 66, 78, 255); graphics.drawRect(x2 - width / 2 * (1 - armour), y2, width * armour, height, 48, 108, 135, 200); } else { graphics.drawRect(x, y2, width + border * 2, height + border * 2, 0, 0, 0, 200); graphics.drawRect(x, y2, width, height, 150, 150, 150, 255); graphics.drawRect(x - width / 2 * (1 - health), y2, width * health, height, 255, 255, 255, 200); } } } }) }) Этот скрипт необходимо положить в папку client_packages и подключить в index.js. Edited May 21, 2017 by HarrWe 1
Meido no Hitsuji Posted May 24, 2017 Posted May 24, 2017 В 21.05.2017 в 19:39, kemperrr сказал: ONLY 0.2 !!! Ну что так плохо то? Зачем тогда его выкладывать сейчас? Или это намёк?
hartority Posted May 24, 2017 Author Posted May 24, 2017 (edited) 12 часа назад, Meido no Hitsuji сказал: Ну что так плохо то? Зачем тогда его выкладывать сейчас? Или это намёк? Это не намёк, выложили сейчас чтобы как только 0.2 вышел, люди сразу могли найти нормальные гайды и примеры. Edited May 24, 2017 by HarrWe 1
hartority Posted June 1, 2017 Author Posted June 1, 2017 6 минут назад, imalik сказал: and where should this client_packages be placed? Wait 0.2
imalik Posted June 1, 2017 Posted June 1, 2017 i am trying to make a lan server where we can play, i was able to run the default server files and people could connect. i downloaded the freeroam project by N1ks and tried to launch the server but i kept getting these messages
hartority Posted June 1, 2017 Author Posted June 1, 2017 59 минут назад, imalik сказал: i am trying to make a lan server where we can play, i was able to run the default server files and people could connect. i downloaded the freeroam project by N1ks and tried to launch the server but i kept getting these messages It do not work on 0.1.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now