So I made a DarkRP hud and its all working n shit but its in my darkrpmodificationmaster/lua/darkrp_modules and there and I want it to be in addons so its much simpler to install but I cant figure out how to do that...
put it in
addons/lua/autorun/yourhudfile.lua
I do that but then only the player model I put on my hud shows up.
Do you get any errors when its in that location? check client console and server console
Nope 0 errors they just dont show up
..so you used a premade picture to use on the hud?
mm I used a script that makes it takes the player model and adds it the hud so when you change jobs and such it changes the player model and thats the only thing that shows up when I move my hud from darkrp_modules to addons
Could you show screenshots or the code?
This is the code of the player model if this is what you want
local function DrawPlayerModel()
PlayerModel = vgui.Create("DModelPanel")
function PlayerModel:LayoutEntity( Entity ) return end
PlayerModel:SetModel( LocalPlayer():GetModel() )
PlayerModel:SetPos(18, ScrH() - 190)
PlayerModel:SetSize(80,80)
PlayerModel:SetCamPos(Vector( 20, 0, 65 ))
PlayerModel:SetLookAt(Vector( 0, 0, 65 ))
timer.Create( "UpdatePlayerModel", 0.5, 0, function()
if LocalPlayer():GetModel() != PlayerModel.Entity:GetModel() then
PlayerModel:Remove()
PlayerModel = vgui.Create("DModelPanel")
function PlayerModel:LayoutEntity( Entity ) return end
PlayerModel:SetModel( LocalPlayer():GetModel())
PlayerModel:SetPos(18, ScrH() - 190)
PlayerModel:SetSize(80,80)
PlayerModel:SetCamPos(Vector( 20, 0, 65 ))
PlayerModel:SetLookAt(Vector( 0, 0, 65 ))
end
end)
end
hook.Add("InitPostEntity", "DrawPlayerModel", DrawPlayerModel)
in the timer you dont need to remove the PlayerModel panel, you can just set the model again
But thats not my issue its with all the other elements they wont show up like the rounded boxes, texts, jobs, money,, salary, rpname and so on they dont show up when its in addons
also make sure in the rest of your hud, its using the hook "HUDPaint"
Using HUDPaint for what? Im still a little new to lua coding rn lol
Drawing the rest of the HUD like a roundedbox... etc
Show the code for the HUD that isnt showing up
This is the boxes
draw.RoundedBox(6, ScrW() / 200, ScrH () / 1.085, 450, 70, Color(46, 46, 52, 255)) -- Large gray box in the bottom left
draw.RoundedBox(6, ScrW() / 200, ScrH () / 1.2, 450, 100, Color(46, 46, 52, 100)) -- Large see-through box in the bottom left
draw.RoundedBox(6, ScrW() / 75, ScrH () / 1.193, 65, 65, Color(46, 46, 52, 255)) -- Small gray box behind the player model in the bottom left
Are those inside a function or hook?
Not sure what you mean but if you remove 2 of them it leaves you with 1 of the rounded boxes it leaves you with this
draw.RoundedBox(6, ScrW() / 200, ScrH () / 1.085, 450, 70, Color(46, 46, 52, 255)) -- Large gray box in the bottom left
if you have not hooked your draw.roundedbox's then it wont draw them.
hook.Add("HUDPaint", "drawmyhud", function()
draw.RoundedBox(6, ScrW() / 200, ScrH () / 1.085, 450, 70, Color(46, 46, 52, 255))
draw.RoundedBox(6, ScrW() / 200, ScrH () / 1.2, 450, 100, Color(46, 46, 52, 100))
draw.RoundedBox(6, ScrW() / 75, ScrH () / 1.193, 65, 65, Color(46, 46, 52, 255))
end)
When I put that code in it gives me a completely different error and still the boxes dont show up
what is the error?
Never had this one before...
[ERROR] addons/airhud/lua/autorun/airhud.lua:447: attempt to index global 'GAMEMODE' (a nil value)
1. unknown - addons/airhud/lua/autorun/airhud.lua:447
what is on line 447
Never touched this even
function GAMEMODE:DrawDeathNotice(x, y)
if not GAMEMODE.Config.showdeaths then return end
self.BaseClass:DrawDeathNotice(x, y)
end
If you made a custom HUD, this should not be in your HUD.
Did you just edit one of the base files to add your HUD?
Yeah I did
Create a new file in the addons path i said above, then add your hud stuff in that file, make sure you have that hook i said.
If you need help watch CodeBlues tutorials:
Part 1
Part 2
Sorry, you need to Log In to post a reply to this thread.