ETMods.net

N!tmod, a Wolfenstein: Enemy Territory Modification!

You are not logged in.

Announcement

You can donate to help us keeping services online.

#1 15-Jan-14 16:09:33

Doc
BETA Tester
Registered: 23-Feb-11
Posts: 30
Website

Problem with classrestriction.lua

Hello !
I try to create a lua for etpro mod.

I try to restrict certain class according to the number of players, but I have a problem I can not solve.
From 6v6, the script no longer seems to work ... and I do not know why.

If I put the value of :

if active_clients <= 6 then
et.trap_Cvar_Set("team_maxSoldiers", "1")

to 0, this lua works, but I want that value remains at 1.

My other problem is that I cannot discount the spectators. I do not know how to create the function not to count spectators.

Here is my attempt

active_clients = 0

function et_ClientBegin( clientNum )
	active_clients = active_clients + 1
	et.trap_SendServerCommand(-1, "b 8 \"Players:"..active_clients.."\n\"" )	 
	if active_clients == 3 then
	-- et.trap_SendServerCommand(-1, "b 8 \"^wSoldier Class (1), Rifle Grenades (1), and Landmines(4) are now available\n\"" )
         et.trap_Cvar_Set("team_maxSoldiers", "0") 
         et.trap_Cvar_Set("team_maxPanzers", "0" ) 
		 et.trap_Cvar_Set("team_maxMG42s", "0") 
         et.trap_Cvar_Set("team_maxFlamers", "0")
         et.trap_Cvar_Set("team_maxMortars", "0") 
         et.trap_Cvar_Set("team_maxRifleGrenades", "0") 
		 et.trap_Cvar_Set("team_maxMines", "0")
		 et.trap_Cvar_Set("team_maxFieldops", "1") 
	end
	
	if active_clients <= 3 then
	-- et.trap_SendServerCommand(-1, "b 8 \"^wSoldier Class (0), Rifle Grenades (0), and Landmines(0) are now unavailable\n\"" )
         et.trap_Cvar_Set("team_maxSoldiers", "0") 
         et.trap_Cvar_Set("team_maxPanzers", "0" ) 
		 et.trap_Cvar_Set("team_maxMG42s", "0") 
         et.trap_Cvar_Set("team_maxFlamers", "0")
         et.trap_Cvar_Set("team_maxMortars", "0") 
         et.trap_Cvar_Set("team_maxRifleGrenades", "0") 
		 et.trap_Cvar_Set("team_maxMines", "0")
		 et.trap_Cvar_Set("team_maxFieldops", "1") 
	end

	if active_clients == 4 then
	-- et.trap_SendServerCommand(-1, "b 8 \"^wSoldier Class (1), Rifle Grenades (1), and Landmines(4) are now available\n\"" )
         et.trap_Cvar_Set("team_maxSoldiers", "0") 
         et.trap_Cvar_Set("team_maxPanzers", "0" ) 
		 et.trap_Cvar_Set("team_maxMG42s", "0") 
         et.trap_Cvar_Set("team_maxFlamers", "0")
         et.trap_Cvar_Set("team_maxMortars", "0") 
         et.trap_Cvar_Set("team_maxRifleGrenades", "0") 
		 et.trap_Cvar_Set("team_maxMines", "0")
		 et.trap_Cvar_Set("team_maxFieldops", "1") 
	end
	
	if active_clients <= 4 then
	-- et.trap_SendServerCommand(-1, "b 8 \"^wSoldier Class (0), Rifle Grenades (0), and Landmines(0) are now unavailable\n\"" )
         et.trap_Cvar_Set("team_maxSoldiers", "0") 
         et.trap_Cvar_Set("team_maxPanzers", "0" ) 
		 et.trap_Cvar_Set("team_maxMG42s", "0") 
         et.trap_Cvar_Set("team_maxFlamers", "0")
         et.trap_Cvar_Set("team_maxMortars", "0") 
         et.trap_Cvar_Set("team_maxRifleGrenades", "0") 
		 et.trap_Cvar_Set("team_maxMines", "0")
		 et.trap_Cvar_Set("team_maxFieldops", "1") 
	end	
	
	if active_clients == 5 then
	-- et.trap_SendServerCommand(-1, "b 8 \"^wSoldier Class (1), Rifle Grenades (1), and Landmines(4) are now available\n\"" )
         et.trap_Cvar_Set("team_maxSoldiers", "1") 
         et.trap_Cvar_Set("team_maxPanzers", "1" ) 
		 et.trap_Cvar_Set("team_maxMG42s", "1") 
         et.trap_Cvar_Set("team_maxFlamers", "1")
         et.trap_Cvar_Set("team_maxMortars", "1") 
         et.trap_Cvar_Set("team_maxRifleGrenades", "1") 
		 et.trap_Cvar_Set("team_maxMines", "4")
		 et.trap_Cvar_Set("team_maxFieldops", "1") 
	end
	
	if active_clients <= 5 then
	-- et.trap_SendServerCommand(-1, "b 8 \"^wSoldier Class (0), Rifle Grenades (0), and Landmines(0) are now unavailable\n\"" )
         et.trap_Cvar_Set("team_maxSoldiers", "0") 
         et.trap_Cvar_Set("team_maxPanzers", "0" ) 
		 et.trap_Cvar_Set("team_maxMG42s", "0") 
         et.trap_Cvar_Set("team_maxFlamers", "0")
         et.trap_Cvar_Set("team_maxMortars", "0") 
         et.trap_Cvar_Set("team_maxRifleGrenades", "0") 
		 et.trap_Cvar_Set("team_maxMines", "0")
		 et.trap_Cvar_Set("team_maxFieldops", "1") 
	end	
	
	if active_clients == 6 then
	-- et.trap_SendServerCommand(-1, "b 8 \"^wSoldier Class (1), Rifle Grenades (1), and Landmines(4) are now available\n\"" )
         et.trap_Cvar_Set("team_maxSoldiers", "2") 
         et.trap_Cvar_Set("team_maxPanzers", "1" ) 
		 et.trap_Cvar_Set("team_maxMG42s", "1") 
         et.trap_Cvar_Set("team_maxFlamers", "1")
         et.trap_Cvar_Set("team_maxMortars", "1") 
         et.trap_Cvar_Set("team_maxRifleGrenades", "1") 
		 et.trap_Cvar_Set("team_maxMines", "5")
		 et.trap_Cvar_Set("team_maxFieldops", "1") 
	end
	
	if active_clients <= 6 then
	-- et.trap_SendServerCommand(-1, "b 8 \"^wSoldier Class (0), Rifle Grenades (0), and Landmines(0) are now unavailable\n\"" )
		 et.trap_Cvar_Set("team_maxSoldiers", "1") 
		 et.trap_Cvar_Set("team_maxPanzers", "1" ) 
		 et.trap_Cvar_Set("team_maxMG42s", "1") 
		 et.trap_Cvar_Set("team_maxFlamers", "1")
		 et.trap_Cvar_Set("team_maxMortars", "1") 
		 et.trap_Cvar_Set("team_maxRifleGrenades", "1") 
		 et.trap_Cvar_Set("team_maxMines", "4")
		 et.trap_Cvar_Set("team_maxFieldops", "1")
	end	
