Files
2026-03-15 14:54:49 +03:00

572 lines
19 KiB
Lua
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
surface.CreateFont('ui.60', {font = 'roboto', size = 60, weight = 700, extended = true})
surface.CreateFont('ui.40', {font = 'roboto', size = 40, weight = 500, extended = true})
surface.CreateFont('ui.39', {font = 'roboto', size = 39, weight = 500, extended = true})
surface.CreateFont('ui.38', {font = 'roboto', size = 38, weight = 500, extended = true})
surface.CreateFont('ui.37', {font = 'roboto', size = 37, weight = 500, extended = true})
surface.CreateFont('ui.36', {font = 'roboto', size = 36, weight = 500, extended = true})
surface.CreateFont('ui.35', {font = 'roboto', size = 35, weight = 500, extended = true})
surface.CreateFont('ui.34', {font = 'roboto', size = 34, weight = 500, extended = true})
surface.CreateFont('ui.33', {font = 'roboto', size = 33, weight = 500, extended = true})
surface.CreateFont('ui.32', {font = 'roboto', size = 32, weight = 500, extended = true})
surface.CreateFont('ui.31', {font = 'roboto', size = 31, weight = 500, extended = true})
surface.CreateFont('ui.30', {font = 'roboto', size = 30, weight = 500, extended = true})
surface.CreateFont('ui.29', {font = 'roboto', size = 29, weight = 500, extended = true})
surface.CreateFont('ui.28', {font = 'roboto', size = 28, weight = 500, extended = true})
surface.CreateFont('ui.27', {font = 'roboto', size = 27, weight = 400, extended = true})
surface.CreateFont('ui.26', {font = 'roboto', size = 26, weight = 400, extended = true})
surface.CreateFont('ui.25', {font = 'roboto', size = 25, weight = 400, extended = true})
surface.CreateFont('ui.24', {font = 'roboto', size = 24, weight = 400, extended = true})
surface.CreateFont('ui.23', {font = 'roboto', size = 23, weight = 400, extended = true})
surface.CreateFont('ui.22', {font = 'roboto', size = 22, weight = 400, extended = true})
surface.CreateFont('ui.20', {font = 'roboto', size = 20, weight = 400, extended = true})
surface.CreateFont('ui.19', {font = 'roboto', size = 19, weight = 400, extended = true})
surface.CreateFont('ui.18', {font = 'roboto', size = 18, weight = 400, extended = true})
surface.CreateFont('ui.17', {font = 'roboto', size = 17, weight = 550, extended = true})
surface.CreateFont('ui.16', {font = 'roboto', size = 16, weight = 550, extended = true})
surface.CreateFont('ui.15', {font = 'roboto', size = 15, weight = 550, extended = true})
surface.CreateFont('ui.12', {font = 'roboto', size = 12, weight = 550, extended = true})
surface.CreateFont('ui.10', {font = 'roboto', size = 10, weight = 550, extended = true})
surface.CreateFont('ui.5percent', {font = 'roboto', size = math.ceil(ScrH() * 0.05), weight = 500, extended = true})
local CurTime = CurTime
local IsValid = IsValid
local ipairs = ipairs
local Color = Color
local DrawColorModify = DrawColorModify
local nw_GetGlobal = GetGlobalBool
local table_Filter = table.Filter
local player_GetAll = player.GetAll
local hook_Call = hook.Call
local GM = GAMEMODE or {}
timer.Simple(0.1,function()
GM = GAMEMODE
end)
local smoothHP = 0
local smoothAR = 0
local smoothHG = 0
local math_ceil = math.ceil
local math_sin = math.sin
local math_max = math.max
local draw_SimpleText = draw.SimpleText
local draw_SimpleTextOutlined = draw.SimpleTextOutlined
local draw_OutlinedBox = draw.OutlinedBox
local function draw_Box(x,y,w,h,col)
draw.RoundedBox(0,x,y,w,h,col)
end
local surface_SetDrawColor = surface.SetDrawColor
local surface_DrawLine = surface.DrawLine
local surface_DrawTexturedRect = surface.DrawTexturedRect
local surface_GetTextSize = surface.GetTextSize
local surface_SetFont = surface.SetFont
local surface_SetMaterial = surface.SetMaterial
local surface_DrawOutlinedRect = surface.DrawOutlinedRect
local surface_SetTextPos = surface.SetTextPos
local surface_SetTextColor = surface.SetTextColor
local surface_DrawText = surface.DrawText
local surface_DrawRect = surface.DrawRect
local cam_Start3D2D = cam.Start3D2D
local cam_End3D2D = cam.End3D2D
local color_white = color_white
local color_black = color_black
local color_red = Color(245,0,0)
local color_orange = Color(245,120,0)
local color_blue = Color(51,128,255)
local color_darkred = Color(100, 0, 0)
local color_15k = Color(240,191,0)
local color_gradient = Color(50, 50, 50)
local color_bg = Color(15,15,15,255)
local color_outline = Color(75,75,75,255):Copy()
local color_money = Color(135, 135, 31, 60)
local color_health = Color(82, 158, 60, 255)
local color_ph_health = Color(82, 158, 60, 60)
local color_armor = Color(37, 112, 153, 255)
local color_ph_armor = Color(37, 112, 153, 60)
local color_food = Color(217, 155, 11, 255)
local color_ph_food = Color(217, 155, 11, 60)
local color_job = Color(35, 31, 32, 60)
local color_grace = Color(76, 24, 84, 255)
local color_sup = Color(27, 82, 102, 60)
local color_agenda = Color(33, 92, 132, 60)
local color_laws = Color(135, 33, 33, 60)
local color_arrest_warrants = Color(211, 36, 36, 60)
local color_hits = Color(40, 40, 40, 60)
local lic_icon = Material("icon16/page.png")
local mat_laws = lic_icon
local material_licence = mat_laws
local hp_icon = Material("icon16/heart.png")
local ar_icon = Material("icon16/shield.png")
local hg_icon = Material("icon16/cup.png")
local want_icon = Material("icon16/star.png")
local money_icon = Material("icon16/money.png")
local time_icon = Material("icon16/clock.png")
local job_icon = Material("icon16/vcard.png")
local sw, sh = ScrW(), ScrH()
local height = 0
local LP
local players = {}
surface.CreateFont("Hud", {
font = "EuropaNuovaExtraBold",
extended = true,
size = 25,
weight = 500,
antialias = true,
})
surface.CreateFont("HudS", {
font = "EuropaNuovaExtraBold",
extended = true,
size = 23,
weight = 500,
antialias = true,
})
surface.CreateFont('HudFont', {
font = 'Tahoma',
size = 20,
weight = 350
})
surface.CreateFont('HudFontLaws', {
font = 'Roboto',
size = 19,
extended = true,
shadow = true,
weight = 350
})
surface.CreateFont('HudFont2', {
font = 'Tahoma',
size = 24,
weight = 700
})
surface.CreateFont('HudFont3', {
font = 'Tahoma',
size = 30,
weight = 700
})
surface.CreateFont('BannedInfo', {
font = 'Roboto',
size = 42,
weight = 700
})
surface.CreateFont('PlayerInfo', {
font = 'Tahoma',
extended = true,
outline = true,
shadow = true,
size = 128,
weight = 750
})
local talkingplayers = {}
hook.Add('PlayerStartVoice', 'rp.hud.PlayerStartVoice', function(pl)
talkingplayers[pl] = true
end)
hook.Add('PlayerEndVoice', 'rp.hud.PlayerEndVoice', function(pl)
talkingplayers[pl] = nil
end)
-- utils
local ColValues = {}
local function varcol(name, val)
if ColValues[name] == nil then
ColValues[name] = {}
ColValues[name].Old = val
ColValues[name].Flash = SysTime()
return color_white
end
if ColValues[name].Old ~= val then
ColValues[name].Flash = SysTime() + 0.2
ColValues[name].Old = val
return color_blue
end
if ColValues[name].Flash > SysTime() then
return color_blue
end
return color_white
end
local function SecondsToClock(seconds)
local seconds = tonumber(seconds)
if seconds <= 0 then
return "00:00:00";
else
hours = string.format("%02.f", math.floor(seconds/3600));
mins = string.format("%02.f", math.floor(seconds/60 - (hours*60)));
secs = string.format("%02.f", math.floor(seconds - hours*3600 - mins *60));
return hours..":"..mins..":"..secs
end
end
local blur = Material( "pp/blurscreen" )
function drawBlur( x, y, w, h, layers, density, alpha )
surface.SetDrawColor( 255, 255, 255, alpha )
surface.SetMaterial( blur )
for i = 1, layers do
blur:SetFloat( "$blur", ( i / layers ) * density )
blur:Recompute()
render.UpdateScreenEffectTexture()
render.SetScissorRect( x, y, x + w, y + h, true )
surface.DrawTexturedRect( 0, 0, ScrW(), ScrH() )
render.SetScissorRect( 0, 0, 0, 0, false )
end
end
function drawBlurPadded(x,y,w,h,layers,density,alpha,color)
--draw.RoundedBox(0,x,y,w,h,color)
drawBlur(x,y,w,h,layers,density,alpha)
surface_SetDrawColor(255,255,255,150)
surface_DrawOutlinedRect(x,y,w,h,2)
end
local function InfoBar()
if not IsValid(LP) then return end
local health = LP:Health()
function numh(numtokok)
if numtokok > 100 then
return 100
end
if numtokok <= 100 and numtokok >= 0 then
return numtokok
end
if numtokok < 0 then
return 0
end
end
smoothHP = numh(Lerp(10 * FrameTime(), smoothHP, health))
drawBlurPadded(10,ScrH()-170,450,50,3,5,255,Color(0,0,0,200))
draw_SimpleText("ММК RolePlay","ui.30",180,ScrH()-145,color_white,2,1)
drawBlurPadded(10,ScrH()-115,450,110,3,5,255,Color(0,0,0,200))
draw.RoundedBox(3,20,ScrH()-150+50,150,25,Color(122,89,89))
draw.RoundedBox(3,20,ScrH()-150+50,smoothHP*1.5,25,Color(222,91,91))
draw_SimpleText(health.."%","ui.20",168,ScrH()-137+50,color_white,2,1)
surface_SetDrawColor(color_white)
surface_SetMaterial(hp_icon)
local armor = LP:Armor()
smoothAR = numh(Lerp(10 * FrameTime(), smoothAR, armor))
surface_DrawTexturedRect(23,ScrH()-147+50,20,20)
draw.RoundedBox(3,20,ScrH()-120+50,150,25,Color(93,128,143))
draw.RoundedBox(3,20,ScrH()-120+50,smoothAR*1.5,25,Color(98,181,217))
draw_SimpleText(armor.."%","ui.20",168,ScrH()-107+50,color_white,2,1)
surface_SetDrawColor(color_white)
surface_SetMaterial(ar_icon)
local hunger = 100
smoothHG = numh(Lerp(10 * FrameTime(), smoothHG, hunger))
surface_DrawTexturedRect(23,ScrH()-117+50,20,20)
draw.RoundedBox(3,20,ScrH()-90+50,150,25,Color(74,125,82))
draw.RoundedBox(3,20,ScrH()-90+50,smoothHG*1.5,25,Color(84,179,99))
draw_SimpleText(hunger.."%","ui.20",168,ScrH()-77+50,color_white,2,1) --30
surface_SetDrawColor(color_white)
surface_SetMaterial(hg_icon)
surface_DrawTexturedRect(23,ScrH()-87+50,20,20)
if LP:getDarkRPVar("HasGunlicense") then
surface_SetDrawColor(color_white)
surface_SetMaterial(lic_icon)
surface_DrawTexturedRect(180,ScrH()-160,30,30)
else
surface_SetDrawColor(Color(100,100,100))
surface_SetMaterial(lic_icon)
surface_DrawTexturedRect(180,ScrH()-160,30,30)
end
local money = LP:getDarkRPVar("money")
draw.RoundedBox(3,180,ScrH()-100,20+surface.GetTextSize(DarkRP.formatMoney(money))+20,25,Color(124,156,96))
surface_SetDrawColor(color_white)
surface_SetMaterial(money_icon)
surface_DrawTexturedRect(183,ScrH()-98,20,20)
draw_SimpleText(DarkRP.formatMoney(money),"ui.20",205,ScrH()-138+50,color_white,0,1)
local job = team.GetName(LP:Team())
draw.RoundedBox(3,180,ScrH()-70,20+surface.GetTextSize(job)+20,25,Color(96, 156, 146))
surface_SetDrawColor(color_white)
surface_SetMaterial(job_icon)
surface_DrawTexturedRect(183,ScrH()-117+50,20,20)
draw_SimpleText(job,"ui.20",205,ScrH()-107+50,color_white,0,1)
local time = os.date("%H:%M:%S", os.time())
draw.RoundedBox(3,180,ScrH()-41,20+surface.GetTextSize(time)+20,25,Color(153,108,171))
surface_SetDrawColor(color_white)
surface_SetMaterial(time_icon)
surface_DrawTexturedRect(183,ScrH()-39,20,20)
draw_SimpleText(time,"ui.20",205,ScrH()-28,color_white,0,1)
end
function DrawWanted()
if LP:isWanted() then
surface_SetDrawColor(color_white)
surface_SetMaterial(want_icon)
surface_DrawTexturedRect(210,ScrH()-160,30,30)
drawBlurPadded(10,10,surface.GetTextSize('Вы в розыске за: ' .. tostring(LP:GetWantedReason()))*1.3,50,3,5,255,Color(0,0,0,200))
draw_SimpleText('Вы в розыске за: ' .. tostring(LP:GetWantedReason()),"ui.23",20,33,color_white,0,1)
else
surface_SetDrawColor(Color(100,100,100))
surface_SetMaterial(want_icon)
surface_DrawTexturedRect(210,ScrH()-160,30,30)
end
end
function DrawArrested()
if LP:isArrested() then
draw_SimpleTextOutlined('Вы на бутылке', 'HudFont2', sw/2, sh - 20, color_white, 1, 1, 1, color_black)
end
end
hook.Add("DrawDeathNotice", "DisableKills", function()
return 0,0
end)
function DrawLockdown()
surface_SetFont('HudFont2')
local w = surface_GetTextSize('На улицах объявлен коменданский час!') + 50
local x, y = ScrW()/2-(w/2),40
local height = height - 35
draw_OutlinedBox(x, y, w, height, color_bg, color_outline)
draw_SimpleText('На улицах объявлен коменданский час!', 'HudFont2', ScrW()/2,20, color_white, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
end
local blacklist = {
weapon_physcannon = true,
weapon_bugbait = true,
weapon_pickaxe = true
}
local function DrawAmmo()
local wep = LocalPlayer():GetActiveWeapon()
if IsValid(wep) then
-- if (wep.DrawCrosshair or (not wep.BaseClass)) then
-- local centerX, centerY = (sw * 0.5), (sh * 0.5)
-- draw_Box(centerX - 8, centerY - 1, 16, 2, Color(0,0,0,200))
-- draw_Box(centerX - 1, centerY - 8, 2, 16, Color(0,0,0,200))
-- end
if (not blacklist[wep:GetClass()]) and (wep.DrawAmmo ~= false) then
if (wep.SimpleAmmoCount) then
local w, h = 7 + 5, 41
local x, y = ScrW() - w - 10, ScrH() - h - 10
draw_SimpleText(LocalPlayer():GetAmmoCount(wep:GetPrimaryAmmoType()), 'HudFont3', ScrW()/2, ScrH()-15, color_white, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
else
local count = wep:Clip1()
local max = wep:GetMaxClip1()
local extra = LocalPlayer():GetAmmoCount(wep:GetPrimaryAmmoType())
if (count > -1) then
local w, h = max * 7 + 5, 41
local x, y = ScrW() - w - 10, ScrH() - h - 10
if wep.SelectiveFire then
draw_SimpleText("E+R Для смены режима", 'ui.25', ScrW()/2, ScrH()-45, color_white, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
end
draw_SimpleText(count .. '/' .. max .. ' - ' .. extra, 'HudFont3', ScrW()/2, ScrH()-15, color_white, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
end
end
end
end
end
local nodraw = {
CHudHealth = true,
CHudBattery = true,
CHudSuitPower = true,
CHudAmmo = true,
CHudSecondaryAmmo = true,
CHudWeaponSelection = true,
CHudCrosshair = true
}
hook.Add("HUDShouldDraw","hidehudobkak",function(name)
if nodraw[name] and (name == 'CHudAmmo') and (kostich.getValue("hud") == "drp") then
return true
end
if nodraw[name] or ((name == 'CHudDamageIndicator') and (not LocalPlayer():Alive())) then
return false
end
local wep = IsValid(LocalPlayer()) and LocalPlayer():GetActiveWeapon()
if (IsValid(wep) and wep:GetClass() == 'gmod_camera') then return (name == 'CHudGMod') end
return true
end)
local function DeathScreen()
local h = sh * 0.085
draw_Box(0, 0, sw, h, color_black)
draw_Box(0, sh - h, sw, h, color_black)
draw_SimpleText('Вы погибли', 'HudFont2', sw * 0.5, h * 0.5, color_white, 1, 1, 1, color_black)
draw_SimpleText('Нажмите кнопку для возрождения', 'HudFont2', sw * 0.5, sh - h * 0.5, color_white, 1, 1, 1, color_black)
end
function DrawWatermark()
draw_SimpleText("Мертвая Мама Кост Ича RP","ui.25",0,0,Color(255,255,255,150))
end
hook.Add("HUDPaint","kostichhud",function()
if MQS.CCam then return end
if kostich.getValue("hud") == "kostich" then
sw, sh = ScrW(), ScrH()
LP = LocalPlayer()
if (not LocalPlayer():Alive()) then
DeathScreen()
elseif IsValid(LocalPlayer():GetActiveWeapon()) and LocalPlayer():GetActiveWeapon():GetClass() == "gmod_camera" then
DrawWatermark()
else
InfoBar()
DrawAmmo()
DrawWanted()
DrawArrested()
if nw_GetGlobal('lockdown') then
DrawLockdown()
end
end
end
end)
timer.Create('rp.hud.DrawCache', 0.5, 0, function()
local LP = LocalPlayer()
players = player.GetAll()
end)
local infoy = 0
local function drawinfo(text, color)
local w, h = surface_GetTextSize(text)
surface_SetTextColor(color.r, color.g, color.b, color.a)
local x = -(w * 0.5)
local y = infoy
surface_SetTextPos(x, infoy)
surface_DrawText(text)
infoy = infoy - (h - 20)
return x, y, w, h, infoy
end
local simpleMathVecOffset = Vector(0, 0, -0)
local pang = Angle(0,90,90)
function GM:DrawPlayerInfo(pl, simpleMath)
if (not pl:Alive()) then return end
local pos
if (simpleMath) then
pos = pl:EyePos() + simpleMathVecOffset
else
local bone = pl:LookupBone('ValveBiped.Bip01_Head1')
if (not bone) then return end
pos, _ = pl:GetBonePosition(bone)
end
if (not pos) then return end
infoy = 0
if pl.InfoOffset then
pos.z = pos.z + pl.InfoOffset + 7.5
else
pos.z = pos.z + 12.5
end
pang.y = (LocalPlayer():EyeAngles().y - 90)
cam_Start3D2D(pos, pang, 0.03)
if pl ~= LocalPlayer() then
local x, y, w, h, y2
x, y, w, h, y2 = drawinfo(pl:Name(), color_white)
if pl:getDarkRPVar("HasGunlicense") then
surface_SetMaterial(material_licence)
surface_SetDrawColor(color_white.r, color_white.g, color_white.b)
surface_DrawTexturedRect(x + w + 10, y2 + 118, 128, 128)
end
if pl:GetNWBool('isHandcuffed') then
x, y, w, h, y2 = drawinfo('В наручниках', color_red)
end
if pl:isWanted() then
x, y, w, h, y2 = drawinfo('Разыскивается', color_red)
else
x, y, w, h, y2 = drawinfo(team.GetName(pl:Team()), team.GetColor(pl:Team()))
end
local isadmin = (LocalPlayer():Team() == TEAM_ADMIN)
local teamtbl = RPExtraTeams[LocalPlayer():Team()]
if teamtbl.medic or isadmin then
x, y, w, h, y2 = drawinfo(pl:Health() .. ' HP', color_red)
end
if (teamtbl.bmidealer or isadmin) and (pl:Armor() > 0) then
x, y, w, h, y2 = drawinfo(pl:Armor() .. ' Armor', color_blue)
end
if talkingplayers[pl] then
x, y, w, h, y2 = drawinfo('Говорит', color_white)
elseif pl:IsTyping() then
x, y, w, h, y2 = drawinfo('Печатает', color_white)
end
end
cam_End3D2D()
end
function GM:PostDrawTranslucentRenderables()
if (not IsValid(LocalPlayer())) then return end
surface_SetFont('PlayerInfo')
for k, v in ipairs(players) do
if IsValid(v) and not v:GetNWBool('Cloak') then
self:DrawPlayerInfo(v)
end
end
end