Discord
Steam
/
Developers
/
Font problem
Login/Join
Event Log
Font problem
2 replies, posted
Search
In This Thread
Hello, I was trying to make an HUD and it worked propally but since I restarted my game, it seems to get mad and doesn't work. Here is my lua error (I didn't have it before the restart) : [ERROR] lua/includes/modules/draw.lua:65: 'police' isn't a valid font 1. SetFont - [C]:-1 2. SimpleText - lua/includes/modules/draw.lua:65 3. v - lua/lol.lua:94 4. unknown - lua/includes/modules/hook.lua:84 Here is my code : hook.Add("HUDShouldDraw", "myHudHider", hidehud); local function CreateMyFont() surface.CreateFont( "police", { font = "Arial", -- Use the font-name which is shown to you by your operating system Font Viewer, not the file name extended = false, size = 20, weight = 500, blursize = 0, scanlines = 0, antialias = true, underline = false, italic = false, strikeout = false, symbol = false, rotary = false, shadow = false, additive = false, outline = false, } ) end local function CreateMyFont2() surface.CreateFont( "grand", { font = "Arial", -- Use the font-name which is shown to you by your operating system Font Viewer, not the file name extended = false, size = 25, weight = 500, blursize = 0, scanlines = 0, antialias = true, underline = false, italic = false, strikeout = false, symbol = false, rotary = false, shadow = false, additive = false, outline = false, } ) end local grandCreate = true hook.Add("HUDPaint", "TutoHUD", function() draw.RoundedBox( 5, 5, 825, 470, 210, Color(50, 50, 50, 255) )-- carré gauche noir drit draw.RoundedBox( 0, 5, 965, 150, 80, Color(50, 50, 50, 255) ) draw.RoundedBox( 5, 150, 825, 335, 220, Color(50, 50, 50, 255) )--cadre noir à droite draw.RoundedBox( 3, 140, 915, 345, 10, Color(60, 60, 60, 255) ) -- séparation grise horizontale grande draw.RoundedBox( 3, 140, 825, 10, 220, Color(60, 60, 60, 255) ) --séparation verticale grande draw.RoundedBox( 3, 5, 960,135, 10, Color(60, 60, 60, 255) ) -- séparation grise horizontale draw.RoundedBox( 3, 380, 825, 10, 100, Color(60, 60, 60, 255) ) --séparation verticale --hp local health = LocalPlayer():Health() if shouldCreate then shouldCreate = false --Set it to false, so we don't call this function again! CreateMyFont() ----Call the function end if grandCreate then grandCreate = false --Set it to false, so we don't call this function again! CreateMyFont2() ----Call the function end if LocalPlayer():Health() <= 100 then draw.RoundedBox( 3, 228, 940, 254, 24, Color(40, 40, 40, 255) ) -- noir draw.RoundedBox( 5, 230, 942, health * 2.5, 20, Color(184, 39, 39, 255) ) --rouge draw.SimpleText(health.." %", "police", 345, 942.5, Color(255,255,255)) elseif LocalPlayer():Health() > 100 then draw.RoundedBox( 3, 228, 940, 254, 24, Color(40, 40, 40, 255) ) -- noir draw.RoundedBox( 5, 230, 942, 250, 20, Color(184, 39, 39, 255) ) --rouge draw.SimpleText(health.." %", "police", 345, 942.5, Color(255,255,255)) end --armure local armor = LocalPlayer():Armor() if LocalPlayer():Armor() <= 100 then draw.RoundedBox( 3, 228, 970, 254, 24, Color(40, 40, 40, 255) ) -- noir draw.RoundedBox( 5, 230, 972, armor *2.5, 20, Color(52, 126, 158, 255)) --bleu draw.SimpleText(armor.." %", "police", 345, 972, Color(255,255,255)) elseif LocalPlayer():Armor() >100 then draw.RoundedBox( 3, 228, 970, 254, 24, Color(40, 40, 40, 255) ) -- noir draw.RoundedBox( 5, 230, 972, 250, 20, Color(52, 126, 158, 255)) --bleu draw.SimpleText(armor.." %", "police", 345, 972.5, Color(255,255,255)) end --nom local name = LocalPlayer():Name() draw.SimpleText(name, "grand", 240, 840, Color(255,255,255))-- nom local job = team.GetName(LocalPlayer():Team()) draw.SimpleText(job, "grand", 240, 880, Color(255,255,255))-- job local faim = math.ceil(LocalPlayer():getDarkRPVar("Energy") or 0) draw.RoundedBox( 3, 228, 1000, 254, 24, Color(40, 40, 40, 255) ) -- noir draw.RoundedBox( 5, 230, 1002, 250, 20, Color(255, 120, 0, 255)) --bleu draw.SimpleText(faim.." %", "police", 345, 1002.5, Color(255,255,255)) --nourriture local money = LocalPlayer():getDarkRPVar("money") draw.SimpleText( money.." $", "police", 80, 1010, Color( 255, 255, 255, 255 )) local salaire = LocalPlayer():getDarkRPVar("salary") -- labels draw.SimpleText(salaire.." $", "police", 80, 980, Color(255,255,255)) draw.SimpleText("Nom :", "grand", 157, 840, Color(255,255,255))-- nom draw.SimpleText("Vie :", "police", 183, 941, Color(255,255,255))-- vie draw.SimpleText("Armure :", "police", 153, 971, Color(255,255,255))-- armure draw.SimpleText("Métier :", "grand", 157, 880, Color(255,255,255))-- job draw.SimpleText("Salaire :", "police", 10, 980, Color(255,255,255)) draw.SimpleText("Fonds :", "police", 10, 1010, Color(255,255,255)) draw.SimpleText("Infos :", "grand", 40, 830, Color(255,255,255))-- nom draw.SimpleText("Faim :", "police", 169, 1001, Color(255,255,255))--faim end) --salaire -- Retirer le HUD Paint hook.Add( "HUDShouldDraw", "DefautHUD", function ( name ) if ( name == "CHudHealth" or name == "CHudBattery" ) then return false end end)
Why are you creating the fonts later on? Just put them at the top of the script, outside of a function, and create them immediately.
What kind of genius are you ? Thank you so much !!
Sorry, you need to
Log In
to post a reply to this thread.