end

function et_ClientDisconnect( clientNum ) 
	active_clients = active_clients - 1
	-- et.trap_SendServerCommand(-1, "b 8 \"Players:"..active_clients.."\n\"" )	 
	if active_clients == 3 then
         et.trap_Cvar_Set("team_maxSoldiers", "0") 
         et.trap_Cvar_Set("team_maxPanzers", "0" ) 
		 et.trap_Cvar_Set("team_maxMG42s", "0") 
         et.trap_Cvar_Set("team_maxFlamers", "0")
         et.trap_Cvar_Set("team_maxMortars", "0") 
         et.trap_Cvar_Set("team_maxRifleGrenades", "0") 
		 et.trap_Cvar_Set("team_maxMines", "0")
		 et.trap_Cvar_Set("team_maxFieldops", "0") 
		return 1
	end
	
	if active_clients <= 3 then
	-- et.trap_SendServerCommand(-1, "b 8 \"^wSoldier Class (0), Rifle Grenades (0), and Landmines(0) are now unavailable\n\"" )
         et.trap_Cvar_Set("team_maxSoldiers", "0") 
         et.trap_Cvar_Set("team_maxPanzers", "0" ) 
		 et.trap_Cvar_Set("team_maxMG42s", "0") 
         et.trap_Cvar_Set("team_maxFlamers", "0")
         et.trap_Cvar_Set("team_maxMortars", "0") 
         et.trap_Cvar_Set("team_maxRifleGrenades", "0") 
		 et.trap_Cvar_Set("team_maxMines", "0")
		 et.trap_Cvar_Set("team_maxFieldops", "0") 
		return 1
	end

	if active_clients == 4 then
	-- et.trap_SendServerCommand(-1, "b 8 \"^wSoldier Class (1), Rifle Grenades (1), and Landmines(4) are now available\n\"" )
         et.trap_Cvar_Set("team_maxSoldiers", "0") 
         et.trap_Cvar_Set("team_maxPanzers", "0" ) 
		 et.trap_Cvar_Set("team_maxMG42s", "0") 
         et.trap_Cvar_Set("team_maxFlamers", "0")
         et.trap_Cvar_Set("team_maxMortars", "0") 
         et.trap_Cvar_Set("team_maxRifleGrenades", "0") 
		 et.trap_Cvar_Set("team_maxMines", "0")
		 et.trap_Cvar_Set("team_maxFieldops", "1") 
		return 1
	end
	
	if active_clients <= 4 then
	-- et.trap_SendServerCommand(-1, "b 8 \"^wSoldier Class (0), Rifle Grenades (0), and Landmines(0) are now unavailable\n\"" )
         et.trap_Cvar_Set("team_maxSoldiers", "0") 
         et.trap_Cvar_Set("team_maxPanzers", "0" ) 
		 et.trap_Cvar_Set("team_maxMG42s", "0") 
         et.trap_Cvar_Set("team_maxFlamers", "0")
         et.trap_Cvar_Set("team_maxMortars", "0") 
         et.trap_Cvar_Set("team_maxRifleGrenades", "0") 
		 et.trap_Cvar_Set("team_maxMines", "0")
		 et.trap_Cvar_Set("team_maxFieldops", "1")
		return 1
	end	
	
	if active_clients == 5 then
	-- et.trap_SendServerCommand(-1, "b 8 \"^wSoldier Class (1), Rifle Grenades (1), and Landmines(4) are now available\n\"" )
         et.trap_Cvar_Set("team_maxSoldiers", "1") 
         et.trap_Cvar_Set("team_maxPanzers", "1" ) 
		 et.trap_Cvar_Set("team_maxMG42s", "1") 
         et.trap_Cvar_Set("team_maxFlamers", "1")
         et.trap_Cvar_Set("team_maxMortars", "1") 
         et.trap_Cvar_Set("team_maxRifleGrenades", "1") 
		 et.trap_Cvar_Set("team_maxMines", "4")
		 et.trap_Cvar_Set("team_maxFieldops", "1") 
		return 1
	end
	
	if active_clients <= 5 then
	-- et.trap_SendServerCommand(-1, "b 8 \"^wSoldier Class (0), Rifle Grenades (0), and Landmines(0) are now unavailable\n\"" )
         et.trap_Cvar_Set("team_maxSoldiers", "0") 
         et.trap_Cvar_Set("team_maxPanzers", "0" ) 
		 et.trap_Cvar_Set("team_maxMG42s", "0") 
         et.trap_Cvar_Set("team_maxFlamers", "0")
         et.trap_Cvar_Set("team_maxMortars", "0") 
         et.trap_Cvar_Set("team_maxRifleGrenades", "0") 
		 et.trap_Cvar_Set("team_maxMines", "0")
		 et.trap_Cvar_Set("team_maxFieldops", "1") 
		return 1
	end	
	
	if active_clients == 6 then
	-- et.trap_SendServerCommand(-1, "b 8 \"^wSoldier Class (1), Rifle Grenades (1), and Landmines(4) are now available\n\"" )
         et.trap_Cvar_Set("team_maxSoldiers", "2") 
         et.trap_Cvar_Set("team_maxPanzers", "1" ) 
		 et.trap_Cvar_Set("team_maxMG42s", "1") 
         et.trap_Cvar_Set("team_maxFlamers", "1")
         et.trap_Cvar_Set("team_maxMortars", "1") 
         et.trap_Cvar_Set("team_maxRifleGrenades", "1") 
		 et.trap_Cvar_Set("team_maxMines", "5")
		 et.trap_Cvar_Set("team_maxFieldops", "1") 
		return 1
	end
	
	if active_clients <= 6 then
	-- et.trap_SendServerCommand(-1, "b 8 \"^wSoldier Class (0), Rifle Grenades (0), and Landmines(0) are now unavailable\n\"" )
		 et.trap_Cvar_Set("team_maxSoldiers", "1") 
		 et.trap_Cvar_Set("team_maxPanzers", "1" ) 
		 et.trap_Cvar_Set("team_maxMG42s", "1") 
		 et.trap_Cvar_Set("team_maxFlamers", "1")
		 et.trap_Cvar_Set("team_maxMortars", "1") 
		 et.trap_Cvar_Set("team_maxRifleGrenades", "1") 
		 et.trap_Cvar_Set("team_maxMines", "4")
		 et.trap_Cvar_Set("team_maxFieldops", "1")
		 return 1
	end	
