Add sv_disableCustomClasses

This commit is contained in:
fed
2023-01-27 23:34:16 +01:00
parent b4591b6e2f
commit e54e17d6b0
3 changed files with 51 additions and 0 deletions

View File

@ -0,0 +1,34 @@
main()
{
replacefunc(maps\mp\gametypes\_menus::getclasschoice, ::getclasschoice);
}
getclasschoice(choice)
{
if (choice <= 100)
{
if (getdvar("sv_disableCustomClasses") == "1")
{
return "class0";
}
choice = "custom" + choice;
}
else if (choice <= 200)
{
choice -= 101;
choice = "class" + choice;
}
else if ( choice <= 206 )
{
choice -= 200;
choice = "axis_recipe" + choice;
}
else
{
choice -= 206;
choice = "allies_recipe" + choice;
}
return choice;
}

View File

@ -0,0 +1,13 @@
if (Engine.InFrontend()) then
return
end
local getclasscount = Cac.GetCustomClassCount
Cac.GetCustomClassCount = function(...)
local value = Engine.GetDvarBool("sv_disableCustomClasses")
if (value) then
return 0
end
return getclasscount(...)
end