[İSTEK] nametag

0 Üye ve 1 Ziyaretçi konuyu incelemekte.

Çevrimdışı feyzo

  • Yeni Üye
  • *
    • İleti: 53
: 27 Aralık 2019, 13:47:18
Merabalar Ben Name Tagımı Kendim De Görmek İstiyor Böyle Kendi Görebilecegim Name Taglar Mevcutmudur
 


MTASATURK

[İSTEK] nametag
« : 27 Aralık 2019, 13:47:18 »

Çevrimdışı Mahlukat

  • Uzman Üye
  • *
    • İleti: 637
Yanıtla #1 : 27 Aralık 2019, 13:50:30
kullandığının kodlarını at ayarlim
Linki görebilmek için Kayıt olun yada Giriş yapın.
 


Çevrimdışı feyzo

  • Yeni Üye
  • *
    • İleti: 53
Yanıtla #2 : 27 Aralık 2019, 14:11:28
Kod

local function getPlayerCustomName(player) -- ИМЯ ФАМИЛИЯ
local FIRST_NAME = getElementData(player, "Name") --свою переменную
local LAST_NAME = getElementData(player, "Familia")--свою переменную

if not FIRST_NAME or not LAST_NAME then
return getPlayerName(player)
end

return tostring(FIRST_NAME.." "..LAST_NAME)
end


local drawDistance = 70 --меняйте на свое значение - если нужно!
g_StreamedInPlayers = {}


function drawHPBar(x, y, v, d)
  if v < 0 then
    v = 0
  elseif v > 100 then
    v = 100
  end
  dxDrawRectangle(x - 21, y, 42, 5, tocolor(0, 0, 0, 255 - d))
  dxDrawRectangle(x - 20, y + 1, v / 2.5, 3, tocolor((100 - v) * 2.55, v * 2.55, 0, 255 - d))
end


function drawArmourBar(x, y, v, d)
  if v < 0 then
    v = 0
  elseif v > 100 then
    v = 100
  end
  dxDrawRectangle(x - 21, y, 42, 5, tocolor(0, 0, 0, 255 - d))
  dxDrawRectangle(x - 20, y + 1, v / 2.5, 3, tocolor(255, 255, 255, 255 - d))
end


function drawHud()
  healthColor = tocolor(0, 0, 0, 255)
  healthbgColor = tocolor(255, 151, 0, 127)
  healthfgColor = tocolor(255, 151, 0, 185)
  sx, sy = guiGetScreenSize()
  healthx = sx / 800 * 683
  healthy = sy / 600 * 89
  healthxoverlay = sx / 800 * 685
  healthyoverlay = sy / 600 * 91
  vehiclehealthx = sx / 800 * 619
  vehiclehealthy = sy / 600 * 169
  vehiclehealthxoverlay = sx / 800 * 621
  vehiclehealthyoverlay = sy / 600 * 171
  if not normalhealthbar then
    local health = getElementHealth(getLocalPlayer())
    local armour = getPedArmor(getLocalPlayer())
    local rate = 500 / getPedStat(getLocalPlayer(), 24)
    if getElementHealth(getLocalPlayer()) == 0 then
      if 500 > getTickCount() - visibleTick then
        do
          local healthRelative = health * rate / 100
          local v = health * rate
          dxDrawRectangle(healthx, healthy, 76, 12, healthColor, false)
          dxDrawRectangle(healthxoverlay, healthyoverlay, 72, 8, tocolor((100 - v) * 2.55, v * 2.55, 0, 127), false)
          dxDrawRectangle(healthxoverlay, healthyoverlay, 72 * healthRelative, 8, tocolor((100 - v) * 2.55, v * 2.55, 0, 185), false)
        end
      elseif getTickCount() - visibleTick >= 1000 then
        visibleTick = getTickCount()
      end
    else
      local healthRelative = health * rate / 100
      local v = health * rate
      dxDrawRectangle(healthx, healthy, 76, 12, healthColor, false)
      dxDrawRectangle(healthxoverlay, healthyoverlay, 72, 8, tocolor((100 - v) * 2.55, v * 2.55, 0, 127), false)
      dxDrawRectangle(healthxoverlay, healthyoverlay, 72 * healthRelative, 8, tocolor((100 - v) * 2.55, v * 2.55, 0, 185), false)
    end
  end
