• DarkRP HUD Error
    0 replies, posted
[B]Here is the code:[/B] [CODE]/*--------------------------------------------------------------------------- Drawing the HUD elements such as Health etc. ---------------------------------------------------------------------------*/ local function DoActualHUD() LocalPlayer().DarkRPVars = LocalPlayer().DarkRPVars or {} local v1 = LocalPlayer().DarkRPVars.money if not v1 then v1 = "" end local v2 = LocalPlayer().DarkRPVars.salary if not v2 then v2 = "" end // Draws the HUD draw.RoundedBox(5, 25, ScrH() - 50, 1310, 150, Color(25,25,25,200)) surface.SetDrawColor(255,255,255) // Icons surface.SetTexture(surface.GetTextureID("gui/silkicons/user")) surface.DrawTexturedRect(25 + 10,ScrH() - 30,16,16) surface.SetTexture(surface.GetTextureID("gui/silkicons/money")) surface.DrawTexturedRect(200 + 10,ScrH() - 30,16,16) surface.SetTexture(surface.GetTextureID("gui/silkicons/money_add")) surface.DrawTexturedRect(400 + 10,ScrH() - 30,16,16) surface.SetTexture(surface.GetTextureID("gui/silkicons/group")) surface.DrawTexturedRect(600 + 10,ScrH() - 30,16,16) surface.SetTexture(surface.GetTextureID("gui/silkicons/heart")) surface.DrawTexturedRect(850 + 10,ScrH() - 30,16,16) surface.SetTexture(surface.GetTextureID("gui/silkicons/shield")) surface.DrawTexturedRect(1100 + 10,ScrH() - 30,16,16) end //Information about your character draw.SimpleText("$" .. v1,"TargetID", 25 + 30,ScrH() - 145, Color(255,255,255), TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP) draw.SimpleText("$" .. v2,"TargetID", 25 + 30,ScrH() - 125, Color(255,255,255), TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP) draw.SimpleText(LocalPlayer().DarkRPVars.job,"TargetID", 25 + 30,ScrH() - 105, Color(255,255,255), TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP) draw.SimpleText(LocalPlayer():Health() ,"TargetID", 25 + 30,ScrH() - 85, Color(255,255,255), TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP) draw.SimpleText(LocalPlayer():Armor() ,"TargetID", 25 + 30,ScrH() - 65, Color(255,255,255), TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP) local function DrawHUD() localplayer = localplayer and IsValid(localplayer) and localplayer or LocalPlayer() if not IsValid(localplayer) then return end local shouldDraw = hook.Call("HUDShouldDraw", GAMEMODE, "DarkRP_HUD") if shouldDraw == false then return end Scrw, Scrh = ScrW(), ScrH() RelativeX, RelativeY = 0, Scrh DoActualHUD() GunLicense() Agenda() DrawVoiceChat() LockDown() Arrested() AdminTell() end[/CODE] [B]And here is the error:[/B] [QUOTE][ERROR] gamemodes/darkrp/gamemode/client/hud.lua:257: attempt to concatenate global 'v1' (a nil value) 1. unknown - gamemodes/darkrp/gamemode/client/hud.lua:257 2. include - [C]:-1 3. unknown - gamemodes/darkrp/gamemode/cl_init.lua:68[/QUOTE] [editline]7th August 2013[/editline] fixed [editline]7th August 2013[/editline] Ok i fixed the previous code i messed up with the end. But now im getting a random error. [QUOTE][ERROR] lua/includes/modules/draw.lua:86: bad argument #1 to 'GetTextSize' (string expected, got nil) 1. GetTextSize - [C]:-1 2. SimpleText - lua/includes/modules/draw.lua:86 3. DrawHUD - gamemodes/darkrp/gamemode/client/hud.lua:262 4. unknown - gamemodes/darkrp/gamemode/client/hud.lua:366 [/QUOTE]
Sorry, you need to Log In to post a reply to this thread.