Garry's Mod

Garry's Mod

Outfitter: Multiplayer Playermodels!
Chillstice 16 Jan, 2020 @ 10:50am
Trying to Integrate Outfitter with TTT (Disguiser Change Playermodel)
I'm looking to figure out how to allow players on a TTT server to pick custom player models, but without ruining the ambiguous identity system rooted in the TTT gamemode. The server is currently running Outfitter so players can use any model from the workshop (which has it's own issues with small and invisible models). Currently the corpses use the default vanilla models from css so bodies still have to be manually identified, but players who are alive can still be easily identified if they use a unique model with Outfitter. [problem]

There are a few advanced disguise tools on the workshop and floating around on the internet that claim to steal another player's identity - including their model - but they don't work as advertised.

I would be happy enough to have the vanilla disguiser change the user's model to a random terrorist picked from the vanilla ttt playermodels, but it would be that much more excellent if I can figure out how to alter the disguiser to steal another player's identity (like the Advanced Disguiser) including their Outfitter playermodel.

How can I store the player's current Outfitter model, swap it out with another player's, and back?

I have this code so far:
DISGUISE = {} --Models local rModels = "models/player_link.mdl" local oldModel = nil local trans = LANG.GetTranslation function DISGUISE.CreateMenu(parent) local dform = vgui.Create("DForm", parent) dform:SetName(trans("disg_menutitle")) dform:StretchToParent(0,0,0,0) dform:SetAutoSize(false) local owned = LocalPlayer():HasEquipmentItem(EQUIP_DISGUISE) if not owned then dform:Help(trans("disg_not_owned")) return dform end local dcheck = vgui.Create("DCheckBoxLabel", dform) dcheck:SetText(trans("disg_enable")) dcheck:SetIndent(5) dcheck:SetValue(LocalPlayer():GetNWBool("disguised", false)) dcheck.OnChange = function(s, val) ChangeModel() RunConsoleCommand("ttt_set_disguise", val and "1" or "0") end dform:AddItem(dcheck) dform:Help(trans("disg_help1")) dform:Help(trans("disg_help2")) dform:SetVisible(true) return dform end --Attempt to change player's model when disguised function ChangeModel() if LocalPlayer():GetNWBool("disguised", false) then if ( oldModel == nil ) then return else LocalPlayer():SetModel(oldModel) end else oldModel = LocalPlayer():GetModel() timer.Simple(3, function() LocalPlayer():SetModel("models/player_link.mdl") end) end end function DISGUISE.Draw(client) if (not client) or (not client:IsActiveTraitor()) then return end if not client:GetNWBool("disguised", false) then return end surface.SetFont("TabLarge") surface.SetTextColor(255, 0, 0, 230) local text = trans("disg_hud") local w, h = surface.GetTextSize(text) surface.SetTextPos(36, ScrH() - 160 - h) surface.DrawText(text) end concommand.Add("ttt_toggle_disguise", WEPS.DisguiseToggle)