View Single Post
Old 06-15-2013, 06:54 PM   #4
squeek.
Stuff Do-er
Lua Team
Wiki Team
Fortress Forever Staff
 
squeek.'s Avatar
 
Join Date: Mar 2007
Location: Northern California
Class/Position: Rallygun Shooter
Gametype: Conc tag (you just wait)
Affiliations: Mustache Brigade
Posts Rated Helpful 352 Times
Send a message via AIM to squeek.
Class limits can be changed anytime using those functions. The "must be in startup" thing is just for setting up the initial class limits.

To set a server cvar, you can use SetConvar( convar, value )

EDIT: Changing class limits won't immediately enforce those limits (it'll just make it so players wouldn't be able to choose/switch to that class afterwards). To enforce the limit immediately, you'd have to manually switch players playing the now-forbidden class(es) using ApplyToPlayer( player, { AT.kChangeClassSolder, AT.kRespawnPlayers } ) or something like that.

This sort of thing is done in ff_ksour to disable scouts on Defense.

EDIT#2: The ksour code:
in player_spawn:
Code:
	-- wtf, scout or med on d? are you mental?
	if (player:GetClass() == Player.kScout or player:GetClass() == Player.kMedic) and (player:GetTeamId() == defenders) then
		local classt = "Scout"
		if player:GetClass() == Player.kMedic then classt = "Medic" end
		local id = player:GetId()
		AddSchedule("force_changemessage"..id, 2, schedulechangemessage, player, "No "..classt.."s on defense. Autoswitching to Soldier." )
		AddSchedule("force_change"..id, 2.5, forcechange, player)
	end
The scheduled forcechange function:
Code:
-- force a scout/med to switch to soli if they haven't
function forcechange( player )
	if (player:GetClass() == Player.kScout or player:GetClass() == Player.kMedic) and (player:GetTeamId() == defenders) then
		ApplyToPlayer( player, { AT.kChangeClassSoldier, AT.kRespawnPlayers } )
	end
end
__________________
#FF.Pickup ยค Fortress-Forever pickups

My Non-official Maps
Released FF_DM_Squeek - FF_2Mesa3_Classic - FF_Siege_Classic
Beta FF_Myth - FF_Redlight_Greenlight

Sick of the people on the internet, always moanin'. They just moan.
- Karl Pilkington

Last edited by squeek.; 06-15-2013 at 07:04 PM.
squeek. is offline   Reply With Quote