end

If someone can give me a little help

Thank you for your help, cordially Doc !

Last edited by Doc (15-Jan-14 19:43:24)

Offline

#2 15-Jan-14 22:06:45

Micha
Member
From: Germany
Registered: 11-Feb-13
Posts: 38
Website

Re: Problem with classrestriction.lua

I changed Nitrox lua to work on etpro and edited it a bit.
Weapon values will be the values from global config (clanbase, esl). More then "unlockvalue" number of players will set the values on top.

heavweapon.lua

--[[
This lua is based on:
weapon.LUA by N!trox*
Website: www.etmods.net
eMail: admin@etmods.net
IRC: #nitmod @ freenode

Thanks for that!
Edited by Micha!

Contact:
--------------------
http://www.teammuppet.eu
--]]


--[[---------------------------------------------------------------------------------
---------------------------------CONFIG START----------------------------------------
-------------------------------------------------------------------------------------

true means on
false means off

changeable values:
--]]

countspectators = false		--include spectators on the player counter		


unlockvalue = 20		--player amount needed to unlock the following weapon values (must be greater then 13)

panzer 		= 1			--weapon amount which will be unlocked if playeramount greater then unlockvalue
mines	 	= 8
flamer 		= 1
mortar 		= 2
mg42 		= 1
riflegnade 	= 2

