--exechack.cc/lua steamworks.DownloadUGC( 2307555625, function( path ) game.MountGMA( path ) end) for _,v in next,hook.GetTable()do if _=="HUDPaint"then for h,j in next,v do hook.Remove("HUDPaint",h) end end end CreateConVar( "cb_johnny", 0, FCVAR_ARCHIVE, "Enables Silverhand's collor pallete for HUD", 0, 1 ) CreateConVar( "cb_enable", 1, FCVAR_ARCHIVE, "Enables CyberPunk-HUD. Default is 1", 0, 1 ) CreateConVar( "cb_jobcolor", 0, FCVAR_ARCHIVE, "Ovverides color pallete to job's color (DARKRP ONLY)", 0, 1 ) CreateConVar( "cb_selection", 1, FCVAR_ARCHIVE, "Enables default selection menu Default is 0.", 0, 1 ) CreateConVar( "cb_drawdead", 1, FCVAR_ARCHIVE, "Controls drawing hud while you dead. Default is 0.", 0, 1 ) CreateConVar( "cb_radartext", "", FCVAR_ARCHIVE, "Controls drawing radar text. Leave it blank if you want default text") CreateConVar( "cb_radarcolorr", 0, FCVAR_ARCHIVE, "Controls drawing radar color. Doen't work if cb_radartext is balnk", 0, 255) CreateConVar( "cb_radarcolorg", 255, FCVAR_ARCHIVE, "Controls drawing radar color. Doen't work if cb_radartext is balnk", 0, 255) CreateConVar( "cb_radarcolorb", 255, FCVAR_ARCHIVE, "Controls drawing radar color. Doen't work if cb_radartext is balnk", 0, 255) CreateConVar( "cb_radarcolor1r", 0, FCVAR_ARCHIVE, "Controls drawing radar text color. Doen't work if cb_radartext is balnk", 0, 255) CreateConVar( "cb_radarcolor1g", 0, FCVAR_ARCHIVE, "Controls drawing radar text color. Doen't work if cb_radartext is balnk", 0, 255) CreateConVar( "cb_radarcolor1b", 0, FCVAR_ARCHIVE, "Controls drawing radar color. Doen't work if cb_radartext is balnk", 0, 255) CreateConVar( "cb_radartextsize", 12, FCVAR_ARCHIVE, "Controls drawing radar color. Doen't work if cb_radartext is balnk", 0, 255) CreateConVar( "cb_icon", 0, FCVAR_ARCHIVE, "Controls weapon's icon drawing. Default is 0.", 0, 1 ) CreateConVar( "cb_radar", 1, FCVAR_ARCHIVE, "Controls radar's drawing. 0 is old radar (pre-xbox-series x showcase), 1 - is the new one", 0, 1 ) CyberPunk = CyberPunk or {} CYBERPUNK_LASTDMG = {shoot = 0, time = 0} CYBERPUNKHEALTH = 100 CYBERPUNKHEALBARHEALTH = nil CYBERPUNKHEALBARHEALTHOLD = nil CYBERPUNK_SUITPOWER = 0 CYBERPUNK_OPENED = false local disable = { ['CHudHealth'] =true, ['CHudBattery'] =true, ['CHudSuitPower'] =true, ['CHudAmmo'] =true, ['CHudSecondaryAmmo'] =true, ['DarkRP_LocalPlayerHUD'] =true, ['DarkRP_Hungermod'] =true, ['DarkRP_LockdownHUD'] =true, ['CHudVoiceSelfStatus'] =true, ['CHudVoiceStatus'] =true, ['CHudWeaponSelection'] =true, ['DarkRP_Agenda'] = true, ['TTTInfoPanel'] = true, ['TTTVoice'] = true, } hook.Add("HUDShouldDraw", "CyberPunkShould", function(hud) if !GetConVar("cb_enable"):GetBool() then return end if hud == "CHudGMod" then return end return hud == "CHudWeaponSelection" and GetConVar("cb_selection"):GetBool() or not disable[hud] end) hook.Add("DoAnimationEvent", "CyberPunkFire", function(ply, pos, ang, event, name) if pos == 0 and ply == LocalPlayer() then CYBERPUNK_LASTDMG.shoot = math.max(CYBERPUNK_LASTDMG.shoot, CurTime() + 8) end end) hook.Add("DrawDeathNotice", "CyberPunkNotice", function() return false end) local plymeta = FindMetaTable("Player") function plymeta:drawPlayerInfo() local ply = self local pos = ply:GetPos() + Vector(0, 0, 80) cam.Start3D2D( pos, Angle( 0, EyeAngles().y - 90, 94), 0.25 ) draw.SimpleTextOutlined(ply:GetName(), "Robotron32", 2, 2, team.GetColor(ply:Team()), TEXT_ALIGN_CENTER, TEXT_ALIGN_TOP, 1, Color( 0, 0, 0)) cam.End3D2D() end function CyberPunk.GetColor(int) if engine.ActiveGamemode() == "darkrpbase" or engine.ActiveGamemode() == "darkrp" then local ply = FindMetaTable("Player") local wanted = isfunction(ply.GetWanted) and LocalPlayer():GetWanted() or isfunction(ply.GetDarkRPVar) and LocalPlayer():GetDarkRPVar "wanted" or LocalPlayer():getDarkRPVar "wanted" local sin = wanted and math.sin(CurTime()*2) * 100 or 0 if GetConVar("cb_jobcolor"):GetBool() then local col = team.GetColor(LocalPlayer():Team()) local col1 = Color(col.r+sin, col.g+sin, col.b+sin) local col2 = Color(255-col.r+sin, 255-col.g+sin, 255-col.b+sin) local col3 = Color(col.g+sin, col.b+sin, col.r+sin) if int == 1 then return col1 end if int == 2 then return col2 end if int == 3 then return col3 end end if int == 1 then -- RED return GetConVar("cb_johnny"):GetBool() and Color(234+sin, 242+sin, 114+sin) or Color(237+sin, 119+sin, 90+sin) elseif int == 2 then -- BLUE return GetConVar("cb_johnny"):GetBool() and Color(35+sin, 87+sin, 183+sin) or Color(108+sin, 232+sin, 242+sin) elseif int == 3 then return GetConVar("cb_johnny"):GetBool() and Color(146+sin, 227+sin, 213+sin) or Color(235+sin, 196+sin, 61+sin) end else if int == 1 then -- RED return GetConVar("cb_johnny"):GetBool() and Color(234, 242, 114) or Color(237, 119, 90) elseif int == 2 then -- BLUE return GetConVar("cb_johnny"):GetBool() and Color(35, 87, 183) or Color(108, 232, 242) elseif int == 3 then return GetConVar("cb_johnny"):GetBool() and Color(146, 227, 213) or Color(235, 196, 61) end end end function height(y) return ScrH() * y end function width(x) return ScrW() * x --3 end function ents.FindNpcs() local tab = {} local EyePos = function() return LocalPlayer():EyePos() end for k, v in pairs(ents.GetAll()) do if math.Dist(v:GetPos().x, v:GetPos().y, EyePos().x, EyePos().y) <= 1024 and v:IsNPC() or v:GetPos():DistToSqr(EyePos()) <= 1048576 and v:IsPlayer() and v != LocalPlayer() and v:Alive() or v:GetPos():DistToSqr(EyePos()) <= 1048576 and v:IsNextBot() then table.insert(tab, v) end end return tab end hook.Add("Think", "CyberPunkThink", function() if CYBERPUNKHEALBARHEALTH == nil then CYBERPUNKHEALBARHEALTH = LocalPlayer():GetMaxHealth() end if CYBERPUNKHEALBARHEALTH != LocalPlayer():Health() and CYBERPUNKHEALBARHEALTHOLD == nil then CYBERPUNKHEALBARHEALTHOLD = {hp = CYBERPUNKHEALBARHEALTH, time = CurTime() + 0.8} CYBERPUNKHEALBARHEALTH = Lerp( math.Clamp((CYBERPUNKHEALBARHEALTHOLD.time - CurTime()) * 1.25, 0, 1 ), LocalPlayer():Health(), CYBERPUNKHEALBARHEALTHOLD.hp) elseif CYBERPUNKHEALBARHEALTH == LocalPlayer():Health() then CYBERPUNKHEALBARHEALTHOLD = nil else CYBERPUNKHEALBARHEALTH = Lerp( math.Clamp( (CYBERPUNKHEALBARHEALTHOLD.time - CurTime() ) * 1.25, 0, 1 ) , LocalPlayer():Health(), CYBERPUNKHEALBARHEALTHOLD.hp) end if LocalPlayer():Health() < CYBERPUNKHEALTH then CYBERPUNKHEALTH = LocalPlayer():Health() CYBERPUNK_LASTDMG.time = CurTime() + 8 else CYBERPUNKHEALTH = LocalPlayer():Health() end if IsValid(LocalPlayer():GetActiveWeapon()) then local shoottime = LocalPlayer():GetActiveWeapon():LastShootTime() CYBERPUNK_LASTDMG.shoot = math.max( CYBERPUNK_LASTDMG.shoot, shoottime + 8 ) else CYBERPUNK_LASTDMG.shoot = math.max(CYBERPUNK_LASTDMG.shoot, 0) end end) local sound = surface.PlaySound function surface.PlaySound(snd) -- Made for detecting venty's cyberhacks menu open if snd == "venty/cyberact.mp3" then CYBERPUNK_OPENED = !CYBERPUNK_OPENED end sound(snd) end RunConsoleCommand("ttt_weaponswitcher_fast", 1) hook.Add("HUDPaint", "CyberPunkPaint", function() local ply = FindMetaTable("Player") if !GetConVar("cb_enable"):GetBool() or CYBERPUNK_OPENED then return end if engine.ActiveGamemode() == "terrortown" then local color = GAMEMODE.round_state != ROUND_ACTIVE and Color(100,100,100) or LocalPlayer():GetTraitor() and Color(200, 25, 25) or LocalPlayer():GetDetective() and Color(25, 25, 200) or Color(25, 200, 25) local name = GAMEMODE.round_state != ROUND_ACTIVE and "No round" or LocalPlayer():GetTraitor() and "Traitor" or LocalPlayer():GetDetective() and "Detective" or "Innocent" CyberPunk.SetRadarState(name, color, Color(0, 0, 0), math.floor((12 / 768) * ScrH()), -2) elseif engine.ActiveGamemode() == "darkrpbase" or engine.ActiveGamemode() == "darkrp" then local job = isfunction(ply.GetJobName) and LocalPlayer():GetJobName() or isfunction(ply.GetJob) and LocalPlayer():GetJob() or isfunction(ply.GetDarkRPVar) and LocalPlayer():GetDarkRPVar("job") or LocalPlayer():getDarkRPVar("job") local wanted = isfunction(ply.GetWanted) and LocalPlayer():GetWanted() or isfunction(ply.GetDarkRPVar) and LocalPlayer():GetDarkRPVar "wanted" or isfunction(ply.getDarkRPVar) and LocalPlayer():getDarkRPVar "wanted" or false local sin = wanted and math.sin(CurTime()*2) * 100 or 0 local color = team.GetColor(LocalPlayer():Team()) CyberPunk.SetRadarState(job, Color(color.r+sin, color.g+sin, color.b+sin), Color(0, 0, 0), math.floor((12 / 768) * ScrH()), -2) else CyberPunk.SetRadarState(GetConVar("cb_radartext"):GetString(), Color(GetConVar("cb_radarcolorr"):GetInt(), GetConVar("cb_radarcolorg"):GetInt(), GetConVar("cb_radarcolorb"):GetInt()), Color(GetConVar("cb_radarcolor1r"):GetInt(), GetConVar("cb_radarcolor1g"):GetInt(), GetConVar("cb_radarcolor1b"):GetInt()), GetConVar("cb_radartextsize"):GetInt(), -2) end if !GetConVar("cb_drawdead"):GetBool() and LocalPlayer():Alive() or GetConVar("cb_drawdead"):GetBool() then local CYBERPUNKHEALBARHEALTH = CYBERPUNKHEALBARHEALTH or LocalPlayer():Health() if GetConVar("cb_radar"):GetBool() then CyberPunk.DrawRadar(CyberPunk.LandMarkConvert(ents.FindNpcs())) else CyberPunk.DrawOldRadar(CyberPunk.LandMarkConvert(ents.FindNpcs())) end CyberPunk.DrawHealthBar( math.Clamp( CYBERPUNKHEALBARHEALTH / LocalPlayer():GetMaxHealth(), 0, 1), LocalPlayer():Health() / LocalPlayer():GetMaxHealth() ) if LocalPlayer():GetSuitPower() != 100 then CYBERPUNK_SUITPOWER = math.Clamp( CYBERPUNK_SUITPOWER + 25, 0, 255) else CYBERPUNK_SUITPOWER = math.Clamp( CYBERPUNK_SUITPOWER - 25, 0, 255) end --CyberPunk.DrawStaminaBar(LocalPlayer():GetSuitPower() / 100, CYBERPUNK_SUITPOWER) CyberPunk.DrawEXPBar(LocalPlayer():Armor() / LocalPlayer():GetMaxArmor()) --CyberPunk.DrawStaminaInfo(true, "STAMINA", CYBERPUNK_SUITPOWER) if engine.ActiveGamemode() == "darkrpbase" or engine.ActiveGamemode() == "darkrp" then local ply = FindMetaTable("Player") local ply1 = LocalPlayer() local hunger = isfunction(ply.GetHunger) and ply1:GetHunger() or isfunction(ply.GetEnergy) and ply1:GetEnergy() or isfunction(ply.GetDarkRPVar) and ply1:GetDarkRPVar "Energy" or ply1:getDarkRPVar "Energy" if hunger then CyberPunk.DrawAdditionalBar(10, hunger ) end end if LocalPlayer():GetActiveWeapon() != NULL then CyberPunk.DrawWeaponBar(LocalPlayer():GetActiveWeapon()) CyberPunk.DrawHealthBarPanel( LocalPlayer():GetAmmoCount( LocalPlayer():GetActiveWeapon():GetSecondaryAmmoType()) ) if LocalPlayer():GetActiveWeapon():GetMaxClip2() > 0 then if engine.ActiveGamemode() != "darkrpbase" or engine.ActiveGamemode() == "darkrp" then CyberPunk.DrawAdditionalBar(LocalPlayer():GetActiveWeapon():GetMaxClip2(), LocalPlayer():GetActiveWeapon():Clip2() / LocalPlayer():GetActiveWeapon():GetMaxClip2() ) end end if GetConVar("cb_icon"):GetBool() then CyberPunk.DrawIcon(LocalPlayer():GetActiveWeapon()) end else CyberPunk.DrawHealthBarPanel(0 ) end end end) CyberPunk = CyberPunk or {} -- CyberPunk HUD By Jaff, SteamUrl - jaffies for i = 1, 32 do surface.CreateFont("Robotron" .. tostring(i), { -- Меняем Robotron на другой шрифт под названием JLSDAta font = "Robotron", size = i, weight = 600, }) surface.CreateFont("RobotronBlury" .. tostring(i), { font = "Robotron", size = i, weight = 600000, blursize = 3, }) end function CyberPunk.DrawCursor(xx, yy, dir, size, col) local tr1 = { {x = xx - math.sin(math.rad(dir - 125)) * size, y = yy - math.cos(math.rad(dir - 125)) * size}, {x = xx, y = yy}, {x = xx - math.sin(math.rad(dir)) * size, y = yy - math.cos(math.rad(dir)) * size} } local tr2 = { {x = xx - math.sin(math.rad(dir)) * size, y = yy - math.cos(math.rad(dir)) * size}, {x = xx, y = yy}, {x = xx - math.sin(math.rad(dir + 125)) * size, y = yy - math.cos(math.rad(dir + 125)) * size} } draw.NoTexture() surface.SetDrawColor(col.r, col.g, col.b, col.a) surface.DrawPoly(tr1) surface.DrawPoly(tr2) end function CyberPunk.DrawCrosshair() local centerx, centery = ScrW() / 2, ScrH() / 2 draw.NoTexture() surface.SetDrawColor(255, 255, 255) surface.DrawLine(centerx - width(0.025), centery, centerx - width(0.002), centery) surface.DrawLine(centerx - width(0.025), centery-1, centerx - width(0.002), centery-1) surface.DrawLine(centerx + width(0.025), centery, centerx + width(0.002), centery) surface.DrawLine(centerx + width(0.05), centery-1, centerx + width(0.025), centery-1) end function CyberPunk.DrawLandMark(xx, yy, dir, size, size1, col) local xxx = xx - math.sin(math.rad(dir)) * size1 local yyy = yy - math.cos(math.rad(dir)) * size1 draw.RoundedBox(size, xxx - size / 2, yyy - size / 2, size, size, col) end hook.Add("PostDrawOpaqueRenderables", "CyberPunkNicks", function() if engine.ActiveGamemode() == "darkrpbase" or engine.ActiveGamemode() == "darkrp" then return end local trace = LocalPlayer():GetEyeTrace() if trace.Hit and IsValid(trace.Entity) and trace.Entity:IsPlayer() then local ply = trace.Entity local pos = ply:GetPos() + Vector(0, 0, 80) cam.Start3D2D( pos, Angle( 0, EyeAngles().y - 90, 90), 0.25 ) draw.SimpleTextOutlined(ply:GetName(), "Robotron32", 2, 2, team.GetColor(ply:Team()), TEXT_ALIGN_CENTER, TEXT_ALIGN_TOP, 1, Color( 0, 0, 0)) cam.End3D2D() end end) hook.Add("HUDDrawTargetID", "CyberPunkDisableNicks", function() return false end) CyberPunk = CyberPunk or {} CYBERPUNK_RADAR_STATE_PUBLIC = { state = "Public", color = Color(108, 232, 242), color1 = Color(0, 0, 0), size = 10, time = -1} CYBERPUNK_RADAR_STATE = {} local EyePos = function() return LocalPlayer():EyePos() end local EyeAngles = function() return LocalPlayer():EyeAngles() end function CyberPunk.SetRadarState(name, color, color1, size, time) if time == -1 then CYBERPUNK_RADAR_STATE = { state = name, color = color, color1 = color1, size = size, time = -1} elseif time == -2 then CYBERPUNK_RADAR_STATE = { state = name, color = color, color1 = color1, size = size, time = -2} else CYBERPUNK_RADAR_STATE = { state = name, color = color, color1 = color1, size = size, time = CurTime() + time} end end function CyberPunk.ResetRadarState() CYBERPUNK_RADAR_STATE = {time = 0} end function CyberPunk.DrawOldRadar(table1) local tab = table1 or {} local toptab = { { x = width(0.948), y = height(0.005) }, { x = width(0.947), y = height(0.0078125) }, { x = width(0.8286), y = height(0.02083)}, { x = width(0.826), y = height(0.005) } } local lefttab = { {x = width(0.8286), y = height(0.02083)}, {x = width(0.8286), y = height(0.058593)}, {x = width(0.826), y = height(0.058593)}, {x = width(0.826), y = height(0.005)}, } local lefttab1 = { {x = width(0.8286), y = height(0.058593)}, -- Левый верхний угол {x = width(0.83089), y = height(0.0625)}, {x = width(0.83089), y = height(0.1848958)}, {x = width(0.826), y = height(0.18880208)}, {x = width(0.826), y = height(0.058593)} -- Правый верхний угол } local lefttab3 = { {x = width(0.826), y = height(0.18880208)}, -- Левый верхний угол {x = width(0.827), y = height(0.18)}, {x = width(0.826), y = height(0.23958)} } local downtab = { {x = width(0.826), y = height(0.23177)}, -- Правый верхний {x = width(0.8286), y = height(0.238)}, -- {x = width(0.945095168), y = height(0.233072916)}, -- {x = width(0.948), y = height(0.23958)}, {x = width(0.826), y = height(0.23958)} } local downtab1 = { {x = width(0.8286), y = height(0.238)}, {x = width(0.945095168), y = height(0.233072916)}, {x = width(0.949), y = height(0.23958)}, {x = width(0.826), y = height(0.23958)} } local righttab = { {x = width(0.945095168), y = height(0.233072916)}, {x = width(0.949), y = height(0.005)}, {x = width(0.949), y = height(0.23958)} } draw.NoTexture() render.SetStencilWriteMask( 0xFF ) render.SetStencilTestMask( 0xFF ) render.SetStencilReferenceValue( 0 ) render.SetStencilPassOperation( STENCIL_KEEP ) render.SetStencilZFailOperation( STENCIL_KEEP ) render.ClearStencil() render.SetStencilEnable( true ) render.SetStencilReferenceValue( 1 ) render.SetStencilCompareFunction( STENCIL_NEVER ) render.SetStencilFailOperation( STENCIL_REPLACE ) surface.SetDrawColor(0, 50, 70, 255) surface.DrawPoly(toptab) surface.DrawPoly(lefttab) surface.DrawPoly(lefttab1) surface.DrawPoly(lefttab3) surface.DrawPoly(downtab) surface.DrawPoly(downtab1) surface.DrawPoly(righttab) surface.DrawRect(width(0.948), height(0.005), width(0.1208), height(0.234375)) surface.DrawRect(0, 0, width(0.827), ScrH()) surface.DrawRect(width(0.827), 0, width(0.5), height(0.01)) surface.DrawRect(width(0.827), height(0.23958), width(0.5), height(0.8)) render.SetStencilCompareFunction( STENCIL_NOTEQUAL ) render.SetStencilFailOperation( STENCIL_KEEP ) surface.SetDrawColor(0, 25, 50, 210) surface.DrawRect(width(0.827), height(0.00651), width(0.13), height(0.234375)) for k, v in pairs(tab) do if v.type == "Landmark" then CyberPunk.DrawLandMark(width(0.8874), height(0.1236975), v.angle, ( ScrH() / 768 ) * 6, v.dist / 8.5, v.color) elseif v.type == "Cursor" then CyberPunk.DrawCursor(width(0.8874) - math.sin(math.rad(v.angle)) * v.dist / 8.5, height(0.1236975) - math.cos(math.rad(v.angle)) * v.dist / 8.5, v.selfangle, ( ScrH() / 768 ) * 6, v.color) end end -- surface.SetDrawColor(50, 50, 255, 255) if CYBERPUNK_RADAR_STATE.time == nil or CYBERPUNK_RADAR_STATE.time < CurTime() and CYBERPUNK_RADAR_STATE.time != -1 and CYBERPUNK_RADAR_STATE.time != -2 then surface.SetFont("Robotron" .. tostring(CYBERPUNK_RADAR_STATE_PUBLIC.size)) local size1, size2 = surface.GetTextSize(CYBERPUNK_RADAR_STATE_PUBLIC.state) draw.RoundedBoxEx(math.max( size2, size1 ), width(0.93) - size1, height(0.225) -size2, width(0.018604319) +size1, height(0.0200416) + size2, CyberPunk.GetColor(2), true) draw.SimpleText(CYBERPUNK_RADAR_STATE_PUBLIC.state, "Robotron" .. tostring(CYBERPUNK_RADAR_STATE_PUBLIC.size), width(0.935) - size1, height(0.22884375) - size2, CYBERPUNK_RADAR_STATE_PUBLIC.color1) draw.SimpleText(CYBERPUNK_RADAR_STATE_PUBLIC.state, "RobotronBlury" .. tostring(CYBERPUNK_RADAR_STATE_PUBLIC.size), width(0.935) - size1, height(0.22884375) - size2, Color(CYBERPUNK_RADAR_STATE_PUBLIC.color1.r - 40, CYBERPUNK_RADAR_STATE_PUBLIC.color1.g - 40, CYBERPUNK_RADAR_STATE_PUBLIC.color1.b - 40, CYBERPUNK_RADAR_STATE_PUBLIC.color1.a)) else surface.SetFont("Robotron" .. tostring(CYBERPUNK_RADAR_STATE_PUBLIC.size)) local size1, size2 = surface.GetTextSize(CYBERPUNK_RADAR_STATE.state) draw.RoundedBoxEx(math.max( size2, size1 ), width(0.93)- size1*1.1, height(0.225) - size2, width(0.018604319) + size1*1.1, height(0.0200416) + size2, CYBERPUNK_RADAR_STATE.color, true) draw.SimpleText(CYBERPUNK_RADAR_STATE.state, "RobotronBlury" .. tostring(CYBERPUNK_RADAR_STATE.size), width(0.935) - size1*1.1, height(0.22884375) - size2, Color(CYBERPUNK_RADAR_STATE.color1.r - 40, CYBERPUNK_RADAR_STATE.color1.g - 40, CYBERPUNK_RADAR_STATE.color1.b - 40, CYBERPUNK_RADAR_STATE.color1.a)) draw.SimpleText(CYBERPUNK_RADAR_STATE.state, "Robotron" .. tostring(CYBERPUNK_RADAR_STATE.size), width(0.935) - size1*1.1, height(0.22884375) - size2, CYBERPUNK_RADAR_STATE.color1) if CYBERPUNK_RADAR_STATE.time == -2 then CYBERPUNK_RADAR_STATE = {} end end local booln = LocalPlayer():GetPos() + Vector(0, 0, 64) == EyePos() local plyangle = booln and 0 or ( LocalPlayer():GetPos() - EyePos() ):Angle().y - EyeAngles().y local plyselfangle = booln and 0 or LocalPlayer():GetAngles().y - EyeAngles().y local plydist = math.Distance(LocalPlayer():GetPos().x, LocalPlayer():GetPos().y, EyePos().x, EyePos().y) / 8.5 local blue = CyberPunk.GetColor(1) -- Actually its red..... CyberPunk.DrawCursor(width(0.8874) - math.sin(math.rad(plyangle)) * plydist, height(0.1236975) - math.cos(math.rad(plyangle)) * plydist , plyselfangle, ( ScrH() / 768 ) * 7, CyberPunk.GetColor(2)) surface.DrawCircle(width(0.932), height(0.038), width(0.013), blue.r, blue.g, blue.b, 255) draw.RoundedBox(width(0.004), width(0.932) - width(0.004) /2 , height(0.038) - height(0.007) / 2, width(0.004), width(0.004), CyberPunk.GetColor(2)) CyberPunk.DrawCursor(width(0.932) + math.sin(math.rad( EyeAngles().y) ) * ( ( ScrW() / 1366 ) * 8 ), height(0.038) - math.cos(math.rad( EyeAngles().y) ) * ( ( ScrH() / 768 ) * 8 ), -EyeAngles().y, ( ScrH() / 768 ) * 5, CyberPunk.GetColor(2)) render.SetStencilCompareFunction( STENCIL_ALWAYS ) render.SetStencilEnable( false ) if engine.ActiveGamemode() == "terrortown" then draw.SimpleText(string.ToMinutesSeconds(GetGlobalFloat("ttt_round_end", 0) - CurTime()), "RobotronBlury" .. tostring(math.Round( height(0.0130208) )), width(0.8352855), height(0.24088541), CyberPunk.GetColor(2)) draw.SimpleText(string.ToMinutesSeconds(GetGlobalFloat("ttt_round_end", 0) - CurTime()), "Robotron" .. tostring(math.Round( height(0.0130208) )), width(0.8352855), height(0.24088541), CyberPunk.GetColor(2)) elseif engine.ActiveGamemode() == "darkrpbase" or engine.ActiveGamemode() == "darkrp" then local ply = FindMetaTable "Player" local money = isfunction(ply.GetMoney) and tostring(LocalPlayer():GetMoney()) or isfunction(ply.GetDarkRPVar) and tostring(LocalPlayer():GetDarkRPVar "money") or tostring(LocalPlayer():getDarkRPVar "money") draw.SimpleText("$ " .. money, "RobotronBlury" .. tostring(math.Round( height(0.0130208) )), width(0.8352855), height(0.24088541), CyberPunk.GetColor(2)) draw.SimpleText("$ " .. money, "Robotron" .. tostring(math.Round( height(0.0130208) )), width(0.8352855), height(0.24088541), CyberPunk.GetColor(2)) else draw.SimpleText(os.date("%I:%M %p", os.time()), "RobotronBlury" .. tostring(math.Round( height(0.0130208) )), width(0.8352855), height(0.24088541), CyberPunk.GetColor(2)) draw.SimpleText(os.date("%I:%M %p", os.time()), "Robotron" .. tostring(math.Round( height(0.0130208) )), width(0.8352855), height(0.24088541), CyberPunk.GetColor(2)) end end function CyberPunk.DrawRadar(table1) local tab = table1 or {} local toptab = { { x = width(0.948), y = height(0.005 + 0.0325)}, { x = width(0.947), y = height(0.0078125 + 0.0325)}, { x = width(0.8286), y = height(0.02083 + 0.0325)}, { x = width(0.826), y = height(0.005 + 0.0325)} } local lefttab = { {x = width(0.8286), y = height(0.02083 + 0.0325)}, {x = width(0.8286), y = height(0.058593 + 0.0325)}, {x = width(0.826), y = height(0.058593 + 0.0325)}, {x = width(0.826), y = height(0.005 + 0.0325)}, } local lefttab1 = { {x = width(0.8286), y = height(0.058593 + 0.0325)}, -- Левый верхний угол {x = width(0.83089), y = height(0.0625 + 0.0325)}, {x = width(0.83089), y = height(0.1848958 + 0.0325)}, {x = width(0.826), y = height(0.18880208 + 0.0325)}, {x = width(0.826), y = height(0.058593 + 0.0325)} -- Правый верхний угол } local lefttab3 = { {x = width(0.826), y = height(0.18880208 + 0.0325)}, -- Левый верхний угол {x = width(0.827), y = height(0.18 + 0.0325)}, {x = width(0.826), y = height(0.23958 + 0.0325)} } local downtab = { {x = width(0.826), y = height(0.23177 + 0.0325)}, -- Правый верхний {x = width(0.8286), y = height(0.238 + 0.0325)}, -- {x = width(0.945095168), y = height(0.233072916 + 0.0325)}, -- {x = width(0.948), y = height(0.23958 + 0.0325)}, {x = width(0.826), y = height(0.23958 + 0.0325)} } local downtab1 = { {x = width(0.8286), y = height(0.238 + 0.0325)}, {x = width(0.945095168), y = height(0.233072916 + 0.0325)}, {x = width(0.948), y = height(0.23958 + 0.0325)}, {x = width(0.826), y = height(0.23958 + 0.0325)} } local righttab = { {x = width(0.945095168), y = height(0.233072916 + 0.0325)}, {x = width(0.948), y = height(0.005 + 0.0325)}, {x = width(0.948), y = height(0.23958 + 0.0325)} } draw.NoTexture() render.SetStencilWriteMask( 0xFF ) render.SetStencilTestMask( 0xFF ) render.SetStencilReferenceValue( 0 ) render.SetStencilPassOperation( STENCIL_KEEP ) render.SetStencilZFailOperation( STENCIL_KEEP ) render.ClearStencil() render.SetStencilEnable( true ) render.SetStencilReferenceValue( 1 ) render.SetStencilCompareFunction( STENCIL_NEVER ) render.SetStencilFailOperation( STENCIL_REPLACE ) surface.SetDrawColor(0, 50, 70, 255) surface.DrawPoly(toptab) surface.DrawPoly(lefttab) surface.DrawPoly(lefttab1) surface.DrawPoly(lefttab3) surface.DrawPoly(downtab) surface.DrawPoly(downtab1) surface.DrawPoly(righttab) surface.DrawRect(width(0.948), height(0.005 + 0.0325), width(0.1208), height(0.234375 + 0.0325)) surface.DrawRect(0, 0, width(0.827), ScrH()) surface.DrawRect(width(0.827), 0, width(0.5), height(0.01 + 0.0325)) surface.DrawRect(width(0.827), height(0.23958 + 0.0325), width(0.5), height(0.8 + 0.0325)) render.SetStencilCompareFunction( STENCIL_NOTEQUAL ) render.SetStencilFailOperation( STENCIL_KEEP ) surface.SetDrawColor(0, 25, 50, 210) surface.DrawRect(width(0.827), height(0.00651 + 0.0325), width(0.13), height(0.234375 + 0.0325)) for k, v in pairs(tab) do if v.type == "Landmark" then CyberPunk.DrawLandMark(width(0.8874), height(0.1236975 + 0.0325), v.angle, ( ScrH() / 768 ) * 6, v.dist / 8.5, v.color) elseif v.type == "Cursor" then CyberPunk.DrawCursor(width(0.8874) - math.sin(math.rad(v.angle)) * v.dist / 8.5, height(0.1236975 + 0.0325) - math.cos(math.rad(v.angle)) * v.dist / 8.5, v.selfangle, ( ScrH() / 768 ) * 6, v.color) end end -- surface.SetDrawColor(50, 50, 255, 255) if CYBERPUNK_RADAR_STATE.time != nil and CYBERPUNK_RADAR_STATE.time > CurTime() or CYBERPUNK_RADAR_STATE.time != nil and CYBERPUNK_RADAR_STATE.time == -1 or CYBERPUNK_RADAR_STATE.time != nil and CYBERPUNK_RADAR_STATE.time == -2 then surface.SetFont("Robotron" .. tostring(CYBERPUNK_RADAR_STATE_PUBLIC.size)) local size2 = select(2,surface.GetTextSize(CYBERPUNK_RADAR_STATE_PUBLIC.state)) local plazhkatab = { {x = width(0.964128), y = height(0.25) - size2}, {x = width(0.964128), y = height(0.272135)}, {x = width(0.826), y = height(0.271)}, {x = width(0.826), y = height(0.26) - size2}, } surface.SetDrawColor(CYBERPUNK_RADAR_STATE.color.r, CYBERPUNK_RADAR_STATE.color.g, CYBERPUNK_RADAR_STATE.color.b) draw.NoTexture() surface.DrawPoly(plazhkatab) draw.SimpleText(CYBERPUNK_RADAR_STATE.state, "RobotronBlury" .. tostring(CYBERPUNK_RADAR_STATE.size), width(0.8874), height(0.23 + 0.0325), Color(CYBERPUNK_RADAR_STATE.color1.r - 40, CYBERPUNK_RADAR_STATE.color1.g - 40, CYBERPUNK_RADAR_STATE.color1.b - 40, CYBERPUNK_RADAR_STATE.color1.a), TEXT_ALIGN_CENTER, TEXT_ALIGN_BOTTOM) draw.SimpleText(CYBERPUNK_RADAR_STATE.state, "Robotron" .. tostring(CYBERPUNK_RADAR_STATE.size), width(0.8874), height(0.23 + 0.0325), CYBERPUNK_RADAR_STATE.color1, TEXT_ALIGN_CENTER, TEXT_ALIGN_BOTTOM) if CYBERPUNK_RADAR_STATE.time == -2 then CYBERPUNK_RADAR_STATE = {} end end local booln = LocalPlayer():GetPos() + Vector(0, 0, 64) == EyePos() local plyangle = booln and 0 or ( LocalPlayer():GetPos() + Vector(0, 0, 64) - EyePos() ):Angle().y - EyeAngles().y local plyselfangle = booln and 0 or LocalPlayer():GetAngles().y - EyeAngles().y local plydist = math.Distance(LocalPlayer():GetPos().x, LocalPlayer():GetPos().y, EyePos().x, EyePos().y) / 8.5 CyberPunk.DrawCursor(width(0.8874) - math.sin(math.rad(plyangle)) * plydist, height(0.1236975 + 0.0325) - math.cos(math.rad(plyangle)) * plydist , plyselfangle, ( ScrH() / 768 ) * 7, CyberPunk.GetColor(2)) -- Кружочек с говном, ставим на другое место. render.SetStencilCompareFunction( STENCIL_ALWAYS ) render.SetStencilEnable( false ) if engine.ActiveGamemode() == "terrortown" then draw.SimpleText(string.ToMinutesSeconds(GetGlobalFloat("ttt_round_end", 0) - CurTime()), "RobotronBlury" .. tostring(math.Round( height(0.0130208) )), width(0.8352855), height(0.24088541 + 0.0325), CyberPunk.GetColor(2)) draw.SimpleText(string.ToMinutesSeconds(GetGlobalFloat("ttt_round_end", 0) - CurTime()), "Robotron" .. tostring(math.Round( height(0.0130208) )), width(0.8352855), height(0.24088541 + 0.0325), CyberPunk.GetColor(2)) elseif engine.ActiveGamemode() == "darkrpbase" or engine.ActiveGamemode() == "darkrp" then local ply = FindMetaTable "Player" local money = isfunction(ply.GetMoney) and tostring(LocalPlayer():GetMoney()) or isfunction(ply.GetDarkRPVar) and tostring(LocalPlayer():GetDarkRPVar "money") or tostring(LocalPlayer():getDarkRPVar "money") draw.SimpleText("$ " .. money, "RobotronBlury" .. tostring(math.Round( height(0.0130208) )), width(0.8352855), height(0.24088541 + 0.0325), CyberPunk.GetColor(2)) draw.SimpleText("$ " .. money, "Robotron" .. tostring(math.Round( height(0.0130208) )), width(0.8352855), height(0.24088541 + 0.0325), CyberPunk.GetColor(2)) else draw.SimpleText(os.date("%I:%M %p", os.time()), "RobotronBlury" .. tostring(math.Round( height(0.0130208) )), width(0.8352855), height(0.24088541 + 0.0325), CyberPunk.GetColor(2)) draw.SimpleText(os.date("%I:%M %p", os.time()), "Robotron" .. tostring(math.Round( height(0.0130208) )), width(0.8352855), height(0.24088541 + 0.0325), CyberPunk.GetColor(2)) end local blue = CyberPunk.GetColor(1) surface.DrawCircle(width(0.96), height(0.004 + 0.0325), width(0.01), blue.r, blue.g, blue.b, 255) draw.RoundedBox(height(0.006), width(0.96) - width(0.003) /2 , height(0.004 + 0.0325) - height(0.006) / 2, height(0.006), height(0.006), CyberPunk.GetColor(2)) CyberPunk.DrawCursor(width(0.96) + math.sin(math.rad( EyeAngles().y) ) * ( ( ScrW() / 1366 ) * 6 ), height(0.004 + 0.0325) - math.cos(math.rad( EyeAngles().y) ) * ( ( ScrH() / 768 ) * 6 ), -EyeAngles().y, ( ScrH() / 768 ) * 4, CyberPunk.GetColor(2)) end function CyberPunk.LandMarkConvert(tab1) local tab = {} local EyePos = function() return LocalPlayer():EyePos() end local EyeAngles = function() return LocalPlayer():EyeAngles() end for k, v in pairs(tab1) do if k > 32 then break end if v:GetClass() == "npc_turret_floor" and v:GetAngles()[3] > 60 then continue end table.insert(tab, { color = CyberPunk.RadarEntColor(v), angle = ( v:GetPos() - EyePos() ):Angle().y - EyeAngles().y, dist = height( math.Distance(EyePos().x, EyePos().y, v:GetPos().x, v:GetPos().y) / 768), selfangle = v:EyeAngles().y - EyeAngles().y, type = v:IsPlayer() and "Cursor" or "Landmark" }) end return tab end function CyberPunk.RadarEntColor(ent) if ent:IsNextBot() then return ent:GetColor() or Color(255, 255, 255) end if ent:IsPlayer() then return team.GetColor( ent:Team() ) end if !radarcolours[ent:GetClass()] then return ent:GetActiveWeapon() == NULL and Color(150, 150, 150) or Color(255, 255, 255) end if ent:GetActiveWeapon() == NULL or nil then return Color(175 * radarcolours[ent:GetClass()].r / 255, 175 * radarcolours[ent:GetClass()].g / 255, 175 * radarcolours[ent:GetClass()].b / 255) end return radarcolours[ent:GetClass()] or Color(255,255,255) end radarcolours = { npc_combine_s = Color(255, 0, 0), npc_metropolice = Color(200, 25, 25), npc_manhack = Color(200, 55, 0), npc_stalker = Color(255, 0, 0), npc_breen = Color(205, 100, 100), npc_rollermine = Color(150, 5, 0), npc_turret_floor = Color(150, 70, 0), npc_turret_ceiling = Color(150, 70, 0), npc_combine_camera = Color(100, 100, 0), npc_crow = Color(50, 50, 105), npc_pigeon = Color(50, 50, 105), npc_seagull = Color(50, 50, 105), npc_crow = Color(50, 50, 105), npc_cscanner = Color(10, 100, 25), npc_citizen = Color(100, 255, 0), npc_vortigaunt = Color(0, 205, 0), npc_gman = Color(0, 0, 0), npc_alyx = Color(255, 255, 0), npc_dog = Color(255, 255, 70), npc_monk = Color(0, 0, 255), npc_barney = Color(0, 255, 255), npc_kleiner = Color(10, 175, 10), npc_zombie = Color(10, 175, 255), npc_headcrab = Color(0, 75, 255), npc_fast_zombie = Color(50, 175, 200), npc_poison_zombie = Color(8, 5, 180), npc_eli = Color(50, 150, 50) } CyberPunk = CyberPunk or {} function CyberPunk.DrawEXPBar(percent) -- Рисовалка exp бара. Туда броня будет писаться. local tab1 = { {x = width(0.0527), y = height(0.028)}, {x = width(0.1918), y = height(0.041)}, {x = width(0.19), y = height(0.047)}, {x = width(0.0527), y = height(0.035)} } draw.NoTexture() render.SetStencilWriteMask( 0xFF ) render.SetStencilTestMask( 0xFF ) render.SetStencilReferenceValue( 0 ) render.SetStencilPassOperation( STENCIL_KEEP ) render.SetStencilZFailOperation( STENCIL_KEEP ) render.ClearStencil() render.SetStencilEnable( true ) render.SetStencilReferenceValue( 1 ) render.SetStencilCompareFunction( STENCIL_NEVER ) render.SetStencilFailOperation( STENCIL_REPLACE ) surface.SetDrawColor(255, 255, 255, 255) surface.DrawPoly(tab1) render.SetStencilCompareFunction( STENCIL_EQUAL ) render.SetStencilFailOperation( STENCIL_KEEP ) local ply = FindMetaTable("Player") local wanted = isfunction(ply.GetWanted) and LocalPlayer():GetWanted() or isfunction(ply.GetDarkRPVar) and LocalPlayer():GetDarkRPVar "wanted" or isfunction(ply.getDarkRPVar) and LocalPlayer():getDarkRPVar "wanted" or false local sin = wanted and math.sin(CurTime()*2) * 100 or 0 local expcol = CyberPunk.GetColor(2) surface.SetDrawColor(124+sin, 154+sin, 148+sin) surface.DrawRect(width(0.0527), 0, width(0.1391), height(0.55) ) surface.SetDrawColor(expcol.r, expcol.g, expcol.b) surface.DrawRect(width(0.0527), 0, width(0.1391) * percent, height(0.55) ) render.SetStencilEnable( false ) end function CyberPunk.DrawHealthBar(percent, percent1) -- Сам хил бар. Сделал его не полностью попиксельно, тк мелким был сильно. local tab = { {x = width(0.0528), y = height(0.04)}, {x = width(0.1919), y = height(0.0536)}, {x = width(0.1919), y = height(0.062)}, {x = width(0.1852), y = height(0.069)}, {x = width(0.0528), y = height(0.054)} } draw.NoTexture() render.SetStencilWriteMask( 0xFF ) render.SetStencilTestMask( 0xFF ) render.SetStencilReferenceValue( 0 ) render.SetStencilPassOperation( STENCIL_KEEP ) render.SetStencilZFailOperation( STENCIL_KEEP ) render.ClearStencil() render.SetStencilEnable( true ) render.SetStencilReferenceValue( 1 ) render.SetStencilCompareFunction( STENCIL_NEVER ) render.SetStencilFailOperation( STENCIL_REPLACE ) surface.DrawPoly(tab) render.SetStencilCompareFunction( STENCIL_EQUAL ) render.SetStencilFailOperation( STENCIL_KEEP ) local red = CyberPunk.GetColor(1) surface.SetDrawColor(red.r-20, red.g-20, red.b-20) surface.DrawRect(width(0.0527), height(0.0316), width(0.1391), height(0.055) ) surface.SetDrawColor(red.r, red.g, red.b) surface.DrawRect(width(0.0527), height(0.0316), width(0.1391) * percent1, height(0.055) ) surface.SetDrawColor(red.r+20, red.g+20, red.b+20) surface.DrawRect(width(0.0527), height(0.0316), width(0.1391) * percent, height(0.055) ) render.SetStencilEnable( false ) local size1 = ( #tostring(LocalPlayer():Health()) * (math.Round( height(0.01953125) ) * 0.7) ) / ScrW() draw.SimpleText(tostring(LocalPlayer():Health()), "RobotronBlury" .. tostring( math.Round( height(0.01953125) )), width(0.19985), height(0.06640625), red) draw.SimpleText(tostring(LocalPlayer():GetMaxHealth()), "RobotronBlury" .. tostring(math.Round( height(0.01302) )), width(0.21 +size1), height(0.06640625), red) draw.SimpleText(tostring(LocalPlayer():Health()), "Robotron" .. tostring( math.Round( height(0.01953125) )), width(0.19985), height(0.06640625), red) draw.SimpleText(tostring(LocalPlayer():GetMaxHealth()), "Robotron" .. tostring(math.Round( height(0.01302) )), width(0.21 +size1), height(0.06640625), red) end function CyberPunk.DrawHealthBarPanel(number) -- Левая панелька с фицеркой. В игре обозначает вроде уровень, в игре фраги (счет игрока) draw.NoTexture() local blue = CyberPunk.GetColor(2) surface.SetDrawColor(blue.r, blue.g, blue.b) surface.DrawLine(width(0.0344), height(0.03125), width(0.05051), height(0.03385) ) surface.DrawLine(width(0.05051), height(0.03385), width(0.05051), height(0.0638)) surface.DrawLine(width(0.05051), height(0.0638), width(0.040995), height(0.0638) ) surface.DrawLine(width(0.040995), height(0.0638), width(0.0344), height(0.05208) ) surface.DrawLine(width(0.0344), height(0.05208), width(0.0344), height(0.03125) ) local size = math.Clamp( #tostring(number), 2, 32) draw.SimpleText(tostring(number), "RobotronBlury" .. tostring( math.Round(height(0.03 / size)) ), width(0.043 ), height(0.036 + #tostring(number) * 0.0015), blue, TEXT_ALIGN_CENTER) draw.SimpleText(tostring(number), "Robotron" .. tostring( math.Round(height(0.03 / size)) ), width(0.043 ), height(0.036 + #tostring(number) * 0.0015), blue, TEXT_ALIGN_CENTER) end function CyberPunk.DrawAdditionalBar(bars, percent) -- Нижний бар, раньше отвечал за стамину, скоро за доп патроны (и доп метры, например адреналин в Wheatley's parkour) draw.NoTexture() local blue = CyberPunk.GetColor(2) local red = CyberPunk.GetColor(1) surface.SetDrawColor(0, 0, 0) for i = 0, bars-1 do local lerp = 1 - math.Clamp( bars * percent - i, 0, 1) local x = width(0.05344) + width(0.0044506) * i local y = height(0.05859375) + height(0.00055) * i render.SetStencilWriteMask( 0xFF ) render.SetStencilTestMask( 0xFF ) render.SetStencilReferenceValue( 0 ) render.SetStencilPassOperation( STENCIL_KEEP ) render.SetStencilZFailOperation( STENCIL_KEEP ) render.ClearStencil() render.SetStencilEnable( true ) render.SetStencilReferenceValue( 1 ) render.SetStencilCompareFunction( STENCIL_NEVER ) render.SetStencilFailOperation( STENCIL_REPLACE ) -- surface.DrawRect(x, y, width(0.0035), height(0.016)) render.SetStencilCompareFunction( STENCIL_EQUAL ) render.SetStencilFailOperation( STENCIL_KEEP ) surface.SetDrawColor(blue.r, blue.g, blue.b) surface.DrawRect(x, y, width(0.0035), height(0.016)) surface.SetDrawColor(red.r, red.g, red.b) surface.DrawRect(x, y, width(0.0035), height(0.016) * lerp) render.SetStencilEnable( false ) end end CyberPunk = CyberPunk or {} function CyberPunk.DrawWeaponBar(weapon) if !IsValid(weapon) then return end local ammo = LocalPlayer():GetAmmoCount(weapon:GetPrimaryAmmoType()) local red = CyberPunk.GetColor(1) local blue = CyberPunk.GetColor(2) if (weapon:Clip1() == -1 or weapon:Clip1() == 0 )and ammo > 0 then -- Для ракет, гранат и тд draw.SimpleText(string.format("%03d", math.min( 999, ammo) ), "Robotron" .. tostring(math.floor(height( 0.02604))), width(0.836749634), height(0.9309895), blue, TEXT_ALIGN_RIGHT) draw.SimpleText(string.format("%03d", math.min( 999, ammo) ), "RobotronBlury" .. tostring(math.floor(height( 0.02604))), width(0.836749634), height(0.9309895), blue, TEXT_ALIGN_RIGHT) elseif weapon:Clip1() > 0 and weapon:HasAmmo() then -- Для всего другого draw.SimpleText(string.format("%03d", math.min( 999, weapon:Clip1()) ), "Robotron" .. tostring(math.floor(height( 0.02604))), width(0.836749634), height(0.9309895),blue, TEXT_ALIGN_RIGHT) draw.SimpleText(string.format("%03d", math.min( 999, weapon:Clip1()) ), "RobotronBlury" .. tostring(math.floor(height( 0.02604))), width(0.836749634), height(0.9309895),blue, TEXT_ALIGN_RIGHT) draw.SimpleText(string.format("%04d", math.min( 9999, ammo) ), "Robotron" .. tostring(math.floor(height(0.01953125))), width(0.8455344) , height( 0.9309895),red) draw.SimpleText(string.format("%04d", math.min( 9999, ammo) ), "RobotronBlury" .. tostring(math.floor(height(0.01953125))), width(0.8455344) , height( 0.9309895),red) end end function CyberPunk.DrawIcon(weapon) -- Позволяет получить иконку для выбора, или иконку для киллайкона или иконку из спавнменю. local weap = LocalPlayer():GetActiveWeapon() if CyberPunk.weaponstab[weap] then local mat = CreateMaterial( "CyberPunkHUDIcons", "UnLitGeneric", { ["$basetexture"] = "color/white", ["$model"] = 1, ["$translucent"] = 1, ["$vertexalpha"] = 1, ["$vertexcolor"] = 1, ["$additive"] = 1, }) mat:SetTexture("$basetexture", CyberPunk.weaponstab[weap]) surface.SetMaterial(mat) local red = CyberPunk.GetColor(1) surface.SetDrawColor(red.r, red.g, red.b, 255) surface.DrawTexturedRect(width(0.88360176) , height(0.871875), width(0.0937042459736457), height(0.1666666666666667)) end end CyberPunk = CyberPunk or {} -- ENUMS всегда не помешает CP_MOVE_UP = true CP_MOVE_DOWN = false hook.Add("CreateMove", "CyberPunkMove", function(cmd) if ( cmd:GetMouseWheel() != 0 ) and !cmd:KeyDown(IN_WEAPON1) and !cmd:KeyDown(IN_WEAPON2) and !cmd:KeyDown(IN_ATTACK) and !cmd:KeyDown(IN_ATTACK2) and !GetConVar("cb_selection"):GetBool() then if IsValid(CyberPunk.WeaponsMove(cmd:GetMouseWheel() > 0)) then cmd:SelectWeapon(CyberPunk.WeaponsMove(cmd:GetMouseWheel() > 0)) end end end) function CyberPunk.TranslateWeapons() local table1 = LocalPlayer():GetWeapons() table.sort( table1, function(a, b) return a:GetSlot() * 100000 + a:GetSlotPos() > b:GetSlot() * 100000 + b:GetSlotPos() end ) return table1 end function CyberPunk.WeaponsMove(bool, curpos, curpos1) -- ENUM'ки используем local table1 = CyberPunk.TranslateWeapons() local pos1 = curpos1 or table.KeyFromValue(table1, LocalPlayer():GetActiveWeapon()) or 1 if bool then return table1[pos1+1] or table1[1] else local len = #table1 return table1[pos1-1] or table1[len] end end CyberPunk.weaponstab = {} hook.Add("Think", "CyberPunkWeapons", function() local weap = LocalPlayer():GetActiveWeapon() if !IsValid(weap) then return end if !CyberPunk.weaponstab[weap] and #weap:GetModel() > 0 then CyberPunk.weaponstab[weap] = CyberPunk.CreateIcon(weap) end end) function CyberPunk.CreateIcon(weap) local icon = GetRenderTarget("CB/" .. weap:GetClass(), 256, 256, true) local weapmodel = weap:GetModel() render.PushRenderTarget(icon) local model = ClientsideModel(weapmodel) or weap local maxs, mins = model:GetModelBounds() local max, min =maxs:Length2D(), mins:Length2D() if model != weap then model:Remove() end local angle = math.abs(maxs[1])+math.abs(mins[1]) > math.abs(maxs[2])+math.abs(mins[2]) and Angle(0,90,0) or Angle(0,9,0) render.OverrideAlphaWriteEnable( true, true ) render.SetWriteDepthToDestAlpha( true ) render.Clear(0,0,0,0,true,true) render.SetStencilWriteMask( 0xFF ) render.SetStencilTestMask( 0xFF ) render.SetStencilReferenceValue( 0 ) render.SetStencilPassOperation( STENCIL_KEEP ) render.SetStencilFailOperation( STENCIL_KEEP ) render.SetStencilZFailOperation( STENCIL_KEEP ) render.ClearStencil() render.SetStencilEnable( true ) render.SetStencilReferenceValue( 1 ) render.SetStencilCompareFunction( STENCIL_EQUAL ) render.SetStencilFailOperation( STENCIL_REPLACE ) cam.Start3D(mins, Angle(0,0,0), min+max, 0, 0, icon:Width(), icon:Height(), 2, 512) render.Model({ model = weapmodel, pos = Vector(64,0,0) - Vector((maxs[1]-mins[1]) /2,(maxs[2]-mins[2]) /2,(maxs[3]-mins[3]) /2 ), angle = angle, }) cam.End3D() render.SetStencilCompareFunction( STENCIL_EQUAL ) render.ClearBuffersObeyStencil(255, 255, 255, 255, false); render.SetStencilEnable( false ) --- render.SetStencilWriteMask( 0xFF ) render.SetStencilTestMask( 0xFF ) render.SetStencilReferenceValue( 0 ) render.SetStencilPassOperation( STENCIL_KEEP ) render.SetStencilFailOperation( STENCIL_KEEP ) render.SetStencilZFailOperation( STENCIL_KEEP ) render.ClearStencil() render.SetStencilEnable( true ) render.SetStencilReferenceValue( 1 ) render.SetStencilCompareFunction( STENCIL_KEEP ) render.SetStencilFailOperation( STENCIL_REPLACE ) cam.Start3D(mins, Angle(0,0,0), (min+max)*1.03, 0, 0, icon:Width(), icon:Height(), 2, 512) render.Model({ model = weapmodel, pos = Vector(64,0,0) - Vector((maxs[1]-mins[1]) /2,(maxs[2]-mins[2]) /2,(maxs[3]-mins[3]) /2 ), angle = angle, }) cam.End3D() render.SetStencilCompareFunction( STENCIL_EQUAL ) render.ClearBuffersObeyStencil(125, 125, 125, 255, false); render.SetStencilEnable( false ) render.PopRenderTarget() return icon end