• My hud is broken :'( Can anyone please fix?
    11 replies, posted
I use the Sany Allice V3 Hud but when you get a license you get script errors instead, this maybe because I think it was made for darkrp 2.4? --[[ Copyright (C) 2013 SanyHUD V3 This file is part of SanyHUD V3 SanyHUD V3 is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. SanyHUD V2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with SanyHUD V3. If not, see <http://www.gnu.org/licenses/>. --]] -- Settings local ArmorOrHunger = 2 -- Armor or hunger (1=Armor, 2=Hunger) local ServerName = "SanyAlliance" -- Colors local BorderColor = Color(0,0,0,200) local ArmorHungerColor = Color(50,150,250,255) local HealthColor = Color(255,0,0,255) local SalaryColor = Color(0,250,0,255) local WalletColor = Color(0,250,0,255) -- Var local Health = 0 local Armor = 0 local Hunger = 0 local hideHUDElements = { ["DarkRP_HUD"] = true, ["DarkRP_EntityDisplay"] = false, ["DarkRP_ZombieInfo"] = false, ["DarkRP_LocalPlayerHUD"] = true, ["DarkRP_Agenda"] = false, ["DarkRP_Hungermod"] = true, } hook.Add("HUDShouldDraw", "HideDefaultDarkRPHud", function(name) if hideHUDElements[name] then return false end end) local ConVars = {} local HUDWidth local HUDHeight local Color = Color local cvars = cvars local draw = draw local GetConVar = GetConVar local Lerp = Lerp local localplayer local pairs = pairs local SortedPairs = SortedPairs local string = string local surface = surface local table = table local tostring = tostring local Scrw, Scrh, RelativeX, RelativeY CreateClientConVar("weaponhud", 0, true, false) local function formatNumber(n) if not n then return "" end if n >= 1e14 then return tostring(n) end n = tostring(n) local sep = sep or "," local dp = string.find(n, "%.") or #n+1 for i=dp-4, 1, -3 do n = n:sub(1, i) .. sep .. n:sub(i+1) end return n end --[[ Base --]] local function Base() draw.RoundedBox(0, 10, ScrH() - 198, 425 + 4, 188, Color(0,0,0,200)) draw.RoundedBoxEx(6, 10, ScrH() - 210, 425 + 4, 12, BorderColor, true, true, false, false) draw.RoundedBoxEx(6, 10, ScrH() - 210, 425 + 4, 12, BorderColor, true, true, false, false) draw.DrawText("-----------------------------------------------------------", "HudSelectionText", 18, ScrH()-212, Color(255,255,255,255), TEXT_ALIGN_LEFT) -- Borders (Left, Right, Bottom) draw.RoundedBox(0, 10, ScrH() - 200, 2, 190, BorderColor) draw.RoundedBox(0, 437, ScrH() - 200, 2, 190, BorderColor) draw.RoundedBox(0, 12, ScrH() - 12, 425, 2, BorderColor) -- Boxes (Armor/Hunger, Health) draw.RoundedBox(0, 12, ScrH() - 41, 425, 24, Color(0,0,0,200)) draw.RoundedBox(0, 12, ScrH() - 70, 425, 24, Color(0,0,0,200)) -- Boxes (Salary, Wallet) draw.RoundedBox(0, 12, ScrH() - 100, 200, 24, Color(0,0,0,200)) draw.RoundedBox(0, 237, ScrH() - 100, 200, 24, Color(0,0,0,200)) -- Boxes (Name, Job) draw.RoundedBox(0, 115, ScrH() - 131, 322, 24, Color(0,0,0,200)) draw.RoundedBox(0, 115, ScrH() - 160, 322, 24, Color(0,0,0,200)) draw.RoundedBox(0, 115, ScrH() - 190, 322, 24, Color(0,0,0,200)) end --[[ Armor --]] local function Armor() local Armor = LocalPlayer():Armor() or 0 local Hunger = math.ceil(LocalPlayer():getDarkRPVar("Energy") or 0) if ArmorOrHunger == 1 then draw.RoundedBox(0, 16, ScrH() - 39, 417 * Armor / 100, 20, ArmorHungerColor) draw.RoundedBox(0, 16, ScrH() - 39, 417 * Armor / 100, 10, Color(255,255,255,10)) draw.DrawText("Armor: "..Armor.."%", "HudSelectionText", 21, ScrH()-36, Color(0,0,0,255), TEXT_ALIGN_LEFT) draw.DrawText("Armor: "..Armor.."%", "HudSelectionText", 20, ScrH()-37, Color(255,255,255,255), TEXT_ALIGN_LEFT) else draw.RoundedBox(0, 16, ScrH() - 39, 417 * Hunger / 100, 20, ArmorHungerColor) draw.RoundedBox(0, 16, ScrH() - 39, 417 * Hunger / 100, 10, Color(255,255,255,10)) draw.DrawText("Hunger: "..Hunger.."%", "HudSelectionText", 21, ScrH()-36, Color(0,0,0,255), TEXT_ALIGN_LEFT) draw.DrawText("Hunger: "..Hunger.."%", "HudSelectionText", 20, ScrH()-37, Color(255,255,255,255), TEXT_ALIGN_LEFT) end end --[[ Health --]] local function Health() local Health = LocalPlayer():Health() or 0 if Health < 0 then Health = 0 end local DrawHealth = math.Min(Health / GAMEMODE.Config.startinghealth, 1) draw.RoundedBox(0, 16, ScrH() - 68, 417 * DrawHealth, 20, HealthColor) draw.RoundedBox(0, 16, ScrH() - 68, 417 * DrawHealth, 10, Color(255,255,255,10)) draw.DrawText("Health: "..Health.."%", "HudSelectionText", 21, ScrH()-65, Color(0,0,0,255), TEXT_ALIGN_LEFT) draw.DrawText("Health: "..Health.."%", "HudSelectionText", 20, ScrH()-66, Color(255,255,255,255), TEXT_ALIGN_LEFT) end --[[ Job --]] local function Job() local Job = LocalPlayer():getDarkRPVar("job") or "" draw.DrawText("Job: "..Job, "HudSelectionText", 121, ScrH() - 155, Color(0,0,0,255), TEXT_ALIGN_LEFT) draw.DrawText("Job: "..Job, "HudSelectionText", 120, ScrH() - 156, Color(255,255,255,255), TEXT_ALIGN_LEFT) end --[[ Server --]] local function Server() draw.DrawText("Server: "..ServerName, "HudSelectionText", 121, ScrH() - 185, Color(0,0,0,255), TEXT_ALIGN_LEFT) draw.DrawText("Server: "..ServerName, "HudSelectionText", 120, ScrH() - 186, Color(255,255,255,255), TEXT_ALIGN_LEFT) end --[[ Salary --]] local function Salary() local Salary = "Salary: $"..formatNumber(LocalPlayer():getDarkRPVar("salary") or 0) draw.DrawText(Salary, "HudSelectionText", 111, ScrH() - 96, Color(0,0,0,255), TEXT_ALIGN_CENTER) draw.DrawText(Salary, "HudSelectionText", 110, ScrH() - 97, SalaryColor, TEXT_ALIGN_CENTER) end --[[ Wallet --]] local function Wallet() local Wallet = "Wallet: $"..formatNumber(LocalPlayer():getDarkRPVar("money") or 0) draw.DrawText(Wallet, "HudSelectionText", 338, ScrH() - 96, Color(0,0,0,255), TEXT_ALIGN_CENTER) draw.DrawText(Wallet, "HudSelectionText", 337, ScrH() - 97, WalletColor, TEXT_ALIGN_CENTER) end --[[ Avatar --]] AvatarC = 0 local function Avatar() if AvatarC == 0 then AvatarC = 1 local Avatar = vgui.Create( "AvatarImage" ) Avatar:SetSize( 84,84 ) Avatar:SetPos( 20, ScrH() - 191 ) Avatar:SetPlayer( LocalPlayer(), 64 ) end end --[[ Name --]] local function Name() local Name = "Name: "..LocalPlayer():Nick() draw.DrawText(Name, "HudSelectionText", 121, ScrH() - 127, Color(0,0,0,255), TEXT_ALIGN_LEFT) draw.DrawText(Name, "HudSelectionText", 120, ScrH() - 128, Color(255,255,255,255), TEXT_ALIGN_LEFT) end local Page = Material("icon16/page_white_text.png") local function GunLicense() if LocalPlayer():getDarkRPVar("HasGunlicense") then surface.SetMaterial(Page) surface.SetDrawColor(255, 255, 255, 255) surface.DrawTexturedRect(RelativeX + HUDWidth, ScrH() - 34, 32, 32) end end local function Agenda() local shouldDraw = hook.Call("HUDShouldDraw", GAMEMODE, "DarkRP_Agenda") if shouldDraw == false then return end local DrawAgenda, AgendaManager = DarkRPAgendas[LocalPlayer():Team()], LocalPlayer():Team() if not DrawAgenda then for k,v in pairs(DarkRPAgendas) do if table.HasValue(v.Listeners or {}, LocalPlayer():Team()) then DrawAgenda, AgendaManager = DarkRPAgendas[k], k
Couldn't you just use Pastebin to paste this huge piece of Text?
If you want people to help you, post any errors you're getting from this or explain it better then just dumping your code and leaving it at that. I'd suggest you do what SpookyWookie said and paste all that on pastebin and then send us the link.
[lua] if ply:getDarkRPVar("HasGunlicense") then surface.SetMaterial( Material( "icon16/page_white_text.png" ) ) surface.SetDrawColor(255,255,255,255) surface.DrawTexturedRect(pos.x-16, pos.y + 60, 32, 32) [/lua]
1. [ lua] [ /lua] tags around code 2. Error Code?
"[B][I][U]My hud[/U][/I][/B] is broken :'( Can anyone please fix?" *cough* bullshit *cough*
Why not ask the creator?
Oh god, what have you done...
Also, this is the Garry's Mod Discussion Forum. Support post goes on the HELP & SUPPORT Forum :)
[QUOTE=SpookyWookiee;44729513]Also, this is the Garry's Mod Discussion Forum. Support post goes on the HELP & SUPPORT Forum :)[/QUOTE] Developer discussion is for lua help. Read the sticky in the Help & Support forum.
[QUOTE=Milkshaker;44727142][lua] if ply:getDarkRPVar("HasGunlicense") then surface.SetMaterial( Material( "icon16/page_white_text.png" ) ) surface.SetDrawColor(255,255,255,255) surface.DrawTexturedRect(pos.x-16, pos.y + 60, 32, 32) [/lua][/QUOTE] Hey where do I put that in the code?
What happened here? local Salary = "Salary: $"..formatNumber(LocalPlayer():getDarkRPVar([b]"salar y"[/b]) or 0) Should be: local Salary = "Salary: $"..formatNumber(LocalPlayer():getDarkRPVar([b]"salary"[/b]) or 0)
Sorry, you need to Log In to post a reply to this thread.