-------------------------------------------------------------------------------------
-------------------------------CONFIG END--------------------------------------------
-------------------------------------------------------------------------------------


-------------------------------------------------------------------------------------
----------DO NOT CHANGE THE FOLLOWING IF YOU DO NOT KNOW WHAT YOU ARE DOING----------
-------------------------------------------------------------------------------------

-------//-----------------DO NOT CHANGE THESE VARS-----------------------------------
Version = "0.1"
Modname = "heavyweapon"

et.CS_PLAYERS = 689

function et_InitGame(levelTime,randomSeed,restart)
    et.G_Print("["..Modname.."] Version: "..Version.." Loaded\n")
    et.RegisterModname(Modname .. " " .. Version)
	maxClients = tonumber(et.trap_Cvar_Get("sv_maxclients")) - 1;
	numPlayingClientsBackup = 0;
end

function et_RunFrame(leveltime)
	local numPlayingClients = 0;
	for i=0, maxClients do
		if countspectators then
			if (tonumber(et.gentity_get(i, "sess.sessionTeam")) >= 1) and (tonumber(et.gentity_get(i, "sess.sessionTeam")) <= 3) then
				numPlayingClients = numPlayingClients + 1;
			end
		else
			if (tonumber(et.gentity_get(i, "sess.sessionTeam")) == 1) or (tonumber(et.gentity_get(i, "sess.sessionTeam")) == 2) then
				numPlayingClients = numPlayingClients + 1;
			end
		end
	end
	
	AdjustCvarsValues( numPlayingClients );
end


