- Initiateur de la discussion
Luciano Leggio
Geek suprême
- Messages
- 702
- Score réaction
- 141
- Points
- 120
Bonjour j'ai recement décider de créer un hud propre pour mon serveur mais je rencontre un problème quand je rajoute la food.
voici l'erreur dans ma console.
Merci de votre aide
Code:
surface.CreateFont( "Erosium-1", { font = "Arial", extended = false, size = 13, weight = 500, blursize = 0, scanlines = 0, antialias = true, underline = false, italic = false, strikeout = false, symbol = false, rotary = false, shadow = false, additive = false, outline = false,
} )
local function DisplayNotify(msg) local txt = msg:ReadString() GAMEMODE:AddNotify(txt, msg:ReadShort(), msg:ReadLong()) surface.PlaySound("buttons/lightswitch2.wav") MsgC(Color(255, 20, 20, 255), "[DarkRP]", Color(200, 200, 200, 255), txt, "\n")
end usermessage.Hook("_Notify", DisplayNotify)
hook.Add("HUDPaint", "Erosium-HUD", function()
local health = LocalPlayer() :Health()
local armor = LocalPlayer() :Armor()
draw.RoundedBox(6, 20, ScrH() - 85, 250, 22, Color(72,72,72,255))
draw.RoundedBox(6, 20, ScrH() - 60, 250, 22, Color(72,72,72,255))
draw.RoundedBox(6, 20, ScrH() - 35, 250, 22, Color(72,72,72,255))
draw.RoundedBox(6, 20, ScrH() - 85, armor * 2.5, 22, Color(0,161,255,255))
draw.RoundedBox(6, 20, ScrH() - 60, health * 2.5, 22, Color(189,24,24,255))
draw.RoundedBox(6, 20, ScrH() - 35, food * 2.5, 22, Color(255,93,0,255))
end)
-- Retirer le HUD.
hook.Add("HUDShouldDraw", "DisableDarkRPHUD", function( name ) if name == "DarkRP_EntityDisplay" or name == "DarkRP_HUD" then return false end
end)
Code:
[ERROR] lua/hud_erosium.lua:34: attempt to perform arithmetic on global 'food' (a nil value) 1. v - lua/hud_erosium.lua:34 2. unknown - lua/includes/modules/hook.lua:84