Making a certain percent of players 1 class

Im new to scripting, and am currently wondering how do i make a certain amount of players spawn as a certain class (Think i got this, Using math.random) . Also how to make players who die turn to another class.
Yet another qeustion, has any1 got a weapon tut?
I needa add the css knife as a knife that does 20dmg per hit, and then 20 DOT. Link appreciated.

Oh yes, and how do i make the classes reset to the default after rounds (think i could have this)
Is there a random percent i can use to see if another random percent is above it so it gets placed in a certain class ( think i got this using math.random )?

Im currently using teams to see that players get items and health, should i use classes instead?

One last thing, how do i see my own steam id num?

I can answer the SteamID thing, if you want to print someones SteamID using lua it would be

[lua]concommand.Add( “PrintID”, “printid”, function()
for k, v in pairs{ player.GetAll() } do
Msg( v:Nick()… " = " …v:SteamID )
end )[/lua]

But if you just want to find your SteamID in general, just enter a game (multiplayer preferably) and type in console “status” and it should print everyones names and SteamID’s ( including your own )


I would also like to know how to make it so a certain percent of players are on a certain team. It would be useful

This is the lua fourm so

local ply = LocalPlayer()




Also OP to answer the other questions you have I think it would be easyer for you just to use fretta

ty, also i found a possible way of making some players a class when they spawn but not a certain percent

function set_infection( ply )
if math.random(1,10) >= 7
then player.Concommand( “team_2” )
elseif math.random(1,10) <= 6
then player.ConCommand( “team_1” )

concommand.Add( "GetRandInf", set_infection )

ok just got this small piece left i think xD

function GM:PlayerSpawn(ply) //What happens when the player spawns------------------->
//// says a ) is expected to close a (

self.BaseClass:PlayerSpawn( ply )   

ply:SetGravity( 0.75 )  
ply:SetMaxHealth( 100, true )  

ply:SetWalkSpeed( 325 )  
ply:SetRunSpeed( 325 ) 


Use lua tags, really.