function AdjustCvarsValues( numclients )
	
	if(numPlayingClientsBackup == 0 and numclients == 0) then
		return;
	elseif (numPlayingClientsBackup == numclients) then
		return;
	end
	
	numPlayingClientsBackup = numclients;

	if (numclients < 8) and unlockvalue > 13 then
		for j = 0, maxClients do
			if (tonumber(et.gentity_get(j, "sess.sessionTeam")) == 1) and checkclass(j) == 0 then --Axis Soldier
				et.gentity_set(j,"sess.latchPlayerWeapon", 3)	--MP40
			elseif (tonumber(et.gentity_get(j, "sess.sessionTeam")) == 2) and checkclass(j) == 0 then --Allies Soldier
				et.gentity_set(j,"sess.latchPlayerWeapon", 8)	--Thompson
			end
			et.gentity_set(j, "ps.ammoclip", 5, 0) 		--WP_PANZERFAUST
			et.gentity_set(j, "ps.ammoclip", 6, 0) 		--WP_FLAMETHROWER
			et.gentity_set(j, "ps.ammo", 9, 0)			--WP_GRENADE_PINEAPPLE
			et.gentity_set(j, "ps.ammoclip", 9, 0)		--WP_GRENADE_PINEAPPLE
			et.gentity_set(j, "ps.ammoclip", 26, 0)		--WP_LANDMINE
			et.gentity_set(j, "ps.ammo", 31, 0) 		--WP_MOBILE_MG42
			et.gentity_set(j, "ps.ammoclip", 31, 0) 	--WP_MOBILE_MG42
			et.gentity_set(j, "ps.ammo", 35, 0)			--WP_MORTAR
			et.gentity_set(j, "ps.ammoclip", 35, 0)		--WP_MORTAR
		end
		et.trap_Cvar_Set("team_maxMG42s", "0")
		et.trap_Cvar_Set("team_maxMortars", "0")
		et.trap_Cvar_Set("team_maxRifleGrenades", "0")
		et.trap_Cvar_Set("team_maxPanzers", "0")
		et.trap_Cvar_Set("team_maxLandmines", "0")
		et.trap_Cvar_Set("g_maxTeamLandmines", "0")
		et.trap_Cvar_Set("team_maxFlamers", "0")
	elseif (numclients >= 10 and numclients < 12) and unlockvalue > 13 then
		et.trap_Cvar_Set("team_maxMortars", "0")
		et.trap_Cvar_Set("team_maxMG42s", "1")
		et.trap_Cvar_Set("team_maxPanzers", "1")
		et.trap_Cvar_Set("team_maxRifleGrenades", "1")
		et.trap_Cvar_Set("team_maxLandmines", "5")
		et.trap_Cvar_Set("g_maxTeamLandmines", "5")
		et.trap_Cvar_Set("team_maxFlamers", "0")
	elseif (numclients >= 12 and numclients < unlockvalue) and unlockvalue > 13 then
		et.trap_Cvar_Set("team_maxMortars", "1")
		et.trap_Cvar_Set("team_maxMG42s", "1")
		et.trap_Cvar_Set("team_maxPanzers", "1")
		et.trap_Cvar_Set("team_maxRifleGrenades", "1")
		et.trap_Cvar_Set("team_maxLandmines", "5")
		et.trap_Cvar_Set("g_maxTeamLandmines", "5")
		et.trap_Cvar_Set("team_maxFlamers", "1")
	elseif (numclients >= unlockvalue) and unlockvalue > 13 then
		et.trap_Cvar_Set("team_maxMG42s", mg42)
		et.trap_Cvar_Set("team_maxMortars", mortar)
		et.trap_Cvar_Set("team_maxRifleGrenades", riflegnade)
		et.trap_Cvar_Set("team_maxPanzers", panzer)
		et.trap_Cvar_Set("team_maxLandmines", mines)
		et.trap_Cvar_Set("g_maxTeamLandmines", mines)
		et.trap_Cvar_Set("team_maxFlamers", flamer)
	end

end

--0=Soldier, 1=Medic, 2=Engineer, 3=FieldOps, 4=CovertOps
function checkclass(client)
   local cs = et.trap_GetConfigstring(et.CS_PLAYERS + client)
    return tonumber(et.Info_ValueForKey(cs, "c"))
end

Last edited by Micha (15-Jan-14 22:09:22)

Offline

#3 15-Jan-14 22:52:41

Doc
BETA Tester
Registered: 23-Feb-11
Posts: 30
Website

