Вопрос как сделать чтобы у игрока была картинка/текст над головой

Решение
У меня есть уже готовый вариант, вроде должен работать
Код:
surface.CreateFont("HeadFont", {size = 70,weight = 1200,antialias = true,outline = true,font = "Roboto"})
surface.CreateFont("FontJob", {size = 44,weight = 1200,antialias = false,outline = true,font = "Roboto"})

hook.Add("HUDDrawTargetID", "Disable", function()
    return false
end)

local function DrawInfo(ply)
    local Trace = LocalPlayer():GetEyeTrace()
    local Distance = LocalPlayer():GetPos():Distance( ply:GetPos() )
   
    local blink = math.abs(math.sin(CurTime() * 2) * 255);
    alpha, jobalpha = math.Clamp( 400 - Distance / 390 * 255, 0, 255 ), math.Clamp( 400 - Distance / 340 * 255, 0, 255 )+20

    local BoneIndx = ply:LookupBone("ValveBiped.Bip01_Head1")
    pos...
  • Nellored
  • Модератор раздела "Garry's Mod"
  • 831
  • 160
  • 172
У меня есть уже готовый вариант, вроде должен работать
Код:
surface.CreateFont("HeadFont", {size = 70,weight = 1200,antialias = true,outline = true,font = "Roboto"})
surface.CreateFont("FontJob", {size = 44,weight = 1200,antialias = false,outline = true,font = "Roboto"})

hook.Add("HUDDrawTargetID", "Disable", function()
    return false
end)

local function DrawInfo(ply)
    local Trace = LocalPlayer():GetEyeTrace()
    local Distance = LocalPlayer():GetPos():Distance( ply:GetPos() )
   
    local blink = math.abs(math.sin(CurTime() * 2) * 255);
    alpha, jobalpha = math.Clamp( 400 - Distance / 390 * 255, 0, 255 ), math.Clamp( 400 - Distance / 340 * 255, 0, 255 )+20

    local BoneIndx = ply:LookupBone("ValveBiped.Bip01_Head1")
    pos = BoneIndx and ply:GetBonePosition( BoneIndx ) or ply:EyePos()  
   
    local ang = LocalPlayer():EyeAngles()
    ang:RotateAroundAxis( ang:Forward(), 90 )
    ang:RotateAroundAxis( ang:Right(), 90 )
   
       local name = ply:GetName() or math.random(10000000,99999999)
    local downer = "Игрок"
    local namecolor = Color(255, 255, 255, alpha) or Color(blink, 0, 255 - blink,alpha)
    cam.Start3D2D( pos+ply:GetUp()*15, Angle( 0, ang.y, 90 ), 0.05 )
        draw.SimpleText( name, "HeadFont", 2, 3, namecolor, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
        draw.SimpleText( downer or team.GetName(ply:Team()), "FontJob", 2, 55, Color(0,255,255, jobalpha), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
    cam.End3D2D()
    alpha, jobalpha = 0, 0
end
 
  • 144
  • 11
Контакты для связи отсутствуют.
У меня есть уже готовый вариант, вроде должен работать
Код:
surface.CreateFont("HeadFont", {size = 70,weight = 1200,antialias = true,outline = true,font = "Roboto"})
surface.CreateFont("FontJob", {size = 44,weight = 1200,antialias = false,outline = true,font = "Roboto"})

hook.Add("HUDDrawTargetID", "Disable", function()
    return false
end)

local function DrawInfo(ply)
    local Trace = LocalPlayer():GetEyeTrace()
    local Distance = LocalPlayer():GetPos():Distance( ply:GetPos() )
  
    local blink = math.abs(math.sin(CurTime() * 2) * 255);
    alpha, jobalpha = math.Clamp( 400 - Distance / 390 * 255, 0, 255 ), math.Clamp( 400 - Distance / 340 * 255, 0, 255 )+20

    local BoneIndx = ply:LookupBone("ValveBiped.Bip01_Head1")
    pos = BoneIndx and ply:GetBonePosition( BoneIndx ) or ply:EyePos() 
  
    local ang = LocalPlayer():EyeAngles()
    ang:RotateAroundAxis( ang:Forward(), 90 )
    ang:RotateAroundAxis( ang:Right(), 90 )
  
       local name = ply:GetName() or math.random(10000000,99999999)
    local downer = "Игрок"
    local namecolor = Color(255, 255, 255, alpha) or Color(blink, 0, 255 - blink,alpha)
    cam.Start3D2D( pos+ply:GetUp()*15, Angle( 0, ang.y, 90 ), 0.05 )
        draw.SimpleText( name, "HeadFont", 2, 3, namecolor, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
        draw.SimpleText( downer or team.GetName(ply:Team()), "FontJob", 2, 55, Color(0,255,255, jobalpha), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
    cam.End3D2D()
    alpha, jobalpha = 0, 0
end
спасибо
 
  • 144
  • 11
Контакты для связи отсутствуют.
У меня есть уже готовый вариант, вроде должен работать
Код:
surface.CreateFont("HeadFont", {size = 70,weight = 1200,antialias = true,outline = true,font = "Roboto"})
surface.CreateFont("FontJob", {size = 44,weight = 1200,antialias = false,outline = true,font = "Roboto"})

hook.Add("HUDDrawTargetID", "Disable", function()
    return false
end)

local function DrawInfo(ply)
    local Trace = LocalPlayer():GetEyeTrace()
    local Distance = LocalPlayer():GetPos():Distance( ply:GetPos() )
  
    local blink = math.abs(math.sin(CurTime() * 2) * 255);
    alpha, jobalpha = math.Clamp( 400 - Distance / 390 * 255, 0, 255 ), math.Clamp( 400 - Distance / 340 * 255, 0, 255 )+20

    local BoneIndx = ply:LookupBone("ValveBiped.Bip01_Head1")
    pos = BoneIndx and ply:GetBonePosition( BoneIndx ) or ply:EyePos() 
  
    local ang = LocalPlayer():EyeAngles()
    ang:RotateAroundAxis( ang:Forward(), 90 )
    ang:RotateAroundAxis( ang:Right(), 90 )
  
       local name = ply:GetName() or math.random(10000000,99999999)
    local downer = "Игрок"
    local namecolor = Color(255, 255, 255, alpha) or Color(blink, 0, 255 - blink,alpha)
    cam.Start3D2D( pos+ply:GetUp()*15, Angle( 0, ang.y, 90 ), 0.05 )
        draw.SimpleText( name, "HeadFont", 2, 3, namecolor, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
        draw.SimpleText( downer or team.GetName(ply:Team()), "FontJob", 2, 55, Color(0,255,255, jobalpha), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
    cam.End3D2D()
    alpha, jobalpha = 0, 0
end
только как сделать это на определенном игроке?
 
Сверху Снизу