52 lines
1.0 KiB
Lua
52 lines
1.0 KiB
Lua
if SERVER then return true end
|
|
hi.gui = {}
|
|
hi.render = {}
|
|
hi.bar = {}
|
|
if not ui then error("please install glua-mod-ui to use this mod. (hi inventory)") return end
|
|
function hi.render.slot(material, text, width, height, r, g, b)
|
|
local slot = {
|
|
name = "layer",
|
|
{
|
|
name = "color",
|
|
r = r,
|
|
g = g,
|
|
b = b,
|
|
width = width,
|
|
height = height + 13
|
|
|
|
},
|
|
{
|
|
name = "vertical",
|
|
{
|
|
name = "opaque",
|
|
material = material,
|
|
width = width,
|
|
height = height
|
|
},
|
|
{
|
|
name = "label",
|
|
text = text
|
|
}
|
|
}
|
|
}
|
|
return slot
|
|
end
|
|
|
|
|
|
|
|
function hi.gui.draw_bar(posx, posy, inventory, index)
|
|
local array = { name = "horizontal" }
|
|
if not index then index = 0 end
|
|
for i = 0, 9, 1 do
|
|
if i == index then
|
|
table.insert(array,
|
|
hi.render.slot("models/wireframe", "crowbarzzz", 64, 64, 255, 10, 255))
|
|
else
|
|
table.insert(array,
|
|
hi.render.slot("models/wireframe", "crowbarzzz", 64, 64, 200, 100, 200))
|
|
end
|
|
end
|
|
hook.Remove("HUDPaint", "inventory_bar")
|
|
hook.Add("HUDPaint", "inventory_bar", function() ui.handle(array, posx, posy) end)
|
|
end
|