Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- hud script!
- gih_y_modifier = 0
- function perc(targetnumber, curnumber)
- return math.ceil((curnumber * 100) / targetnumber)
- end
- function experienceForLevel(lvl)
- return (((50 * lvl * lvl * lvl) / 3) - (100 * lvl * lvl) + ((850 * lvl) / 3) - 200)
- end
- function formatstaminaintotime(staminaAmount)
- if (staminaAmount == 0) then
- return "00:00"
- else
- local nHours = string.format("%02.f", math.floor(staminaAmount / 60))
- local nMins = string.format("%02.f", math.floor(staminaAmount - (nHours * 60)))
- return nHours .. ":" .. nMins
- end
- end
- function getBestSkill()
- local skills = {
- {name = 'sword', p = swordpc},
- {name = 'axe', p = axepc},
- {name = 'club', p = clubpc},
- {name = 'dist', p = distancepc}
- }
- local max_skill = {id = 0, value = 0}
- for id, value in pairs({sword, axe, club, distance}) do
- if (value > max_skill.value) then
- max_skill.id = id
- max_skill.value = value
- end
- end
- return max_skill.value .. " " .. skills[max_skill.id].name .. " (" .. skills[max_skill.id].p .. "%)"
- end
- function getStatus(bool)
- return bool and "ON" or "OFF"
- end
- function __enable(__name)
- for _, section in ipairs(gih_hud_config) do
- if (section.title == __name) then
- section.enabled = not section.enabled
- return true
- end
- end
- return false
- end
- function getBool(s)
- return (s:lower() == "yes")
- end
- function t_setting(s)
- setsettings(s, ((getsettings(s):lower() == "yes") and "no" or "yes"))
- end
- function rgba_to_bgra(r, g, b, a)
- return b, g, r, a
- end
- function build_params(a)
- return 0.0, rgbcolor(rgba_to_bgra(unpack(a[1]))), 0.23, rgbcolor(rgba_to_bgra(unpack(a[2]))), 0.76, rgbcolor(rgba_to_bgra(unpack(a[3])))
- end
- function enableMovement()
- gih_moving.s = true
- gih_moving.sx = cursorinfo().cx
- gih_moving.sy = cursorinfo().cy
- end
- function disableMovement()
- if gih_moving.s then
- gih_moving.s = false
- gih_pos.x = gih_pos.x + cursorinfo().cx - gih_moving.sx
- gih_pos.y = gih_pos.y + cursorinfo().cy - gih_moving.sy
- end
- end
- -- tricky but works
- local cbid = 1
- onClick_callbacks = {}
- gih_y_modifier = gih_y_modifier + 10
- if not gih_font.default_font then
- setfontstyle(gih_font.name, gih_font.size, gih_font.style)
- end
- setpen(unpack(gih_colors.borders))
- if gih_colors.headers.gradient then
- addgradcolors(build_params(gih_colors.headers.gradmode))
- setfillstyle('gradient', 'linear', 1, 0, 0, 0, 50)
- else
- setfillcolor(unpack(gih_colors.headers.rgbamode))
- end
- local movable = addrect(gih_pos.x, gih_pos.y + gih_y_modifier, gih_width, 20)
- onClick_callbacks[cbid] = function()
- return enableMovement()
- end
- addevent(movable, MOUSE_LEFT_DOWN, "onClick_callbacks[" .. cbid .. "]()")
- cbid = cbid + 1
- onClick_callbacks[cbid] = function()
- return disableMovement()
- end
- addevent(movable, MOUSE_LEFT_UP, "onClick_callbacks[" .. cbid .. "]()")
- cbid = cbid + 1
- setfontcolor(unpack(gih_font.color))
- addtextstroke("General Information HUD v1.0.0+", gih_pos.x + 7, gih_pos.y + gih_y_modifier + 15)
- gih_y_modifier = gih_y_modifier + 20
- if script_infromation.show then
- setpen(unpack(gih_colors.borders))
- if gih_colors.headers.gradient then
- addgradcolors(build_params(gih_colors.headers.gradmode))
- setfillstyle('gradient', 'linear', 1, 0, 0, 0, 50)
- else
- setfillcolor(unpack(gih_colors.headers.rgbamode))
- end
- addrect(gih_pos.x, gih_pos.y + gih_y_modifier, gih_width / 2, 20)
- setfontcolor(unpack(gih_font.color))
- addtextstroke(script_infromation.sponsor, gih_pos.x + 7, gih_pos.y + gih_y_modifier + 15)
- setpen(unpack(gih_colors.borders))
- if gih_colors.itvalue.gradient then
- addgradcolors(build_params(gih_colors.itvalue.gradmode))
- setfillstyle('gradient', 'linear', 1, 0, 0, 0, 50)
- else
- setfillcolor(unpack(gih_colors.itvalue.rgbamode))
- end
- addrect(gih_pos.x + gih_width / 2, gih_pos.y + gih_y_modifier, gih_width / 2, 20)
- setfontcolor(unpack(gih_font.color))
- addtextstroke(script_infromation.website, gih_pos.x + 7 + gih_width / 2, gih_pos.y + gih_y_modifier + 15)
- gih_y_modifier = gih_y_modifier + 20
- setpen(unpack(gih_colors.borders))
- if gih_colors.ittitle.gradient then
- addgradcolors(build_params(gih_colors.ittitle.gradmode))
- setfillstyle('gradient', 'linear', 1, 0, 0, 0, 50)
- else
- setfillcolor(unpack(gih_colors.ittitle.rgbamode))
- end
- addrect(gih_pos.x, gih_pos.y + gih_y_modifier, gih_width, 20)
- setfontcolor(unpack(gih_font.color))
- addtextstroke(script_infromation.name, gih_pos.x + 7, gih_pos.y + gih_y_modifier + 15)
- gih_y_modifier = gih_y_modifier + 20
- setpen(unpack(gih_colors.borders))
- if gih_colors.ittitle.gradient then
- addgradcolors(build_params(gih_colors.ittitle.gradmode))
- setfillstyle('gradient', 'linear', 1, 0, 0, 0, 50)
- else
- setfillcolor(unpack(gih_colors.ittitle.rgbamode))
- end
- addrect(gih_pos.x, gih_pos.y + gih_y_modifier, gih_width / 2, 20)
- setfontcolor(unpack(gih_font.color))
- addtextstroke("Script version", gih_pos.x + 7, gih_pos.y + gih_y_modifier + 15)
- setpen(unpack(gih_colors.borders))
- if gih_colors.itvalue.gradient then
- addgradcolors(build_params(gih_colors.itvalue.gradmode))
- setfillstyle('gradient', 'linear', 1, 0, 0, 0, 50)
- else
- setfillcolor(unpack(gih_colors.itvalue.rgbamode))
- end
- addrect(gih_pos.x + gih_width / 2, gih_pos.y + gih_y_modifier, gih_width / 2, 20)
- setfontcolor(unpack(gih_font.color))
- addtextstroke(script_infromation.version, gih_pos.x + 7 + gih_width / 2, gih_pos.y + gih_y_modifier + 15)
- gih_y_modifier = gih_y_modifier + 20
- setpen(unpack(gih_colors.borders))
- if gih_colors.ittitle.gradient then
- addgradcolors(build_params(gih_colors.ittitle.gradmode))
- setfillstyle('gradient', 'linear', 1, 0, 0, 0, 50)
- else
- setfillcolor(unpack(gih_colors.ittitle.rgbamode))
- end
- addrect(gih_pos.x, gih_pos.y + gih_y_modifier, gih_width / 2, 20)
- setfontcolor(unpack(gih_font.color))
- addtextstroke("Author", gih_pos.x + 7, gih_pos.y + gih_y_modifier + 15)
- setpen(unpack(gih_colors.borders))
- if gih_colors.itvalue.gradient then
- addgradcolors(build_params(gih_colors.itvalue.gradmode))
- setfillstyle('gradient', 'linear', 1, 0, 0, 0, 50)
- else
- setfillcolor(unpack(gih_colors.itvalue.rgbamode))
- end
- addrect(gih_pos.x + gih_width / 2, gih_pos.y + gih_y_modifier, gih_width / 2, 20)
- setfontcolor(unpack(gih_font.color))
- addtextstroke(script_infromation.author, gih_pos.x + 7 + gih_width / 2, gih_pos.y + gih_y_modifier + 15)
- gih_y_modifier = gih_y_modifier + 20
- end
- for _, section in ipairs(gih_hud_config) do
- setpen(unpack(gih_colors.borders))
- if gih_colors.headers.gradient then
- addgradcolors(build_params(gih_colors.headers.gradmode))
- setfillstyle('gradient', 'linear', 1, 0, 0, 0, 50)
- else
- setfillcolor(unpack(gih_colors.headers.rgbamode))
- end
- addrect(gih_pos.x, gih_pos.y + gih_y_modifier, gih_width, 20)
- setfontcolor(unpack(gih_font.color))
- addtextstroke(section.title, gih_pos.x + 7, gih_pos.y + gih_y_modifier + 15)
- setpen(unpack(gih_colors.borders))
- if gih_colors.cstatus.gradient then
- addgradcolors(build_params(section.enabled and gih_colors.cstatus.gradmode.on or gih_colors.cstatus.gradmode.off))
- setfillstyle('gradient', 'linear', 1, 0, 0, 0, 50)
- else
- setfillcolor(unpack(section.enabled and gih_colors.cstatus.rgbamode.on or gih_colors.cstatus.rgbamode.off))
- end
- local minimizeRect = addrect(gih_pos.x + gih_width - 20, gih_pos.y + gih_y_modifier, 20, 20)
- onClick_callbacks[cbid] = function()
- return __enable(section.title)
- end
- addevent(minimizeRect, MOUSE_LEFT_DOWN, "onClick_callbacks[" .. cbid .. "]()")
- cbid = cbid + 1
- setfontcolor(unpack(gih_font.color))
- addtextstroke("-", gih_pos.x + 7 + gih_width - 20, gih_pos.y + gih_y_modifier + 15)
- gih_y_modifier = gih_y_modifier + 20
- if section.enabled then
- for _, item in ipairs(section.items) do
- setpen(unpack(gih_colors.borders))
- if gih_colors.ittitle.gradient then
- addgradcolors(build_params(gih_colors.ittitle.gradmode))
- setfillstyle('gradient', 'linear', 1, 0, 0, 0, 50)
- else
- setfillcolor(unpack(gih_colors.ittitle.rgbamode))
- end
- addrect(gih_pos.x, gih_pos.y + gih_y_modifier, gih_width / 2, 20)
- setfontcolor(unpack(gih_font.color))
- addtextstroke(item.name, gih_pos.x + 7, gih_pos.y + gih_y_modifier + 15)
- if (item.onClick == nil) then
- setpen(unpack(gih_colors.borders))
- if gih_colors.itvalue.gradient then
- addgradcolors(build_params(gih_colors.itvalue.gradmode))
- setfillstyle('gradient', 'linear', 1, 0, 0, 0, 50)
- else
- setfillcolor(unpack(gih_colors.itvalue.rgbamode))
- end
- addrect(gih_pos.x + gih_width / 2, gih_pos.y + gih_y_modifier, gih_width / 2, 20)
- setfontcolor(unpack(gih_font.color))
- addtextstroke(tostring(item.callback()), gih_pos.x + 7 + gih_width / 2, gih_pos.y + gih_y_modifier + 15)
- else
- local __status = item.callback()
- onClick_callbacks[cbid] = item.onClick
- setpen(unpack(gih_colors.borders))
- if gih_colors.cstatus.gradient then
- addgradcolors(build_params(__status and gih_colors.cstatus.gradmode.on or gih_colors.cstatus.gradmode.off))
- setfillstyle('gradient', 'linear', 1, 0, 0, 0, 50)
- else
- setfillcolor(unpack(__status and gih_colors.cstatus.rgbamode.on or gih_colors.cstatus.rgbamode.off))
- end
- local rect = addrect(gih_pos.x + gih_width / 2, gih_pos.y + gih_y_modifier, gih_width / 2, 20)
- addevent(rect, MOUSE_LEFT_DOWN, "onClick_callbacks[" .. cbid .. "]()")
- cbid = cbid + 1
- setfontcolor(unpack(gih_font.color))
- addtextstroke(getStatus(__status), gih_pos.x + 7 + gih_width / 2, gih_pos.y + gih_y_modifier + 15)
- end
- gih_y_modifier = gih_y_modifier + 20
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement