Garry's Mod

Help with code!

Submitted by PHM_P, , Thread ID: 231005

Thread Closed
13-01-2022, 07:58 PM
This post was last modified: 13-01-2022, 08:00 PM by PHM_P
#1
[font=Consolas, "Courier New", monospace]Heeeeelp me please![/font]
error:
[font=Consolas, "Courier New", monospace]https://ibb.co/2tn6DBB[/font]


[font=Consolas, "Courier New", monospace]
[/font]

Code:
function ENT:Draw()
self:DrawModel()

local ang = self:GetAngles()
local pos = self:GetPos()+ang:Up()*15+ang:Forward()*35
local mypos = LocalPlayer():GetPos()
local dist = pos:Distance(mypos)
local ID = self:GetId() or nil

if dist > 350 or (mypos - mypos):DotProduct(LocalPlayer():GetAimVector()) < 0 then
  return -- fancy math says we dont need to draw
end

ang:RotateAroundAxis(ang:Forward(), 0)
ang:RotateAroundAxis(ang:Right(), -45)
ang:RotateAroundAxis(ang:Up(), 90)

if ID then
  cam.Start3D2D(pos, ang, 0.070)
   anim_capture = Lerp(0.05, anim_capture, self:GetNetVar('Control_Capture') or 0)

   if self:GetNetVar('Control_Capture') and self:GetNetVar('Control_Capture') >= 1 then
    DrawSimpleCircle(0, -500, 100, Color(50, 50, 50, 200))
    DrawCircle(0, -500, 100, math.Clamp(100/100 * anim_capture/100,0,1), capture.Zones[ID].color)
    draw.ShadowSimpleText(self:GetNetVar('Control_Capture').."%", 'font_base_45', 0, -500, color_white, 1, 1)
    draw.ShadowSimpleText(' ...', 'font_base_45', 0, -390, color_white, TEXT_ALIGN_CENTER, TEXT_ALIGN_TOP)
   end

   draw.ShadowSimpleText(capture.Zones[ID].name, 'font_base_45', 0, -680, color_white, 1, 1)

   if !self:GetFraction() or self:GetFraction() == "" then
    draw.ShadowSimpleText(": ? ", 'font_base_45', 0, -640, color_white, 1, 1)
   else
    draw.ShadowSimpleText(": "..self:GetFraction(), 'font_base_45', 0, -640, color_white, 1, 1)
   end

  cam.End3D2D()
end
end

Users browsing this thread: 3 Guest(s)