Skip to content

Instantly share code, notes, and snippets.

@tomatosoupcan
Last active June 5, 2020 19:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tomatosoupcan/486730ae68f865b021b78cb3684ce8eb to your computer and use it in GitHub Desktop.
Save tomatosoupcan/486730ae68f865b021b78cb3684ce8eb to your computer and use it in GitHub Desktop.
Applies playersmodels for TTT2
--Turn off enforce playermodels everywhere you can
--Place in garrysmod/addons/applypmodels/lua/autorun/server on your server
roundon = false
hook.Add( "TTTPrepareRound", "SetRoundOn1" function()
roundon = false
end )
hook.Add( "TTTBeginRound", "UpdatePlayerModelsBegin", function()
roundon = true
for k, v in pairs ( player.GetAll() ) do
RunConsoleCommand("ulx_logecho", "0")
RunConsoleCommand("ulx", "cexec", tostring(v:GetName()), "playermodel_apply")
RunConsoleCommand("ulx_logecho", "1")
end
end )
hook.Add ( "PlayerSpawn", "PlayerLoadingOut", function(ply)
if (roundon) then
timer.Simple(1, function()
RunConsoleCommand("ulx_logecho", "0")
RunConsoleCommand("ulx", "cexec", tostring(ply:GetName()), "playermodel_apply")
RunConsoleCommand("ulx_logecho", "1")
end)
end
end )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment