Disabling Player Model Customization Sandbox

How would I go about disabling the ability to change your player model via the context menu? I know you can do this in DarkRP pretty easily via a config file. How would I go about doing this in Sandbox?

http://forum.facepunch.com/showthread.php?t=1238056

Any idea where I could find the correct property?

I’ve asked multiple people about this and I’ve researched it but I cannot find a good way to make it so that players cannot change their player model.



local tag = "restrictmodels"


local PlayerModelsDefault = {
["user"] = "models/player/breen.mdl",
["admin"] = "models/player/soldier_stripped.mdl",
["superadmin"] = "models/player/odessa.mdl"
}


local ValidModelSimpleNames = {
	["alyx"] = {"models/player/alyx.mdl"},
	["barney"] = {"models/player/barney.mdl"},
	["breen"] = {"models/player/breen.mdl"},
	["charple"] = {"models/player/charple.mdl"},
	["chell"] = {"models/player/p2_chell.mdl"},
	["corpse"] = {"models/player/corpse1.mdl"},
	["combine"] = {"models/player/combine_soldier.mdl"},
	["combineprison"] = {"models/player/combine_soldier_prisonguard.mdl"},
	["combineelite"] = {"models/player/combine_super_soldier.mdl"},
	["eli"] = {"models/player/eli.mdl"},
	["gman"] = {"models/player/gman_high.mdl"},
	["kleiner"] = {"models/player/kleiner.mdl"},
	["grigori"] = {"models/player/monk.mdl"},
	["mossman"] = {"models/player/mossman.mdl"},
	["mossmanarctic"] = {"models/player/mossman_arctic.mdl"},
	["police"] = {"models/player/police.mdl"},
	["girlpolice"] = {"models/player/police_fem.mdl"},
	["magnusson"] = {"models/player/magnusson.mdl"},
	["stripped"] = {"models/player/soldier_stripped.mdl"},
	["zombie"] = {"models/player/zombie_classic.mdl"},
	["fastzombie"] = {"models/player/zombie_fast.mdl"},
	["malerebel"] = {
	"models/player/Group03/Male_01.mdl",
	"models/player/Group03/Male_02.mdl",
	"models/player/Group03/Male_03.mdl",
	"models/player/Group03/Male_04.mdl",
	"models/player/Group03/Male_05.mdl",
	"models/player/Group03/Male_06.mdl",
	"models/player/Group03/Male_07.mdl",
	"models/player/Group03/Male_08.mdl",
	"models/player/Group03/Male_09.mdl"},
	["malecitizen"] = {
	"models/player/Group01/Male_01.mdl",
	"models/player/Group01/Male_02.mdl",
	"models/player/Group01/Male_03.mdl",
	"models/player/Group01/Male_04.mdl",
	"models/player/Group01/Male_05.mdl",
	"models/player/Group01/Male_06.mdl",
	"models/player/Group01/Male_07.mdl",
	"models/player/Group01/Male_08.mdl",
	"models/player/Group01/Male_09.mdl"},
	["girlrebel"] = {
	"models/player/Group03/Female_01.mdl",
	"models/player/Group03/Female_02.mdl",
	"models/player/Group03/Female_03.mdl",
	"models/player/Group03/Female_04.mdl",
	"models/player/Group03/Female_06.mdl",
	"models/player/Group03/Female_07.mdl"},
	["girlcitizen"] = {
	"models/player/Group01/Female_01.mdl",
	"models/player/Group01/Female_02.mdl",
	"models/player/Group01/Female_03.mdl",
	"models/player/Group01/Female_04.mdl",
	"models/player/Group01/Female_06.mdl",
	"models/player/Group01/Female_07.mdl"},
	["skeleton"] = {"models/player/skeleton.mdl"},
	["terrorist"] = {
	"models/player/leet.mdl",
	"models/player/guerilla.mdl",
	"models/player/arctic.mdl",
	"models/player/phoenix.mdl"},
	["counterterrorist"] = {
	"models/player/urban.mdl",
	"models/player/gasmask.mdl",
	"models/player/riot.mdl",
	"models/player/swat.mdl"}
}


local changedmodels = changedmodels or {}


local function defaultsetmodel(ply)
	timer.Simple(0.1, function()
		for g, m in pairs (PlayerModelsDefault) do
			if (g == ply:GetUserGroup()) then
				ply:SetModel(changedmodels[ply:SteamID()] or PlayerModelsDefault[g])
				break
			end
		end
	end)
end


hook.Add("PlayerSpawn", tag, defaultsetmodel)


local function changemodel(ply, text)
		
	local exptext = string.Explode(" ", text)
	
	if (string.lower(exptext[1]) == "!model") then
		local wanted = exptext[2]
		if (ValidModelSimpleNames[wanted]) then
			ply:SetModel(table.Random(ValidModelSimpleNames[wanted]))
			changedmodels[ply:SteamID()] = ply:GetModel()
			return
		else
			ply:PrintMessage(HUD_PRINTTALK, "Not a valid model! Type !models for a list of possible models.")
			return
		end
	end
	
	if (string.lower(exptext[1]) == "!models") then
		local getkeys = table.GetKeys(ValidModelSimpleNames)
		ply:PrintMessage(HUD_PRINTTALK, "Type !model and then one of the following: 
"..table.concat(getkeys, ", "))
		return
	end


	
	
end
hook.Add("PlayerSay", tag, changemodel)


Just modified something I use on my server (so it doesn’t use CAT functions). If it doesn’t work it should be pretty easy to fix.

Thanks but thats not exactly what I need. I’ll explain more in depth. I’d like to just disable changing your player model in general through the context menu or through any console command (if there is one) because I’m adding player models to the pointshop but I cannot figure out how to disable players from changing their player models.

If you want and you are using ULX you can add teams to every user group, then set a default model for each of the teams. This will prevent players from changing their playermodel via the context menu, but it will still allow them to equip models from the pointshop.