[LUA] Question

  • Initiateur de la discussion Luciano Leggio
  • Date de début
  • Initiateur de la discussion
Luciano Leggio

Luciano Leggio

Geek suprême
Messages
702
Score réaction
141
Points
120
Bonjour, j'ai récemment décidé de créer un HUD pour mon serveur.. J'ai suivis plusieurs tuto sur YouTube mais une erreur lua apparaît.

Code:
[ERROR] lua/erosium_hud.lua:51: ')' expected near 'ScrH' 1. unknown - lua/erosium_hud.lua:0
Voici mon code

Code:
surface.CreateFont( "Ero-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,
} )
surface.CreateFont( "Ero-2", { font = "Arial", extended = false, size = 30, weight = 500, blursize = 0, scanlines = 0, antialias = true, underline = false, italic = false, strikeout = false, symbol = false, rotary = false, shadow = false, additive = false, outline = false,
} )
hook.Add("HUDPaint", "HUD ERO", function() local function DisplayNotify(msg) local txt = msg:ReadString() GAMEMODE:AddNotify(txt, msg:ReadShort (), msg: ReadShort()) surface.PlaySound("buttons/lightswitch2.wav") MsgC(Color(255, 20, 20, 255), "[Zaref] ", Color(200, 200, 200, 255), txt, "\n")
end usermessage.Hook("_Notify", DisplayNotify)
local health = LocalPlayer():Health()
local armor = LocalPlayer () :Armor()
local job = teamGetName(LocalPlayer():Team() )
local money = LocalPlayer():GetDarkRPVar ("money")
local name = LocalPlayer() :Name()
draw.RoundedBox(4, 6 ScrH() - 20, 308, 18 Color(0,0,0,255))
draw.RoundedBox(4, 6 ScrH() - 43, 308, 18 Color(0,0,0,255))
draw.RoundedBox(4, 10 ScrH() - 20, health * 2, 14, Color(189,24,24,255))
draw.RoundedBox(4, 10 ScrH() - 41, armor * 2, 14, Color(29, 36, 127))
draw.simpleText (health, "Ero-1", 150, ScrH() - 21, Color(255,255,255,255))
draw.simpleText (armor, "Ero-1", 150, ScrH() - 44, Color(255,255,255,255))
draw.simpleText (job, "Ero-2", 150, ScrH() - 250, Color(255,255,255,255))
draw.simpleText (money.." D", "Ero-2", 150, ScrH() - 250, Color(255,255,255,255))
draw.simpleText (name, "Ero-2", 150, ScrH() - 600, Color(255,255,255,255))
hook.Add( "HUDShouldDraw", "DefautHUD", function( name ) if ( name == "CHudHealth" or name == "CHudBattery" ) then return false end
end )
Merci de votre aide bonne journée
 
thepsyca

thepsyca

Psychopathe
Messages
2 164
Score réaction
648
Points
365
Code:
hook.Add("HUDPaint", "HUD ERO", function() local function DisplayNotify(msg) local txt = msg:ReadString() GAMEMODE:AddNotify(txt, msg:ReadShort (), msg: ReadShort()) surface.PlaySound("buttons/lightswitch2.wav") MsgC(Color(255, 20, 20, 255), "[Zaref] ", Color(200, 200, 200, 255), txt, "\n")
end usermessage.Hook("_Notify", DisplayNotify)
local health = LocalPlayer():Health()
local armor = LocalPlayer () :Armor()
local job = teamGetName(LocalPlayer():Team() )
local money = LocalPlayer():GetDarkRPVar ("money")
local name = LocalPlayer() :Name()
draw.RoundedBox(4, 6, ScrH() - 20, 308, 18, Color(0,0,0,255))
draw.RoundedBox(4, 6, ScrH() - 43, 308, 18, Color(0,0,0,255))
draw.RoundedBox(4, 10, ScrH() - 20, health * 2, 14, Color(189,24,24,255))
draw.RoundedBox(4, 10, ScrH() - 41, armor * 2, 14, Color(29, 36, 127))
draw.simpleText (health, "Ero-1", 150, ScrH() - 21, Color(255,255,255,255))
draw.simpleText (armor, "Ero-1", 150, ScrH() - 44, Color(255,255,255,255))
draw.simpleText (job, "Ero-2", 150, ScrH() - 250, Color(255,255,255,255))
draw.simpleText (money.." D", "Ero-2", 150, ScrH() - 250, Color(255,255,255,255))
draw.simpleText (name, "Ero-2", 150, ScrH() - 600, Color(255,255,255,255))
end)
hook.Add( "HUDShouldDraw", "DefautHUD", function( name ) if ( name == "CHudHealth" or name == "CHudBattery" ) then return false end
end )
Tu avais oublié des virgules et un end )
 
  • J'aime
Réactions: Luciano Leggio
  • Initiateur de la discussion
Luciano Leggio

Luciano Leggio

Geek suprême
Messages
702
Score réaction
141
Points
120
thepsyca à dit:
Code:
hook.Add("HUDPaint", "HUD ERO", function() local function DisplayNotify(msg) local txt = msg:ReadString() GAMEMODE:AddNotify(txt, msg:ReadShort (), msg: ReadShort()) surface.PlaySound("buttons/lightswitch2.wav") MsgC(Color(255, 20, 20, 255), "[Zaref] ", Color(200, 200, 200, 255), txt, "\n")
end usermessage.Hook("_Notify", DisplayNotify)
local health = LocalPlayer():Health()
local armor = LocalPlayer () :Armor()
local job = teamGetName(LocalPlayer():Team() )
local money = LocalPlayer():GetDarkRPVar ("money")
local name = LocalPlayer() :Name()
draw.RoundedBox(4, 6, ScrH() - 20, 308, 18, Color(0,0,0,255))
draw.RoundedBox(4, 6, ScrH() - 43, 308, 18, Color(0,0,0,255))
draw.RoundedBox(4, 10, ScrH() - 20, health * 2, 14, Color(189,24,24,255))
draw.RoundedBox(4, 10, ScrH() - 41, armor * 2, 14, Color(29, 36, 127))
draw.simpleText (health, "Ero-1", 150, ScrH() - 21, Color(255,255,255,255))
draw.simpleText (armor, "Ero-1", 150, ScrH() - 44, Color(255,255,255,255))
draw.simpleText (job, "Ero-2", 150, ScrH() - 250, Color(255,255,255,255))
draw.simpleText (money.." D", "Ero-2", 150, ScrH() - 250, Color(255,255,255,255))
draw.simpleText (name, "Ero-2", 150, ScrH() - 600, Color(255,255,255,255))
end)
hook.Add( "HUDShouldDraw", "DefautHUD", function( name ) if ( name == "CHudHealth" or name == "CHudBattery" ) then return false end
end )
Tu avais oublié des virgules et un end )
Merci tout est réglé.
 
  • J'aime
Réactions: thepsyca
  • Initiateur de la discussion
Luciano Leggio

Luciano Leggio

Geek suprême
Messages
702
Score réaction
141
Points
120
Re, c'est encore moi,

J'ai une barre infinie lorsque je me set à plus de 100HP j'aimerais pouvoir régler cela
J'aimerais également mettre mettre des petits logo à côté des barres que j'ai crée

Auriez vous une idée ?
 
Discord d'entraide
Rejoignz-nous sur Discord