Problem with my Gamemode

HEy. Uhm. I set up a gmod server yesterday… and uhm. I have one big problem with my gamemode there.
When someone connects he does not download the hud and the scoreboard .lua. so it looks like the base.
That Sucks. But i added “AddCSLuaFile” or how its called. But that does not work. Please help me

/edit:
Oh uhm. The Scoreboard ist from the Base…

show your game modes init.lua file please

[lua]
AddCSLuaFile(“shared.lua”)
AddCSLuaFile(“Deathfix.lua”)
AddCSLuaFile(“cl_hud.lua”)
AddCSLuaFile(‘cl_scoreboard.lua’)
include(‘shared.lua’)
include (‘cl_scoreboard.lua’)
include (‘cl_hud.lua’)
include(‘Deathfix.lua’)
include(‘admin.lua’)

//Player Speed
CreateConVar(“AdvancedSB_Team_Admin_WalkSpeed”,“360”)
CreateConVar(“AdvancedSB_Team_Admin_RunSpeed”,“420”)
CreateConVar(“AdvancedSB_Team_Guest_WalkSpeed”,“320”)
CreateConVar(“AdvancedSB_Team_Guest_RunSpeed”,“360”)
CreateConVar(“AdvancedSB_Fire_Ext_Player”,“1”)
CreateConVar(“AdvancedSB_Fire_Ext_Prop”,“1”)
CreateConVar(“AdvancedSB_Surf”,“1”)
CreateConVar(“AdvancedSB_FallDamage”,“1”)

local AdminWSpeed = GetConVarNumber(“AdvancedSB_Team_Admin_WalkSpeed”)
local AdminRSpeed = GetConVarNumber(“AdvancedSB_Team_Admin_RunSpeed”)
local GuestWSpeed = GetConVarNumber(“AdvancedSB_Team_Guest_WalkSpeed”)
local GuestRSpeed = GetConVarNumber(“AdvancedSB_Team_Guest_RunSpeed”)
local FirePlayer = GetConVarNumber(“AdvancedSB_Fire_Ext_Player”)
local FireProp = GetConVarNumber(“AdvancedSB_Fire_Ext_Prop”)
local Surf = GetConVarNumber(“AdvancedSB_Surf”)
local FILE_PATH = “players.txt”

//Lets Spawn the Player
FILE_PATH = “players.txt”
TEAM_NUMBER = “3”

function GM:PlayerSpawn(ply)
self.BaseClass:PlayerSpawn( ply )
ply:SetGravity( 0.75 )
ply:SetMaxHealth(150,true)
ply:SetWalkSpeed(300)

