Player Classes are being assigned, but none of the perks are given.

I can assign my player class to players no problem, but none of the perks are given to the player. I can even check to see what class the player is no problem.



// init.lua
AddCSLuaFile( "cl_init.lua" )
AddCSLuaFile( "shared.lua" )

include( 'shared.lua' )

include("utils.lua") /* some useful functions I made myself, wouldn't think it is the problem */
include("sv_players.lua") /*player class for the extra question */

function GM:PlayerSpawn (ply)

	player_manager.SetPlayerClass(ply, "player_human")
        // RETURNS PLAYER_HUMAN
	print("Player Class Name Is: " .. player_manager.GetPlayerClass(ply))
         //  RETURNS 100 INSTEAD OF 150
	print("Player Max Health Is: " .. tostring(ply:GetMaxHealth()))	


end





// player_human.lua 
// this is the class file
AddCSLuaFile()

include("utils.lua")

local PLAYER = {}

PLAYER.DisplayName  = "Human"
PLAYER.WalkSpeed    = 200
PLAYER.RunSpeed     = 1000
PLAYER.MaxHealth    = 150
PLAYER.StartHealth  = 150


function PLAYER:SetModel ()
  self.PLAYER:SetModel(AssignRandModel())
  print("Player Class Set")
end

player_manager.RegisterClass( "player_human", PLAYER, "player_default" )



And as a bonus question: I am trying to make a players file, but some functions will not execute while others do just fine.



// sv_players.lua

// does not work
function GM:PlayerSpawn (ply)
  print("Player Class PlayerSpawn(ply) executed.") 
end

// does not work
function GM:Initialize () 
  print("sv_players.lua started.")
end

// works
function GM:PlayerInitialSpawn (ply) 
  print("Player's first spawn")
end

// yes, that is all that is in this file


The first problem is that you can not have multiple GM: functions, they overwrite eachother. If you want multiple use:



function prepareSgit(ply)
     sgit()
end
hook.Add("PlayerSpawn","Testing",prepareSgit)

Also I think using the GM functions overwrote the class thing, I personally would just make a class table and set all the player stuff myself.



classdata[1].hp = 42893
classdata[1].name = "defaultman"
classdata[2].hp = 1
classdata[2].name = "cunt"

function GM:PlayerSpawn(ply)
     ply:SetHealth( classdata[ (ply's class) ] )
end

but i think it actually is just you overwriting the GM functions…
also by the way you’re coding for a gamemode right?