So I am having issues with people just randomly joining and using fading door to crash my server. I am trying to make it where when a fading door is not active the prop is not collided with anything to try and prevent this from happening but I am looking through the COLLISION_GROUP Enumerations and I cant find one that makes the props not collide with each other and keep collisions with players, vehicles, etc...
Are you sure that's whats causing the crash? How did you approach this conclusion?
I watched the player do it. He spawned a prop, made it a fading door with start toggled on then he did it again about 30ish times maybe more then then when he toggled them them all the server crashed.
extract fading doors and edit lua\weapons\gmod_tool\stools\fading_door.lua
around 285 we have this
local function fadeDeactivate(self)
self.fadeActive = false
if self:GetMaterial() == self.fadeDoorMaterial and self.fadeMaterial then self:SetMaterial(self.fadeMaterial) end
self:DrawShadow(true)
if self.fadeCanDisableMotion then self:SetNotSolid(false) else self:SetCollisionGroup(COLLISION_GROUP_NONE) end
local phys = self:GetPhysicsObject()
if IsValid(phys) then
phys:EnableMotion(self.fadeMoveable or false)--comment out this line so it doesn't unfreeze when unfading
phys:Wake()
end
if self.fadeDoorCloseSound and Sounds and Sounds[self.fadeDoorCloseSound] then
self:EmitSound(Sounds[self.fadeDoorCloseSound],350,100)
end
if self.FadeDoorSound then self.FadeDoorSound:Stop() end
self.FadeDoorSound = nil
if WireLib then
Wire_TriggerOutput(self, "FadeActive", 0)
end
end
i suggest also adding this to your serverside code
local apm_tab={}
apm_tab.vars={}
apm_tab.vars.unfreeze_ent_delay=5
apm_tab.vars.unfreeze_ent_limit=10
hook.Add("OnPhysgunReload","apm_unfreeze_limiter",function(weapon,ply)
if ply and IsValid(ply) and ply:IsPlayer() then
local unfreeze_count=0
if ply.APM_Next_unfreeze and ply.APM_Next_unfreeze>CurTime() then
ply:PrintMessage(HUD_PRINTTALK,"please wait "..math.Round(ply.APM_Next_unfreeze-CurTime(),4).." seconds before trying to unfreeze props")
return false
end
if apm_tab.vars.unfreeze_ent_delay and apm_tab.vars.unfreeze_ent_delay>0 then
ply.APM_Next_unfreeze=CurTime()+apm_tab.vars.unfreeze_ent_delay
end
local APM_Ent=ply:GetEyeTrace().Entity
if !APM_Ent or APM_Ent and !APM_Ent:IsValid() then return false end
for k,Entity in pairs(constraint.GetAllConstrainedEntities(APM_Ent)) do
local PhysObj=Entity:IsValid() and Entity:GetPhysicsObject()
if PhysObj and PhysObj:IsValid() then
PhysObj:Wake()
if unfreeze_count < apm_tab.vars.unfreeze_ent_limit and !PhysObj:IsMotionEnabled() then
PhysObj:EnableMotion(true)
unfreeze_count=unfreeze_count+1
end
end
end
ply:SuppressHint( "PhysgunReload" )
if unfreeze_count>0 then
ply:SendLua( "GAMEMODE:UnfrozeObjects("..unfreeze_count..")" )
return false--we have to return false to prevent the normal unfreezing from happening
end
end
end)
My anticrash might help.
GitHub
It forces props to be in ghostmode when spawned or brought out of freeze mode.
Sorry, you need to Log In to post a reply to this thread.