Mon hud é cassé

  • Initiateur de la discussion
Deadman69330

Deadman69330

Psychopathe
Messages
2 289
Score réaction
309
Points
290
Bonswar


J'aurais besoin d'un coup de main pour mon petit HUD, c'est à dire que voilà le code:
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()/40,ScrW()/1.88,health*2,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()/40,ScrW()/1.88,health*2,30,Color(255,0,0,120)) end if armor > 0 and 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,armor*2-1,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)
Et quand je l'ai fait sur mon autre PC en solo tout était bien à sa place et quand j'arrive sur mon vrai PC tout est décalé pourtant j'ai bien mis les ScrW() et les ScrH() comme sur le wiki :'(




Et deuxième petit problème, la bouffe, j'ai fait une barre qui s'active que quand on à le hungermod d'activé (j'ai le "No Hunger when No Cook" ) sauf que si je laisse la barre tout le temps activée j'ai une erreur ULib et si je fait comme j'ai (if ply:getDarkRPVar("Energy") then ) elle ne s'active jamais :/



Merci bien de votre aide mesdames et messieurs
 
Discord d'entraide
Rejoignz-nous sur Discord