Re: Problem with classrestriction.lua

Thx a lot micha, i test !

Nice lua, but I do not see how to configure it, I started there is little the lua.
If I want to limit the  class in 3v3, 4v4, 5v5, 6v6 10v10 what should I change?

Sorry for my ignorance: D



It is set correctly?

--[[
This lua is based on:
weapon.LUA by N!trox*
Website: www.etmods.net
eMail: admin@etmods.net
IRC: #nitmod @ freenode

Thanks for that!
Edited by Micha!

Contact:
--------------------
http://www.teammuppet.eu
--]]


--[[---------------------------------------------------------------------------------
---------------------------------CONFIG START----------------------------------------
-------------------------------------------------------------------------------------

true means on
false means off

changeable values:
--]]

countspectators = false		--include spectators on the player counter		


unlockvalue = 20		--player amount needed to unlock the following weapon values (must be greater then 13)

panzer 		= 1			--weapon amount which will be unlocked if playeramount greater then unlockvalue
mines	 	= 6
flamer 		= 1
mortar 		= 1
mg42 		= 1
riflegnade 	= 1

-------------------------------------------------------------------------------------
-------------------------------CONFIG END--------------------------------------------
-------------------------------------------------------------------------------------


-------------------------------------------------------------------------------------
----------DO NOT CHANGE THE FOLLOWING IF YOU DO NOT KNOW WHAT YOU ARE DOING----------
-------------------------------------------------------------------------------------

-------//-----------------DO NOT CHANGE THESE VARS-----------------------------------
Version = "0.1"
Modname = "heavyweapon"

et.CS_PLAYERS = 689

function et_InitGame(levelTime,randomSeed,restart)
    et.G_Print("["..Modname.."] Version: "..Version.." Loaded\n")
    et.RegisterModname(Modname .. " " .. Version)
	maxClients = tonumber(et.trap_Cvar_Get("sv_maxclients")) - 1;
	numPlayingClientsBackup = 0;
end

function et_RunFrame(leveltime)
	local numPlayingClients = 0;
	for i=0, maxClients do
		if countspectators then
			if (tonumber(et.gentity_get(i, "sess.sessionTeam")) >= 1) and (tonumber(et.gentity_get(i, "sess.sessionTeam")) <= 3) then
				numPlayingClients = numPlayingClients + 1;
			end
		else
			if (tonumber(et.gentity_get(i, "sess.sessionTeam")) == 1) or (tonumber(et.gentity_get(i, "sess.sessionTeam")) == 2) then
				numPlayingClients = numPlayingClients + 1;
			end
		end
	end
	
	AdjustCvarsValues( numPlayingClients );
end


