Gamemode broke itself

call method ‘HUDDrawPickupHistory’ (a nil value)(Hook: HUDPaint)
[gamemodes\base\gamemode\cl_init.lua:101] attempt to call method ‘HUDDrawPickupHistory’ (a nil value)(Hook: HUDPaint)

That repeats in console when I load my fretta gamemode. What’s confusing, is I haven’t done anything client-side. So why is it suddenly deciding to break like this?

my cl_init.lua:

[lua]
DeriveGamemode( “fretta” )
include( ‘shared.lua’ )

– Send clientside files
AddCSLuaFile( “cl_init.lua” )
AddCSLuaFile( “shared.lua” )
[/lua]

my shared.lua:

[lua]
GM.Name = “GMOD:RPG”
GM.Author = “InstantDeath”
//rest of Gamemode infos here

GM.Data = {}

DeriveGamemode( “fretta” )
include( ‘sh_npc.lua’ )
AddCSLuaFile( “sh_npc.lua” )
include( ‘sh_player.lua’ )
AddCSLuaFile( “sh_player.lua” )

IncludePlayerClasses() // Automatically includes files in “gamemode/player_class”

GM.TeamBased = true // Team based game or a Free For All game?
GM.AllowAutoTeam = false
GM.AllowSpectating = true
GM.SecondsBetweenTeamSwitches = 10
GM.GameLength = 9999999
GM.RoundLimit = 1 // Maximum amount of rounds to be played in round based games
GM.VotingDelay = 5 // Delay between end of game, and vote. if you want to display any extra screens before the vote pops up

GM.NoPlayerSuicide = false
GM.NoPlayerDamage = false
GM.NoPlayerSelfDamage = false // Allow players to hurt themselves?
GM.NoPlayerTeamDamage = true // Allow team-members to hurt each other?
GM.NoPlayerPlayerDamage = true // Allow players to hurt each other?
GM.NoNonPlayerPlayerDamage = false // Allow damage from non players (physics, fire etc)
GM.NoPlayerFootsteps = false // When true, all players have silent footsteps
GM.PlayerCanNoClip = false // When true, players can use noclip without sv_cheats
GM.TakeFragOnSuicide = false // -1 frag on suicide

GM.MaximumDeathLength = 5 // Player will respawn if death length > this (can be 0 to disable)
GM.MinimumDeathLength = 5 // Player has to be dead for at least this long
GM.AutomaticTeamBalance = false // Teams will be periodically balanced
GM.ForceJoinBalancedTeams = false // Players won’t be allowed to join a team if it has more players than another team
GM.RealisticFallDamage = true
GM.AddFragsToTeamScore = false // Adds player’s individual kills to team score (must be team based)

GM.NoAutomaticSpawning = false // Players don’t spawn automatically when they die, some other system spawns them
GM.RoundBased = false // Round based, like CS
GM.RoundLength = -1 // Round length, in seconds
GM.RoundPreStartTime = 5 // Preperation time before a round starts
GM.RoundPostLength = 8 // Seconds to show the ‘x team won!’ screen at the end of a round
GM.RoundEndsWhenOneTeamAlive = false // CS Style rules

GM.EnableFreezeCam = false // TF2 Style Freezecam
GM.DeathLingerTime = 3 // The time between you dying and it going into spectator mode, 0 disables

GM.SelectModel = true // Can players use the playermodel picker in the F1 menu?
GM.SelectColor = false // Can players modify the colour of their name? (ie… no teams)
GM.SelectClass = true

GM.PlayerRingSize = 48 // How big are the colored rings under the player’s feet (if they are enabled) ?
GM.HudSkin = “SimpleSkin”

GM.ValidSpectatorModes = { OBS_MODE_CHASE, OBS_MODE_IN_EYE, OBS_MODE_ROAMING }
GM.ValidSpectatorEntities = { “player” } // Entities we can spectate
GM.CanOnlySpectateOwnTeam = false // you can only spectate players on your own team

MaxLevel = 99 // The maximum level a player can reach
BaseXP = 100 // The base experience required for a player to level

local metaply = FindMetaTable(“Player”) //Get the meta table of player

TEAM_RED = 1
TEAM_BLUE = 2

function GM:CreateTeams()

if ( !GAMEMODE.TeamBased ) then return end

team.SetUp( TEAM_RED, "Red Team", Color( 255, 100, 100 ), true )
team.SetSpawnPoint( TEAM_RED, {"info_player_red", "info_player_start"} )
team.SetClass( TEAM_RED, { "Assassin", "Berserker", "Mage", "Medic", "Soldier" } )

team.SetUp( TEAM_BLUE, "Blue Team", Color( 150, 150, 255 ), true )
team.SetSpawnPoint( TEAM_BLUE, {"info_player_blue", "info_player_start"} )
team.SetClass( TEAM_RED, { "Assassin", "Berserker", "Mage", "Medic", "Soldier" } )

//team.SetUp( TEAM_SPECTATOR, "Spectators", Color( 200, 200, 200 ), true )
//team.SetSpawnPoint( TEAM_SPECTATOR, {"info_player_red", "info_player_blue", "info_player_terrorist", "info_player_counterterrorist", "info_player_combine", "info_player_rebel", "info_player_start"} ) 
//team.SetClass( TEAM_SPECTATOR, { "Spectator" } )

end

function GM:PlayerCanJoinTeam( ply, teamid )

self.BaseClass:PlayerCanJoinTeam( ply, teamid )

return true

end

function AveragePlayerLvl()
if SERVER then
local lvl = 0
local count = 0
local total
for k, v in pairs(player.GetAll()) do
lvl = lvl + v:GetLevel()
count = count + 1
end
if count >= 1 then
total = lvl/count
return total
else
return 1
end
end
end

function PrintPlyStats( ply )
ply:ChatPrint("Your Level is: " … ply:GetLevel())
ply:ChatPrint("Your Experience is: " … ply:GetXP())
end
concommand.Add(“stats_get”, PrintPlyStats)

function PrintCash( ply )
ply:ChatPrint("Your cash is: " … ply:GetMoney())
end

concommand.Add(“cash_get”, PrintCash)

function GetCurrentWeaponDmg( ply )
local dmg = ply:GetActiveWeapon().Primary.Damage
local classn = ply:GetActiveWeapon():GetClass()
Msg("Your " …classn… " has a damage of " …dmg)
end

concommand.Add(“weapondmg_get”, GetCurrentWeaponDmg)

function userAuthed( ply, stid, unid )
if SERVER then
local pCount = #player.GetAll()
for _, v in pairs( ents.GetAll() ) do
if v:IsNPC() then
local health = v:Health()
v:SetNetworkedInt(“npcxp”, ((healthAveragePlayerLvl()) + math.pow(10, (AveragePlayerLvl()/10))))
v:SetHealth((health
AveragePlayerLvl()*pCount))
end
end
end
end
hook.Add( “PlayerAuthed”, “playerauthed”, userAuthed )

function GM:OnEntityCreated( entity )
if SERVER then
if entity:IsNPC() then
local pCount = #player.GetAll()
local health = entity:Health()
entity:SetNetworkedInt( “npcxp”, ((healthAveragePlayerLvl()) + math.pow(10, (AveragePlayerLvl()/10))))
entity:SetHealth((health
AveragePlayerLvl()*pCount))
end
end
end
[/lua]

That’s one hell of an intelligent gamemode.