player_classes wont work

Every time I use a something like

local randommedic = table.Random(player.GetAll())
	if randommedic:Team() == 1 then player_manager.SetPlayerClass( randommedic, "Medic" ) end

it just gives me

SetPlayerClass - attempt to use unknown player class Survivor!
SetPlayerClass - attempt to use unknown player class Medic!
SetPlayerClass - attempt to use unknown player class Skeleton!

in the console.

Code for the medic class.

local CLASS = {}

CLASS.DisplayName			= "Medic"
CLASS.WalkSpeed 			= 125
CLASS.CrouchedWalkSpeed 	= 0.75
CLASS.RunSpeed				= 175
CLASS.DuckSpeed				= 0.25
CLASS.JumpPower				= 250
CLASS.DrawTeamRing			= false
CLASS.CanUseFlashlight		= true
CLASS.TeammateNoCollide		= true
CLASS.AvoidPlayers			= false

CLASS.PlayerModel			= { Model( "models/player/Group03m/Male_01.mdl" ),
							Model( "models/player/Group03m/Male_02.mdl" ),
							Model( "models/player/Group03m/Male_03.mdl" ),
						        Model( "models/player/Group03m/Male_04.mdl" ),
							Model( "models/player/Group03m/Male_05.mdl" ),
							Model( "models/player/Group03m/Male_06.mdl" ),
							Model( "models/player/Group03m/Male_07.mdl" ),
							Model( "models/player/Group03m/Male_08.mdl" ),
							Model( "models/player/Group03m/Male_09.mdl" ),
							Model( "models/player/Group03m/Female_01.mdl" ),
							Model( "models/player/Group03m/Female_02.mdl" ),
							Model( "models/player/Group03m/Female_03.mdl" ),
							Model( "models/player/Group03m/Female_04.mdl" ),
							Model( "models/player/Group03m/Female_05.mdl" ),
							Model( "models/player/Group03m/Female_06.mdl" ) };
function CLASS:Loadout( pl )


function CLASS:OnSpawn( pl )

function CLASS:OnDeath( ply )



player_class.Register( "Medic", CLASS )

I found another thread about this but the guy never solved it.

Are you actually including the file? Player classes aren’t automatically loaded nor sent to the client.

Well every class file has AddCSLuaFile() and shared, cl_init and init.lua all have IncludePlayerClasses().

What does IncludePlayerClasses do?

Code from Fretta13:

IncludePlayerClasses() //Automatically includes files in "gamemode/player_class"

And yes, I do have Fretta13 as base installed if you are wondering.

Edit: Found this code in another gamemode, any chance I need to add the classes by using team.SetClass()?

function GM:CreateTeams()

	team.SetUp( TEAM_RED, "Team Red", Color( 255, 40, 40 ), true )
	team.SetSpawnPoint( TEAM_RED, {"info_player_terrorist", "info_player_rebel" } )
	team.SetClass( TEAM_RED , { "Runner",  "Assault", "Sniper", "Artillery", "Medic","Techie"} )

	team.SetUp( TEAM_BLUE, "Team Blue", Color( 50, 50, 255 ), true )
	team.SetSpawnPoint( TEAM_BLUE, {"info_player_counterterrorist", "info_player_combine" })
	team.SetClass( TEAM_BLUE, { "Runner", "Assault", "Sniper", "Artillery", "Medic", "Techie"} )

	team.SetUp( TEAM_SPECTATOR, "Spectators", Color( 200, 200, 200 ), true )
	team.SetSpawnPoint( TEAM_SPECTATOR, { "info_player_start", "info_player_terrorist", "info_player_counterterrorist" } ) 


You can – I’m not sure if it’s required.

It didnt change anything, just made me spawn as one of the classes, althought all classes work fine and the gamemode can set the default ones without any problem.

The problem lies in

player_manager.SetPlayerClass( ply, "Medic" ) end