• Im dumb and confused a custom .jpg for my hud shows up as an error, help :|
    6 replies, posted
Code: surface.CreateFont( "Server", {     font = "Trebuchet18",     size = 35,     weight = 500, } ) if SERVER then   resource.AddFile("materials/birbshud/materials/vgui/birbhudclan.jpg") end local birb = Material("materials/birbshud/materials/vgui/birbhudclan.jpg") function DrawHud()   draw.DrawText("You are playing on the Birbs&Parrots Clan Server", "Server", 0 , 0, Color(11, 170, 157, 255), TEXT_ALIGN_TOP )     surface.SetDrawColor( 255, 255, 255, 255 )     surface.SetMaterial(birb)     surface.DrawTexturedRect(630, 0, 50, 50) end  hook.Add("HUDPaint", "hud", DrawHud) DIR of the .jpg garrysmod/addons/birbshud/materials/vgui/birbhudclan.jpg
First at all...Use PNG or vtf, don't use jpeg, second, your resource.AddFile doesn't make sense AT ALL It will try to find the file on garrysmod/materials/birbshud/materials/vgui/birbhudclan.jpg It's only materials/vgui/birbhudclan.jpg AND DONT USE JPEG, also be sure the file it's power of 2, not 50x50, it should be 32x32, 64x64, 32x64, etc
k
Only this: vgui/birbhudclan.png
its still an error: surface.CreateFont( "Server", {     font = "Trebuchet18",     size = 35,     weight = 500, } ) if SERVER then   resource.AddFile("materials/vgui/birbhudclan.png") end local birb = Material("vgui/birbhudclan.png") function DrawHud()   draw.DrawText("You are playing on the Birbs&Parrots Clan Server", "Server", 0 , 0, Color(11, 170, 157, 255), TEXT_ALIGN_TOP )     surface.SetDrawColor( 255, 255, 255, 255 )     surface.SetMaterial(birb)     surface.DrawTexturedRect(630, 0, 50, 50) end  hook.Add("HUDPaint", "hud", DrawHud)
i can already tell you that once you got the code running, the "you aare playing on bla bla" will SPAM nonstop. You re-render it nonstop in the hook
You're still using a jpeg file with png as extension, the path is wrong, you're not running this in a shared file, you are calling surface.CreateFont in server. Also what's the file name, i see that you're adding if SERVER then but above that you're running surface.CreateFont, that means if you were running a shared code, it would error and the resource wouldn't never be sent to clients You should learn about realms (Client, server and shared) and also read errors from your console
Sorry, you need to Log In to post a reply to this thread.