Doesn`t even make sense.
So im creating a Scoreboard right now, and i want to my a custom Font for it (default font pack but own settings), and when i go in game it makes a error with attempt to index global 'surface' (a nil value). Which it doesnt do on my HUD, which has the same kind of font creation.
Because even tho it makes a Error it still works, and the error dissapears after a few seconds, and i use the exact same way of creating a front in my HUD, which made no errors whatsoever. And both lua files, the HUD and my new addon, run clientside. So...wtf?
Most interesting: The error gets printed in the console in BLUE, so serverside. Even tho nothing is executed serverside... (its in singleplayer if thats important)
Post your code
And file paths
local ScoreboardDerma = nil
local PlayerList = nil
surface.CreateFont( "Board", {
font = "DermaDefault",
extended = false,
size = 20,
weight = 500,
blursize = 0,
scanlines = 0,
antialias = true,
underline = false,
italic = false,
strikeout = false,
symbol = false,
rotary = false,
shadow = false,
additive = false,
outline = false,
} )
hook.Add("ScoreboardShow", "ShapedScoreboardShow", function()
if !IsValid(ScoreboardDerma) then
ScoreboardDerma = vgui.Create("DFrame")
ScoreboardDerma:SetSize(750,500)
ScoreboardDerma:SetPos(ScrW()/5,ScrH()/2 - 250)
ScoreboardDerma:SetDraggable(false)
ScoreboardDerma:ShowCloseButton(false)
ScoreboardDerma:SetTitle("")
ScoreboardDerma.Paint = function()
draw.RoundedBox(0,0,0,ScoreboardDerma:GetWide(),ScoreboardDerma:GetTall(),Color(40,40,40,255))
draw.SimpleText("Shaped Scoreboard",Board,325,4,Color(255,255,255))
end
local PlayerScrollPanel = vgui.Create("DScrollPanel",ScoreboardDerma)
PlayerScrollPanel:SetSize(ScoreboardDerma:GetWide(),ScoreboardDerma:GetTall() -20)
PlayerScrollPanel:SetPos(0,20)
PlayerList = vgui.Create("DListLayout",PlayerScrollPanel)
PlayerList:SetSize(PlayerScrollPanel:GetWide(),PlayerScrollPanel:GetTall())
PlayerList:SetPos(0,0)
end
if IsValid(ScoreboardDerma) then
PlayerList:Clear()
for k, v in pairs(player.GetAll()) do
local PlayerPanel = vgui.Create("DPanel",PlayerList)
PlayerPanel:SetSize(PlayerList:GetWide(),50)
PlayerPanel:SetPos(0,0)
PlayerPanel.Paint = function()
draw.RoundedBox(0,0,0,PlayerPanel:GetWide(),PlayerPanel:GetTall(),Color(50,50,50,255))
draw.RoundedBox(0,0,49,PlayerPanel:GetWide(),1,Color(20,20,20,255))
draw.SimpleText(v:GetName(), "Board",20,14,Color(255,255,255))
draw.SimpleText("Kills: "..v:Frags(),"Board",PlayerList:GetWide()-20,5,Color(255,255,255),TEXT_ALIGN_RIGHT)
draw.SimpleText("Deaths: "..v:Deaths(),"Board",PlayerList:GetWide()-20,23,Color(255,255,255),TEXT_ALIGN_RIGHT)
end
end
ScoreboardDerma:Show()
ScoreboardDerma:MakePopup()
ScoreboardDerma:SetKeyBoardInputEnabled(false)
end
return false
end)
hook.Add("ScoreboardHide", "ShapedScoreboardHide", function()
if IsValid(ScoreboardDerma) then
ScoreboardDerma:Hide()
end
end)
file path is literally just addons/shapedscoreboard/lua/autorun/scoreboard.lua
also i just noticed, in sandbox the scoreboard appears and dissapears acordinly if you press TAB, in darkrp it comes, and then never dissapears again
lua/autorun/ runs on both the client and the server.
not if the file name starts with cl_
Move it into autorun/client
ye no file name means jack shit
vvvvvvvvvvvvvvvvvvv
alright that fixed it. and for some reason even the problem that the scoreboard doesnt dissapear in darkrp
You might want to override the function instead of using hook.Add, if you want to remove DarkRP's scoreboard.
You gotta disable fadmin to remove scoreboard in disable_defaults.lua
uuuh..no i dont
uuuh..ye u do, either that or remove the "ScoreboardShow/Hide" "FAdmin_scoreboard" hooks with hook.Remove in a hook that is called after darkrp and fadmin has loaded.
uuuh no i dont. i made the normal Scoreboardshow hook, and it replaced the darkrp one
hook.Add("ScoreboardShow","FAdmin_scoreboard",function()
hook.Remove("ScoreboardHide","FAdmin_scoreboard")
hook.Remove("ScoreboardShow","FAdmin_scoreboard")
end)
you can just call that to remove the hooks related to FAdmin's scoreboard
i think people here are not listening. The DarkRP Scoreboard got replaced WITHOUT anything of FAdmin. I literally just made my scoreboard in the scoreboardshow hook and it worked
Doesn't mean it's not there. It's better to disable the module as a whole instead.
Sorry, you need to Log In to post a reply to this thread.