[IMG]http://images.akamai.steamusercontent.com/ugc/359527056804360671/1469DA056E852913AEAC5EA5D322D823B440EB80/[/IMG]
[img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/widgets/PlayerTick]widgets.PlayerTick[/url]
If [URL="https://facepunch.com/showthread.php?t=1360275"]DBugR[/URL] is to be believed, this hook puts a dent in the server's processing speed, EVEN WHEN NO WIDGETS EXIST. That's one call per tick per player.
If the player is alive, that's one trace per call.
Solution:
[lua]
hook.Add("Initialize","NoWidgets",function()
hook.Remove("PlayerTick","TickWidgets") --don't use it unless we need it.
end)
hook.Add("OnEntityCreated","WidgetInit",function(ent)
if ent:IsWidget() then
hook.Add( "PlayerTick", "TickWidgets", function( pl, mv ) widgets.PlayerTick( pl, mv ) end ) --we need it.
hook.Remove("OnEntityCreated","WidgetInit") --only once.
end
end)
[/lua]
Sorry, you need to Log In to post a reply to this thread.