if file.Exists(FILE_PATH) then
    local boom = string.Explode("

", file.Read(FILE_PATH))
if table.HasValue(boom, ply:SteamID()) then
ply:SetTeam(TEAM_NUMBER)
else
// MAKES THE PLAYER JOIN TEAM 1 IF NOT IN PLAYERS.TXT FILE
ply:SetTeam(2)
end
else
file.Write(FILE_PATH, “”)
end
if ply:IsAdmin() then
ply:SetTeam (1)
ply:SetWalkSpeed(AdminWSpeed)
ply:SetRunSpeed (AdminRSpeed)
end

end
[/lua]

try including them in your cl_init instead of your init


 inlcude('cl_scoreboard.lua')

I did alrady :confused:

Post your cl_scoreboard. May help us recognise the problem.

[lua]

/---------------------------------------------------------
Name: gamemode:ScoreboardShow( )
Desc: Sets the scoreboard to visible
---------------------------------------------------------
/
function GM:ScoreboardShow()
GAMEMODE.ShowScoreboard = true
end

/---------------------------------------------------------
Name: gamemode:ScoreboardHide( )
Desc: Hides the scoreboard
---------------------------------------------------------
/
function GM:ScoreboardHide()
GAMEMODE.ShowScoreboard = false
end

// TODO: CLEAN THIS CODE

function GM:GetTeamScoreInfo()

local TeamInfo = {}

for id,pl in pairs( player.GetAll() ) do

	local _team = pl:Team()
	local _frags = pl:Frags()
	local _deaths = pl:Deaths()
	local _ping = pl:Ping()
	
	if (not TeamInfo[_team]) then
		TeamInfo[_team] = {}
		TeamInfo[_team].TeamName = team.GetName( _team )
		TeamInfo[_team].Color = team.GetColor( _team )
		TeamInfo[_team].Players = {}
	end		
	
	local PlayerInfo = {}
	PlayerInfo.Frags = _frags
	PlayerInfo.Deaths = _deaths
	PlayerInfo.Score = _frags - _deaths
	PlayerInfo.Ping = _ping
	PlayerInfo.Name = pl:Nick()
	PlayerInfo.PlayerObj = pl
	
	local insertPos = #TeamInfo[_team].Players + 1
	for idx,info in pairs(TeamInfo[_team].Players) do
		if (PlayerInfo.Frags > info.Frags) then
			insertPos = idx
			break
		elseif (PlayerInfo.Frags == info.Frags) then
			if (PlayerInfo.Deaths < info.Deaths) then
				insertPos = idx
				break
			elseif (PlayerInfo.Deaths == info.Deaths) then
				if (PlayerInfo.Name < info.Name) then
					insertPos = idx
					break
				end
			end
		end
	end
	
	table.insert(TeamInfo[_team].Players, insertPos, PlayerInfo)
end

return TeamInfo

end

function GM:HUDDrawScoreBoard()

if (!GAMEMODE.ShowScoreboard) then return end

if (GAMEMODE.ScoreDesign == nil) then

	GAMEMODE.ScoreDesign = {}
	GAMEMODE.ScoreDesign.HeaderY = 0
	GAMEMODE.ScoreDesign.Height = ScrH() / 2
	

end

local alpha = 255

local ScoreboardInfo = self:GetTeamScoreInfo()

local xOffset = ScrW() / 10
local yOffset = 32
local scrWidth = ScrW()
local scrHeight = ScrH() - 64
local boardWidth = scrWidth - (2* xOffset)
local boardHeight = scrHeight
local colWidth = 75

boardWidth = math.Clamp( boardWidth, 400, 600 )
boardHeight = GAMEMODE.ScoreDesign.Height

xOffset = (ScrW() - boardWidth) / 2.0
yOffset = (ScrH() - boardHeight) / 2.0
yOffset = yOffset - ScrH() / 4.0
yOffset = math.Clamp( yOffset, 32, ScrH() )

// Background

local hostname = GetHostName()
local gamemodeName = GAMEMODE.Name .. " - " .. GAMEMODE.Author

surface.SetTextColor( 255, 255, 255, 255 )
draw.RoundedBox(8, xOffset, yOffset	, boardWidth, GAMEMODE.ScoreDesign.Height, Color(0,0,0,160))	
if ( string.len(hostname) > 32 ) then
	surface.SetFont( "ScoreboardSub" )
else
	surface.SetFont( "ScoreboardHead" )
end

local txWidth, txHeight = surface.GetTextSize( hostname )
local y = yOffset + 15
surface.SetTextPos(xOffset + (boardWidth / 2) - (txWidth/2), y)
surface.DrawText( hostname )

y = y + txHeight + 2

surface.SetTextColor( 255, 255, 255, 255 )
surface.SetFont( "ScoreboardSub" )
local txWidth, txHeight = surface.GetTextSize( gamemodeName )
surface.SetTextPos(xOffset + (boardWidth / 2) - (txWidth/2), y)
surface.DrawText( gamemodeName )

y = y + txHeight + 4
GAMEMODE.ScoreDesign.HeaderY = y - yOffset

surface.SetDrawColor( 0, 0, 0, 100 )
surface.DrawRect( xOffset, y-1, boardWidth, 1)

surface.SetDrawColor( 255, 255, 255, 20 )
surface.DrawRect( xOffset + boardWidth - (colWidth*1), y, colWidth, boardHeight-y+yOffset )

surface.SetDrawColor( 255, 255, 255, 20 )
surface.DrawRect( xOffset + boardWidth - (colWidth*3), y, colWidth, boardHeight-y+yOffset )


surface.SetFont( "ScoreboardText" )
local txWidth, txHeight = surface.GetTextSize( "W" )

surface.SetDrawColor( 0, 0, 0, 0 )
surface.DrawRect( xOffset, y, boardWidth, txHeight + 6 )

y = y + 2

surface.SetTextPos( xOffset + 16,								y)	surface.DrawText("#Name")
surface.SetTextPos( xOffset + boardWidth - (colWidth*3) + 8,	y)	surface.DrawText("#Score")
surface.SetTextPos( xOffset + boardWidth - (colWidth*2) + 8,	y)	surface.DrawText("#Deaths")
surface.SetTextPos( xOffset + boardWidth - (colWidth*1) + 8,	y)	surface.DrawText("#Ping")

y = y + txHeight + 4

local yPosition = y
for team,info in pairs(ScoreboardInfo) do
	
	local teamText = info.TeamName .. "  (" .. #info.Players .. " Players)"
	
	surface.SetFont( "ScoreboardText" )
	surface.SetTextColor( 0, 0, 0, 255 )
	
	txWidth, txHeight = surface.GetTextSize( teamText )
	surface.SetDrawColor( info.Color.r, info.Color.g, info.Color.b, 255 )
	draw.RoundedBox( 8,xOffset + 3, yPosition, boardWidth+3, txHeight + 4,Color (info.Color.r, info.Color.g, info.Color.b, 255))
	yPosition = yPosition + 2
	surface.SetTextPos( xOffset + boardWidth/2 - txWidth/2, yPosition )
	surface.DrawText( teamText )
	yPosition = yPosition + 2
					

	
	yPosition = yPosition + txHeight + 2
	
	for index,plinfo in pairs(info.Players) do
		
		surface.SetFont( "ScoreboardText" )
		surface.SetTextColor( info.Color.r, info.Color.g, info.Color.b , 255 )
		surface.SetTextPos( xOffset + 18, yPosition )
		txWidth, txHeight = surface.GetTextSize( plinfo.Name )
		
		if (plinfo.PlayerObj == LocalPlayer()) then
			surface.SetDrawColor( info.Color.r, info.Color.g + 100, info.Color.b - 100, 160 )
			surface.DrawRect( xOffset+1, yPosition, boardWidth - 2, txHeight + 2)
			surface.SetTextColor( info.Color.r, info.Color.g, info.Color.b, 250 )
		end
		
		
		local px, py = xOffset + 16, yPosition
		local textcolor = Color( 255,255,255, 255 )
		local shadowcolor = Color( 0, 0, 0, alpha * 0.8 )
		
		
		draw.SimpleText( plinfo.Name, "ScoreboardText", px+1, py+1, shadowcolor )
		draw.SimpleText( plinfo.Name, "ScoreboardText", px, py, textcolor )
		
		px = xOffset + boardWidth - (colWidth*3) + 8			
		draw.SimpleText( plinfo.Frags, "ScoreboardText", px+1, py+1, shadowcolor )
		draw.SimpleText( plinfo.Frags, "ScoreboardText", px, py, textcolor )
		
		px = xOffset + boardWidth - (colWidth*2) + 8			
		draw.SimpleText( plinfo.Deaths, "ScoreboardText", px+1, py+1, shadowcolor )
		draw.SimpleText( plinfo.Deaths, "ScoreboardText", px, py, textcolor )
		
		px = xOffset + boardWidth - (colWidth*1) + 8			
		draw.SimpleText( plinfo.Ping, "ScoreboardText", px+1, py+1, shadowcolor )
		draw.SimpleText( plinfo.Ping, "ScoreboardText", px, py, textcolor )
		
		//surface.DrawText( plinfo.Name )
		//surface.SetTextPos( xOffset + 16 + 2, yPosition + 2 )
		//surface.SetTextColor( 0, 0, 0, 200 )
		//surface.DrawText( plinfo.Name )

		//surface.SetTextPos( xOffset + boardWidth - (colWidth*3) + 8, yPosition )
		//surface.DrawText( plinfo.Frags )

		//surface.SetTextPos( xOffset + boardWidth - (colWidth*2) + 8, yPosition )
		//surface.DrawText( plinfo.Deaths )

		//surface.SetTextPos( xOffset + boardWidth - (colWidth*1) + 8, yPosition )
		//surface.DrawText( plinfo.Ping )

		yPosition = yPosition + txHeight + 3
	end
end

yPosition = yPosition + 8

GAMEMODE.ScoreDesign.Height = (GAMEMODE.ScoreDesign.Height * 2) + (yPosition-yOffset)
GAMEMODE.ScoreDesign.Height = GAMEMODE.ScoreDesign.Height / 3

end

[/lua]

But Also the Hud does not work too :frowning:

p3ace maker i would like to see your cl_init also because the hud and the scoreboard are both client side.

AddCSLuaFile(“shared.lua”)
AddCSLuaFile(“Deathfix.lua”)
AddCSLuaFile(“cl_hud.lua”)
AddCSLuaFile(‘cl_scoreboard.lua’)
include(‘shared.lua’)
include (‘cl_scoreboard.lua’)
include (‘cl_hud.lua’)
include(‘Deathfix.lua’)
include(‘admin.lua’)

is deathfix a rendering or client side thing or a server side because from what i see there you need in your cl_init simply


 include('shared.lua') include('cl_scoreboard.lua') include('cl_hud.lua')

I could be completely wrong with that though.

You need to include cl_scoreboard.lua in your cl_init, and in init.lua, you need to AddCSLuaFile.

Okay works now. Thanks ^^

Your welcome.