• Need someone to lead in the right direction
    6 replies, posted
[B]I have look all over the internet but there I don't know where to start. I want to create a hud for darkrp can someone lead me to a good place to help me get started and i have a couple of questions if anyone know the answer it would help a lot. 1. Where should I start 2. Can you create a hud that works for all gamemodes 3. For darkrp hud do i have to start with the cl_hud.lua file and if you have anymore things i should know I would love hear it![/B]
How did you use google? [url]https://www.google.co.il/search?q=garrys+mod+how+to+make+an+hud&oq=garrys+mod+how+to+make+an+hud&aqs=chrome..69i57.8805j0j4&client=ms-android-om-lge&sourceid=chrome-mobile&espv=1&ie=UTF-8#q=garry%27s+mod+how+to+make+an+hud[/url]
1. Google, gmod wiki, youtube tutorials for scrubs by Seagull 2. Yes, but what for? It's better to have different versions of your HUD rather than one that has all the stuff packed in it. 3. No, it's completely optional, I personaly prefer the non-invadive way in which if you remove my HUD - the old HUD appears back. Use darkrpmodification.
[QUOTE=xMASTERofWARx;48030459][B]I have look all over the internet but there I don't know where to start. I want to create a hud for darkrp can someone lead me to a good place to help me get started and i have a couple of questions if anyone know the answer it would help a lot. 1. Where should I start 2. Can you create a hud that works for all gamemodes 3. For darkrp hud do i have to start with the cl_hud.lua file and if you have anymore things i should know I would love hear it![/B][/QUOTE] Ok, this is simple, but should lead you in the right direction: [lua] surface.CreateFont( "MyFont", { font = "Arial", size = 30, weight = 500, blursize = 0, scanlines = 0, antialias = true, underline = false, italic = false, strikeout = true, symbol = false, rotary = false, shadow = true, additive = false, outline = true, } ) function HUDHide( myhud ) for k, v in pairs{"CHudHealth", "CHudCrosshair"} do if (myhud == v) then return false end end end hook.Add("HUDShouldDraw","HUDHide",HUDHide) function GM:HUDPaint() self.BaseClass:HUDPaint() local HP = LocalPlayer():Health() local user = LocalPlayer():GetName() local food = LocalPlayer():GetNWFloat('food') local water = LocalPlayer():GetNWFloat('water') local cash = LocalPlayer():GetNWFloat('money') surface.SetTextColor( 64, 224, 208, 255 ) surface.SetTextPos( 20, 20) surface.SetFont("MyFont") surface.DrawText( "Your username:" ) surface.SetTextColor( Color(160, 20, 200, 255)) surface.DrawText( user ) surface.SetTextColor( 64, 224, 208, 255 ) surface.SetTextPos( 20, 80) surface.SetFont("MyFont") surface.DrawText( "Health:" ) surface.SetTextColor( Color(160, 20, 200, 255)) surface.DrawText( HP ) surface.SetTextColor( 64, 224, 208, 255 ) surface.SetTextPos( 20, 140) surface.SetFont("MyFont") surface.DrawText( "Hunger:" ) surface.SetTextColor( Color(160, 20, 200, 255)) surface.DrawText( food ) surface.SetTextColor( 64, 224, 208, 255 ) surface.SetTextPos( 20, 200) surface.SetFont("MyFont") surface.DrawText( "Thirst:" ) surface.SetTextColor( Color(160, 20, 200, 255)) surface.DrawText( water ) surface.SetTextColor( 64, 224, 208, 255 ) surface.SetTextPos( 20, 260) surface.SetFont("MyFont") surface.DrawText( "Cash:" ) surface.SetTextColor( Color(160, 20, 200, 255)) surface.DrawText( cash ) end [/lua] Obviously I have variables in there that you wont have, so just edit that to fit your ideas. Edit: Yes, that is in cl_init as HUD's are ran clientside
I'd recommend looking at the gmod wiki. It has some pretty useful documentation.
1. Check around the wiki's and youtube for some great tuts for n00bs 2. That would be a bit more advanced and you shouldn't worry about that now but yes, it is. 3. Don't touch the core files of darkrp. Edit the HUD using the darkrp modification addon folder. In there will be a readme and a hud replacement file found [URL="https://github.com/FPtje/darkrpmodification/blob/master/lua/darkrp_modules/hudreplacement/cl_hudreplacement.lua"]here[/URL].
Thanks for the font variable, I never knew how to do that and o have been making hues for ages ;)
Sorry, you need to Log In to post a reply to this thread.