end


function unfuck(text)
  return string.gsub(text, "(#%x%x%x%x%x%x)", function(colorString)
    return ""
  end)
end


function onClientRender()
  local cx, cy, cz, lx, ly, lz = getCameraMatrix()
  for k, player in pairs(g_StreamedInPlayers) do
    if isElement(player) and isElementStreamedIn(player) then
      do
        local vx, vy, vz = getPedBonePosition(player, 8)
        local dist = getDistanceBetweenPoints3D(cx, cy, cz, vx, vy, vz)
        if dist < drawDistance and isLineOfSightClear(cx, cy, cz, vx, vy, vz, true, false, false) then
          local x, y = getScreenFromWorldPosition(vx, vy, vz + 0.3)
          if x and y then
            local name = getPlayerName(player)
            local name2 = unfuck(getPlayerName(player))
            local w = dxGetTextWidth(name, 1, "default-bold")
            local h = dxGetFontHeight(1, "default-bold")
            dxDrawText(name2, x - 1 - w / 2, y - 1 - h - 12, w, h, tocolor(0, 0, 0), 1, "default-bold")
            dxDrawColorText(name, x - w / 2, y - h - 12, w, h, tocolor(getPlayerNametagColor(player)), 1, "default-bold")
            local health = getElementHealth(player)
            local armour = getPedArmor(player)
            if health > 0 then
              local rate = 500 / getPedStat(player, 24)
              drawHPBar(x, y - 6, health * rate, dist)
              if armour > 0 then
                drawArmourBar(x, y - 12, armour, dist)
              end
            end
          end
        end
      end
    else
      table.remove(g_StreamedInPlayers, k)
    end
  end
end
addEventHandler("onClientRender", root, onClientRender)


function onClientElementStreamIn()
  if getElementType(source) == "player" and source ~= getLocalPlayer() then
    setPlayerNametagShowing(source, false)
    table.insert(g_StreamedInPlayers, source)
  end
end
addEventHandler("onClientElementStreamIn", root, onClientElementStreamIn)


function onClientResourceStart(startedResource)
  visibleTick = getTickCount()
  counter = 0
  normalhealthbar = false
  local players = getElementsByType("player")
  for k, v in pairs(players) do
    if isElementStreamedIn(v) and v ~= getLocalPlayer() then
      setPlayerNametagShowing(v, false)
      table.insert(g_StreamedInPlayers, v)
    end
  end
end
addEventHandler("onClientResourceStart", resourceRoot, onClientResourceStart)


function dxDrawColorText(str, ax, ay, bx, by, color, scale, font)
  local pat = "(.-)#(%x%x%x%x%x%x)"
  local s, e, cap, col = str:find(pat, 1)
  local last = 1
  while s do
    if cap == "" and col then
      color = tocolor(tonumber("0x" .. col:sub(1, 2)), tonumber("0x" .. col:sub(3, 4)), tonumber("0x" .. col:sub(5, 6)), 255)
    end
    if s ~= 1 or cap ~= "" then
      local w = dxGetTextWidth(cap, scale, font)
      dxDrawText(cap, ax, ay, ax + w, by, color, scale, font)
      ax = ax + w
      color = tocolor(tonumber("0x" .. col:sub(1, 2)), tonumber("0x" .. col:sub(3, 4)), tonumber("0x" .. col:sub(5, 6)), 255)
    end
    last = e + 1
    s, e, cap, col = str:find(pat, last)
  end
  if last <= #str then
    cap = str:sub(last)
    local w = dxGetTextWidth(cap, scale, font)
    dxDrawText(cap, ax, ay, ax + w, by, color, scale, font)
  end
end

Linki görebilmek için Kayıt olun yada Giriş yapın.  can barıda gözükürmü bunda can barıda var sanırım