function AdjustCvarsValues( numclients )
	
	if(numPlayingClientsBackup == 0 and numclients == 0) then
		return;
	elseif (numPlayingClientsBackup == numclients) then
		return;
	end
	
	numPlayingClientsBackup = numclients;

	if (numclients < 1) and unlockvalue > 13 then
		for j = 0, maxClients do
			if (tonumber(et.gentity_get(j, "sess.sessionTeam")) == 1) and checkclass(j) == 0 then --Axis Soldier
				et.gentity_set(j,"sess.latchPlayerWeapon", 3)	--MP40
			elseif (tonumber(et.gentity_get(j, "sess.sessionTeam")) == 2) and checkclass(j) == 0 then --Allies Soldier
				et.gentity_set(j,"sess.latchPlayerWeapon", 8)	--Thompson
			end
			et.gentity_set(j, "ps.ammoclip", 5, 0) 		--WP_PANZERFAUST
			et.gentity_set(j, "ps.ammoclip", 6, 0) 		--WP_FLAMETHROWER
			et.gentity_set(j, "ps.ammo", 9, 0)			--WP_GRENADE_PINEAPPLE
			et.gentity_set(j, "ps.ammoclip", 9, 0)		--WP_GRENADE_PINEAPPLE
			et.gentity_set(j, "ps.ammoclip", 26, 0)		--WP_LANDMINE
			et.gentity_set(j, "ps.ammo", 31, 0) 		--WP_MOBILE_MG42
			et.gentity_set(j, "ps.ammoclip", 31, 0) 	--WP_MOBILE_MG42
			et.gentity_set(j, "ps.ammo", 35, 0)			--WP_MORTAR
			et.gentity_set(j, "ps.ammoclip", 35, 0)		--WP_MORTAR
		end
		et.trap_Cvar_Set("team_maxMG42s", "0")
		et.trap_Cvar_Set("team_maxMortars", "0")
		et.trap_Cvar_Set("team_maxRifleGrenades", "0")
		et.trap_Cvar_Set("team_maxPanzers", "0")
		et.trap_Cvar_Set("team_maxMines", "0")
		et.trap_Cvar_Set("team_maxFlamers", "0")
	elseif (numclients >= 1 and numclients < 3) and unlockvalue > 5 then
		et.trap_Cvar_Set("team_maxMortars", "0")
		et.trap_Cvar_Set("team_maxMG42s", "0")
		et.trap_Cvar_Set("team_maxPanzers", "0")
		et.trap_Cvar_Set("team_maxRifleGrenades", "0")
		et.trap_Cvar_Set("team_maxMines", "0")
		et.trap_Cvar_Set("team_maxFlamers", "0")
		et.trap_Cvar_Set("team_maxSoldiers", "0")
	elseif (numclients >= 5 and numclients < 7) and unlockvalue > 6 then
		et.trap_Cvar_Set("team_maxMortars", "1")
		et.trap_Cvar_Set("team_maxMG42s", "1")
		et.trap_Cvar_Set("team_maxPanzers", "1")
		et.trap_Cvar_Set("team_maxRifleGrenades", "1")
		et.trap_Cvar_Set("team_maxLandmines", "4")
		et.trap_Cvar_Set("g_maxTeamLandmines", "4")
		et.trap_Cvar_Set("team_maxFlamers", "0")
	elseif (numclients >= 6 and numclients < 8) and unlockvalue > 8 then
		et.trap_Cvar_Set("team_maxMortars", "1")
		et.trap_Cvar_Set("team_maxMG42s", "1")
		et.trap_Cvar_Set("team_maxPanzers", "1")
		et.trap_Cvar_Set("team_maxRifleGrenades", "1")
		et.trap_Cvar_Set("team_maxLandmines", "5")
		et.trap_Cvar_Set("g_maxTeamLandmines", "5")
		et.trap_Cvar_Set("team_maxFlamers", "0")
	elseif (numclients >= 12 and numclients < unlockvalue) and unlockvalue > 13 then
		et.trap_Cvar_Set("team_maxMortars", "1")
		et.trap_Cvar_Set("team_maxMG42s", "1")
		et.trap_Cvar_Set("team_maxPanzers", "1")
		et.trap_Cvar_Set("team_maxRifleGrenades", "1")
		et.trap_Cvar_Set("team_maxLandmines", "6")
		et.trap_Cvar_Set("g_maxTeamLandmines", "6")
		et.trap_Cvar_Set("team_maxFlamers", "1")
	elseif (numclients >= unlockvalue) and unlockvalue > 13 then
		et.trap_Cvar_Set("team_maxMG42s", mg42)
		et.trap_Cvar_Set("team_maxMortars", mortar)
		et.trap_Cvar_Set("team_maxRifleGrenades", riflegnade)
		et.trap_Cvar_Set("team_maxPanzers", panzer)
		et.trap_Cvar_Set("team_maxLandmines", mines)
		et.trap_Cvar_Set("g_maxTeamLandmines", mines)
		et.trap_Cvar_Set("team_maxFlamers", flamer)
	end

end

--0=Soldier, 1=Medic, 2=Engineer, 3=FieldOps, 4=CovertOps
function checkclass(client)
   local cs = et.trap_GetConfigstring(et.CS_PLAYERS + client)
    return tonumber(et.Info_ValueForKey(cs, "c"))
end

Last edited by Doc (16-Jan-14 01:25:26)

Offline

#4 16-Jan-14 12:46:55

Doc
BETA Tester
Registered: 23-Feb-11
Posts: 30
Website

Re: Problem with classrestriction.lua

Hello Micha!
Again thank you for the lua.

I have understand this lua!

Last edited by Doc (17-Jan-14 01:07:00)

Offline

Board footer

Powered by FluxBB