Using Player Classes

I have a gamemode, and I have player classes, but I have no idea how to make them be called and set from a derma menu in the gamemode cl_init.

I tried the wiki but it didn’t really help that much.

This is what I’m calling in the client file:

bluClass = vgui.Create( “DButton” )
bluClass:SetText( “Medic: M416” )
bluClass.DoClick = function()
surface.PlaySound( “jessev92/bf2/menu/kitSelect.wav” )
player_manager.SetPlayerClass( ply, “soldier_medic_416” )
CategoryList:AddItem( bluClass ) [/lua]

Is there a reason it isn’t working? I get no errors or things telling me it isn’t working.

what is suppouse to be the “ply” entitie, it’s defined?
Also can’t do you use SetTeam from a net.message?

And no… team (not requal) class.

My bad, i’m used to set the class with a team number on the spawn, but on 2 teams with multiple class it wouldn’t work

I’m not using teams; this is a sandbox derived gamemode so there’s no need for teams.