• EntityRemoved
    2 replies, posted
Recently, after the large update that fixed the lamps (thanks garry) I've noticed some unwanted behavior in my server. It appears that entities are going invalid prior to the EntityRemoved function finishing. The code is from DarkRP 2.4.3, but I'm more concerned with whether anyone else is having this issue in any other gamemode. After the entity is removed, it never makes past the first condition to call the MsgAll that I left for debugging purposes. [CODE]function GM:EntityRemoved(ent) self.BaseClass:EntityRemoved(ent) if ent:IsVehicle() then local found = ent:CPPIGetOwner() if IsValid(found) then found.Vehicles = found.Vehicles or 1 found.Vehicles = found.Vehicles - 1 end end for k,v in pairs(DarkRPEntities or {}) do MsgAll("DoingTheLoop") if ent:IsValid() then MsgAll("FirstConditionPassed") MsgAll(ent:GetClass()) MsgAll(v.ent) if ent:GetClass() == v.ent then MsgAll("SecondConditionPassed") if ent.dt then MsgAll("ThirdConditionPassed") if IsValid(ent.dt.owning_ent) then MsgAll("FourthConditionPassed") if not ent.IsRemoved then MsgAll("WeMadeIt") local ply = ent.dt.owning_ent local cmdname = string.gsub(v.ent, " ", "_") if not ply["max"..cmdname] then ply["max"..cmdname] = 1 end ply["max"..cmdname] = ply["max"..cmdname] - 1 MsgAll(ply["max"..cmdname]) ent.IsRemoved = true end end end end end end end[/CODE] It declares the entity invalid for everything that is removed, not just DarkRP entities. As the base gamemode states, that EntityRemoved function is called before the entity is removed, so does anyone have a clue as to why its being declared invalid before it is removed?
It should be fixed in the next update (I hope soon because I have issues with this too). [url]https://github.com/Facepunch/garrysmod-issues/issues/961[/url]
Its nice to know I'm not the only one with this issue.
Sorry, you need to Log In to post a reply to this thread.