indirme siteside burası  Linki görebilmek için Kayıt olun yada Giriş yapın.
« Son Düzenleme: 27 Aralık 2019, 14:14:40 Gönderen: feyzo »
 


Çevrimdışı Mahlukat

  • Uzman Üye
  • *
    • İleti: 637
Yanıtla #3 : 27 Aralık 2019, 14:50:49
Kod
local function getPlayerCustomName(player) -- ИМЯ ФАМИЛИЯ
local FIRST_NAME = getElementData(player, "Name") --свою переменную
local LAST_NAME = getElementData(player, "Familia")--свою переменную

if not FIRST_NAME or not LAST_NAME then
return getPlayerName(player)
end

return tostring(FIRST_NAME.." "..LAST_NAME)
end


local drawDistance = 70 --меняйте на свое значение - если нужно!
g_StreamedInPlayers = {}


function drawHPBar(x, y, v, d)
  if v < 0 then
    v = 0
  elseif v > 100 then
    v = 100
  end
  dxDrawRectangle(x - 21, y, 42, 5, tocolor(0, 0, 0, 255 - d))
  dxDrawRectangle(x - 20, y + 1, v / 2.5, 3, tocolor((100 - v) * 2.55, v * 2.55, 0, 255 - d))
end


function drawArmourBar(x, y, v, d)
  if v < 0 then
    v = 0
  elseif v > 100 then
    v = 100
  end
  dxDrawRectangle(x - 21, y, 42, 5, tocolor(0, 0, 0, 255 - d))
  dxDrawRectangle(x - 20, y + 1, v / 2.5, 3, tocolor(255, 255, 255, 255 - d))
end


function drawHud()
  healthColor = tocolor(0, 0, 0, 255)
  healthbgColor = tocolor(255, 151, 0, 127)
  healthfgColor = tocolor(255, 151, 0, 185)
  sx, sy = guiGetScreenSize()
  healthx = sx / 800 * 683
  healthy = sy / 600 * 89
  healthxoverlay = sx / 800 * 685
  healthyoverlay = sy / 600 * 91
  vehiclehealthx = sx / 800 * 619
  vehiclehealthy = sy / 600 * 169
  vehiclehealthxoverlay = sx / 800 * 621
  vehiclehealthyoverlay = sy / 600 * 171
  if not normalhealthbar then
    local health = getElementHealth(getLocalPlayer())
    local armour = getPedArmor(getLocalPlayer())
    local rate = 500 / getPedStat(getLocalPlayer(), 24)
    if getElementHealth(getLocalPlayer()) == 0 then
      if 500 > getTickCount() - visibleTick then
        do
          local healthRelative = health * rate / 100
          local v = health * rate
          dxDrawRectangle(healthx, healthy, 76, 12, healthColor, false)
          dxDrawRectangle(healthxoverlay, healthyoverlay, 72, 8, tocolor((100 - v) * 2.55, v * 2.55, 0, 127), false)
          dxDrawRectangle(healthxoverlay, healthyoverlay, 72 * healthRelative, 8, tocolor((100 - v) * 2.55, v * 2.55, 0, 185), false)
        end
      elseif getTickCount() - visibleTick >= 1000 then
        visibleTick = getTickCount()
      end
    else
      local healthRelative = health * rate / 100
      local v = health * rate
      dxDrawRectangle(healthx, healthy, 76, 12, healthColor, false)
      dxDrawRectangle(healthxoverlay, healthyoverlay, 72, 8, tocolor((100 - v) * 2.55, v * 2.55, 0, 127), false)
      dxDrawRectangle(healthxoverlay, healthyoverlay, 72 * healthRelative, 8, tocolor((100 - v) * 2.55, v * 2.55, 0, 185), false)
    end
  end
end


function unfuck(text)
  return string.gsub(text, "(#%x%x%x%x%x%x)", function(colorString)
    return ""
  end)
end


