• Get User Download HUD Pictures
    3 replies, posted
Im using this code ( this is a snippet ) in /garrysmod/gamemodes/darkrp/gamemode/client/hud.lua [CODE]local function DoActualHUD() --If the variables table has not be initialized, initialize it LocalPlayer().DarkRPVars = LocalPlayer().DarkRPVars or {} --If the money is not set, don't do anything local v1 = LocalPlayer().DarkRPVars.money if not v1 then v1 = "" end --If the salary is not set, don't do anything local v2 = LocalPlayer().DarkRPVars.salary if not v2 then v2 = "" end draw.RoundedBox(6, 25, ScrH() - 175, 300, 150, Color(25,25,25,200)) surface.SetDrawColor(255,255,255) surface.SetTexture(surface.GetTextureID("gui/silkicons/user")) surface.DrawTexturedRect(25 + 10,ScrH() - 160,16,16) surface.SetTexture(surface.GetTextureID("gui/silkicons/money")) surface.DrawTexturedRect(25 + 10,ScrH() - 140,16,16) surface.SetTexture(surface.GetTextureID("gui/silkicons/money_add")) surface.DrawTexturedRect(25 + 10,ScrH() - 120,16,16) surface.SetTexture(surface.GetTextureID("gui/silkicons/group")) surface.DrawTexturedRect(25 + 10,ScrH() - 100,16,16) surface.SetTexture(surface.GetTextureID("gui/silkicons/heart")) surface.DrawTexturedRect(25 + 10,ScrH() - 80,16,16) surface.SetTexture(surface.GetTextureID("gui/silkicons/shield")) surface.DrawTexturedRect(25 + 10,ScrH() - 59,16,16) draw.SimpleText(LocalPlayer():Nick(),"TargetID", 25 + 30,ScrH() - 145, Color(255,255,255), TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP) draw.SimpleText("$" .. v1,"TargetID", 25 + 30,ScrH() - 125, Color(255,255,255), TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP) draw.SimpleText("$" .. v2,"TargetID", 25 + 30,ScrH() - 105, Color(255,255,255), TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP) draw.SimpleText(LocalPlayer().DarkRPVars.job or "","TargetID", 25 + 30,ScrH() - 85, Color(255,255,255), TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP) local ply = LocalPlayer() local HP = ply:Health() local Armor = ply:Armor() draw.RoundedBox( 6, 55, ScrH() - 83, 240, 20, Color(0,0,0,200)) if HP ~= 0 then draw.RoundedBox( 6, 55, ScrH() - 83, math.Clamp( HP, 0, 240 )*2.4, 20, Color(220, 108, 108, 255)) end draw.SimpleText(LocalPlayer():Health() ,"TargetID", 25 + 130,ScrH() - 65, Color(255, 255, 255, 255), TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP) draw.RoundedBox( 6, 55, ScrH() - 60, 240, 20, Color(0,0,0,200)) if Armor ~= 0 then draw.RoundedBox( 6, 55, ScrH() - 60, math.Clamp( Armor, 0, 240 )*2.4, 20, Color(255, 255, 0, 255)) end draw.SimpleText(LocalPlayer():Armor() ,"TargetID", 25 + 130,ScrH() - 45, Color(255,255,255,255), TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP) end[/CODE] As you can see, it has custom pictures: [CODE]gui/silkicons/shield[/CODE] I have these pictures hosted on the server in /materials/gui/silkicons/picturehere. How do I get it where the user will download these pictures when they join so that they aren't purple and black squares?
resource.AddFile('materials/gui/silkicons/picturehere')
Okay... This doesnt work. I have this: [CODE]resource.AddFile("material/gui/silkicons/money_add.vmt") resource.AddFile("material/gui/silkicons/money_add.vtf") resource.AddFile("materials/gui/silkicons/group.vmt") resource.AddFile("materials/gui/silkicons/group.vtf") resource.AddFile("material/gui/silkicons/heart.vmt") resource.AddFile("materials/gui/silkicons/heart.vtf") resource.AddFile("materials/gui/silkicons/money.vmt") resource.AddFile("material/gui/silkicons/money.vtf") resource.AddFile("materials/gui/silkicons/shield.vmt") resource.AddFile("materials/gui/silkicons/shield.vtf") resource.AddFile("material/gui/silkicons/user.vmt") resource.AddFile("materials/gui/silkicons/user.vtf") resource.AddFile("materials/gui/silkicons/user_green.vtf")[/CODE] In /lua/autorun/client/download.lua It wont work. i've tried it in /server/download.lua aand also just /autorun/download.lua it never works!
They're all already there [URL="http://wiki.garrysmod.com/page/silkicons"]http://wiki.garrysmod.com/page/silkicons[/URL] [QUOTE]Where are they located now and which can I use? icon16/<name>.png[/QUOTE] [URL="http://www.famfamfam.com/lab/icons/silk/previews/index_abc.png"]http://www.famfamfam.com/lab/icons/silk/previews/index_abc.png[/URL]
Sorry, you need to Log In to post a reply to this thread.