[Destek] Nametag Kendimde Gözükmüyor

0 Üye ve 1 Ziyaretçi konuyu incelemekte.

Çevrimdışı Berkan52

  • Yeni Üye
  • *
    • İleti: 29
: 01 Şubat 2022, 18:13:48
Merhaba arkadaşlar kafasında ACL takımı bulunan Nametagı indirdim. Ancak nametag kendimde gözükmüyor. Bir arkadaşımız daha bu konu hakkında destek konusu açmış ve verilen cevabı denedim ancak yine olmuyor.

client.lua
Kod
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")
-- part by AndreiSR
local cargo_player = getElementData(player, "cargo") or ""
local cargo_player_cor = getElementData(player, "cargo->cor") or {255, 255, 255, 240}
dxDrawText(cargo_player, x - 1 - w / 2, y - 1 - h - 40, w, h, tocolor(0, 0, 0), 2, "default-bold")
            dxDrawColorText(cargo_player, x - w / 2, y - h - 40, w, h, tocolor(unpack(cargo_player_cor)), 2, "default-bold")
-- part by AndreiSR
            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

server.lua
Kod
function setCargo(player)
if player then
if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(player)), aclGetGroup("Console")) then
setElementData(player, "cargo", "KURUCU")
setElementData(player, "cargo->cor", {255, 140, 0, 240})
elseif isObjectInACLGroup("user."..getAccountName(getPlayerAccount(player)), aclGetGroup("Admin")) then
setElementData(player, "cargo", "ADMİN")
setElementData(player, "cargo->cor", {255, 0, 0, 240})
elseif isObjectInACLGroup("user."..getAccountName(getPlayerAccount(player)), aclGetGroup("SuperModerator")) then
setElementData(player, "cargo", "S.MOD")
setElementData(player, "cargo->cor", {158, 255, 39})
elseif isObjectInACLGroup("user."..getAccountName(getPlayerAccount(player)), aclGetGroup("Moderator")) then
setElementData(player, "cargo", "MOD")
setElementData(player, "cargo->cor", {255, 255, 0, 240})
end
end
end

setTimer(
function()
for i, pl in pairs(getElementsByType("player")) do
if pl ~= (false or nil) then
setCargo(pl)
end
end
end,
3000,
0)
Linki görebilmek için Kayıt olun yada Giriş yapın.
 


MTASATURK

[Destek] Nametag Kendimde Gözükmüyor
« : 01 Şubat 2022, 18:13:48 »

Çevrimdışı Wac|#Savitar.

  • - Madalyon Gaming -
  • Bilgin Üye
  • *
    • İleti: 239
Yanıtla #1 : 01 Şubat 2022, 18:31:48


client.lua
Kod
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")
-- part by AndreiSR
local cargo_player = getElementData(player, "cargo") or ""
local cargo_player_cor = getElementData(player, "cargo->cor") or {255, 255, 255, 240}
dxDrawText(cargo_player, x - 1 - w / 2, y - 1 - h - 40, w, h, tocolor(0, 0, 0), 2, "default-bold")
            dxDrawColorText(cargo_player, x - w / 2, y - h - 40, w, h, tocolor(unpack(cargo_player_cor)), 2, "default-bold")
-- part by AndreiSR
            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
We are Champion's DD Clan

Linki görebilmek için Kayıt olun yada Giriş yapın.
 


Çevrimdışı Berkan52

  • Yeni Üye
  • *
    • İleti: 29
Yanıtla #2 : 01 Şubat 2022, 18:59:17
Linki görebilmek için Kayıt olun yada Giriş yapın.

client.lua
Kod
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")
-- part by AndreiSR
local cargo_player = getElementData(player, "cargo") or ""
local cargo_player_cor = getElementData(player, "cargo->cor") or {255, 255, 255, 240}
dxDrawText(cargo_player, x - 1 - w / 2, y - 1 - h - 40, w, h, tocolor(0, 0, 0), 2, "default-bold")
            dxDrawColorText(cargo_player, x - w / 2, y - h - 40, w, h, tocolor(unpack(cargo_player_cor)), 2, "default-bold")
-- part by AndreiSR
            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
Üstad gerçekten harikasın çok teşekkür ederim değiştirdiğin şeyler nedir tam olarak?
Linki görebilmek için Kayıt olun yada Giriş yapın.
 


Çevrimdışı Wac|#Savitar.

  • - Madalyon Gaming -
  • Bilgin Üye
  • *
    • İleti: 239
Yanıtla #3 : 01 Şubat 2022, 21:12:18
Linki görebilmek için Kayıt olun yada Giriş yapın.
Üstad gerçekten harikasın çok teşekkür ederim değiştirdiğin şeyler nedir tam olarak?

Onclientresourcestart ile streamin fonksiyonları
We are Champion's DD Clan

Linki görebilmek için Kayıt olun yada Giriş yapın.