function onClientRender()
  local cx, cy, cz, lx, ly, lz = getCameraMatrix()
  for k, player in pairs(g_StreamedInPlayers) do
    if isElement(player) and isElementStreamedIn(player) then
      do
        local vx, vy, vz = getPedBonePosition(player, 8)
        local dist = getDistanceBetweenPoints3D(cx, cy, cz, vx, vy, vz)
        if dist < drawDistance and isLineOfSightClear(cx, cy, cz, vx, vy, vz, true, false, false) then
          local x, y = getScreenFromWorldPosition(vx, vy, vz + 0.3)
          if x and y then
            local name = getPlayerName(player)
            local name2 = unfuck(getPlayerName(player))
            local w = dxGetTextWidth(name, 1, "default-bold")
            local h = dxGetFontHeight(1, "default-bold")
            dxDrawText(name2, x - 1 - w / 2, y - 1 - h - 12, w, h, tocolor(0, 0, 0), 1, "default-bold")
            dxDrawColorText(name, x - w / 2, y - h - 12, w, h, tocolor(getPlayerNametagColor(player)), 1, "default-bold")
            local health = getElementHealth(player)
            local armour = getPedArmor(player)
            if health > 0 then
              local rate = 500 / getPedStat(player, 24)
              drawHPBar(x, y - 6, health * rate, dist)
              if armour > 0 then
                drawArmourBar(x, y - 12, armour, dist)
              end
            end
          end
        end
      end
    else
      table.remove(g_StreamedInPlayers, k)
    end
  end
end
addEventHandler("onClientRender", root, onClientRender)


function onClientElementStreamIn()
  if getElementType(source) == "player" then
    setPlayerNametagShowing(source, false)
    table.insert(g_StreamedInPlayers, source)
  end
end
addEventHandler("onClientElementStreamIn", root, onClientElementStreamIn)


function onClientResourceStart(startedResource)
  visibleTick = getTickCount()
  counter = 0
  normalhealthbar = false
  local players = getElementsByType("player")
  for k, v in pairs(players) do
    if isElementStreamedIn(v)  then
      setPlayerNametagShowing(v, false)
      table.insert(g_StreamedInPlayers, v)
    end
  end
end
addEventHandler("onClientResourceStart", resourceRoot, onClientResourceStart)


function dxDrawColorText(str, ax, ay, bx, by, color, scale, font)
  local pat = "(.-)#(%x%x%x%x%x%x)"
  local s, e, cap, col = str:find(pat, 1)
  local last = 1
  while s do
    if cap == "" and col then
      color = tocolor(tonumber("0x" .. col:sub(1, 2)), tonumber("0x" .. col:sub(3, 4)), tonumber("0x" .. col:sub(5, 6)), 255)
    end
    if s ~= 1 or cap ~= "" then
      local w = dxGetTextWidth(cap, scale, font)
      dxDrawText(cap, ax, ay, ax + w, by, color, scale, font)
      ax = ax + w
      color = tocolor(tonumber("0x" .. col:sub(1, 2)), tonumber("0x" .. col:sub(3, 4)), tonumber("0x" .. col:sub(5, 6)), 255)
    end
    last = e + 1
    s, e, cap, col = str:find(pat, last)
  end
  if last <= #str then
    cap = str:sub(last)
    local w = dxGetTextWidth(cap, scale, font)
    dxDrawText(cap, ax, ay, ax + w, by, color, scale, font)
  end
end
Linki görebilmek için Kayıt olun yada Giriş yapın.
 


Çevrimdışı feyzo

  • Yeni Üye
  • *
    • İleti: 53
Yanıtla #4 : 27 Aralık 2019, 15:12:11
İstedigim gibi oldu sagol mahlukat
 


Çevrimdışı dearswatt

  • Yeni Üye
  • *
    • İleti: 88
Yanıtla #5 : 02 Ocak 2020, 21:59:00
Linki görebilmek için Kayıt olun yada Giriş yapın.
Linki görebilmek için Kayıt olun yada Giriş yapın.
 


MTASATURK

Ynt: [İSTEK] nametag
« Yanıtla #5 : 02 Ocak 2020, 21:59:00 »