- Initiateur de la discussion
Deadman69330
Psychopathe
- Messages
- 2 289
- Score réaction
- 309
- Points
- 290
Bonjour
J'ai fait un hud mais j'ai 2 problèmes, la première, le HUD ne s'adapte pas à tous les écrans (j'ai pourtant utiliser le ScrH() et le ScrW()
et le deuxième problème, la barre de la bouffe ne s'active pas même quand il y a une cuisinier (je précise que j'ai le No Hunger when no cook"
J'aurais bien besoin de vous :/
Merci
J'ai fait un hud mais j'ai 2 problèmes, la première, le HUD ne s'adapte pas à tous les écrans (j'ai pourtant utiliser le ScrH() et le ScrW()
et le deuxième problème, la barre de la bouffe ne s'active pas même quand il y a une cuisinier (je précise que j'ai le No Hunger when no cook"
Code:
surface.CreateFont( "Keypad-hud-20", { font = "impact", size = 20, weight = 500, blursize = 0, scanlines = 0, antialias = true,
} )
surface.CreateFont( "Keypad-hud-15", { font = "impact", size = 15, weight = 500, blursize = 0, scanlines = 0, antialias = true,
} )
hook.Add("HUDPaint", "Dhud", function() local ply = LocalPlayer() local health = ply:Health() local armor = ply:Armor() if health <= 100 then draw.RoundedBox(4,ScrH()/46,ScrW()/1.89,204,37,Color(0,0,0,120)) draw.RoundedBox(4,ScrH()/44,ScrW()/1.885,health*2,30,Color(255,0,0,120)) elseif health > 100 then draw.RoundedBox(4,ScrH()/46,ScrW()/1.89,204,37,Color(0,0,0,120)) draw.RoundedBox(4,ScrH()/44,ScrW()/1.885,200,30,Color(255,0,0,120)) else draw.RoundedBox(4,ScrH()/46,ScrW()/1.89,204,37,Color(0,0,0,120)) draw.RoundedBox(4,ScrH()/44,ScrW()/1.885,health*2,30,Color(255,0,0,120)) end if armor > 0 and armor <= 100 then draw.RoundedBox(4,ScrH()/46,ScrW()/1.97,204,35,Color(0,0,0,120)) draw.RoundedBox(4,ScrH()/44,ScrW()/1.965,armor*2,30,Color(0,0,255,120)) elseif armor > 100 then draw.RoundedBox(4,ScrH()/44,ScrW()/2,204,35,Color(0,0,0,120)) draw.RoundedBox(4,ScrH()/40,ScrW()/1.99,199,30,Color(0,0,255,120)) end if LocalPlayer():getDarkRPVar("Energy") and armor == 0 then local hunger = ply:getDarkRPVar("Energy") draw.RoundedBox(4,ScrH()/43,ScrW()/2.159,204,35,Color(0,0,0,120)) draw.RoundedBox(4,ScrH()/40,ScrW()/2.15,hunger*2,30,Color(0,0,255,120)) elseif LocalPlayer():getDarkRPVar("Energy") and armor > 0 then local hunger = ply:getDarkRPVar("Energy") draw.RoundedBox(4,ScrH()/44,ScrW()/2.12,204,35,Color(0,0,0,120)) draw.RoundedBox(4,ScrH()/40,ScrW()/2.11,hunger*2,30,Color(0,255,0,120)) end if GetGlobalBool("DarkRP_LockDown") then draw.DrawText("Couvre-feu !","Keypad-hud-15", ScrW() / 40, ScrH()/50,Color(255,255,255),TEXT_ALIGN_CENTER) end ply = LocalPlayer() if !IsValid(ply:GetActiveWeapon()) then return end wep = ply:GetActiveWeapon() total = ply:GetAmmoCount(wep:GetPrimaryAmmoType()) clip = wep:Clip1() if clip < 0 or wep:GetClass() == "weapon_physcannon" then return end draw.RoundedBox(8,ScrW()/2.1,ScrH()/56,70,30 - 4,Color(0,0,0,120)) draw.SimpleText(clip.." / "..total,"Keypad-hud-20",ScrW()/2,ScrH()/50,Color(255,255,255),TEXT_ALIGN_CENTER)
end)
local hideHUDElements = { ["DarkRP_HUD"] = false, -- health bar and stuff, agenda, voice chat icons, lockdown text, player arrested ["DarkRP_EntityDisplay"] = false, -- draw informations above player AND doors, vehicles ["DarkRP_LocalPlayerHUD"] = true, -- Show health, job, salary, wallet BUT NOT HUNGER ["DarkRP_Hungermod"] = true, -- Blue bar in the bottom of the screen with hungermod ["DarkRP_Agenda"] = true, -- Drawing the DarkRP agenda ["DarkRP_LockdownHUD"] = true, -- Lockdown info on the HUD ["DarkRP_ArrestedHUD"] = false, -- Arrested HUD ["CHudHealth"] = true, ["CHudBattery"] = true, ["CHudAmmo "] = true, ["CHudHealth "] = true, ["CHudSecondaryAmmo "] = true,
}
hook.Add("HUDShouldDraw", "HideDefaultDarkRPHud", function(name) if hideHUDElements[name] then return false end
end)
Merci