I'm trying to fix the version of smart constraint I have.
I am currently getting the following error.
[CODE]
[ERROR] ...t tool/lua/weapons/gmod_tool/stools/smart_constraint.lua:46: attempt to index local 'Ent1' (a nil value)
1. unknown - ...t tool/lua/weapons/gmod_tool/stools/smart_constraint.lua:46
Timer Failed! [Simple][@addons/smart constraint tool/lua/weapons/gmod_tool/stools/smart_constraint.lua (line 194)]
[ERROR] ...t tool/lua/weapons/gmod_tool/stools/smart_constraint.lua:121: attempt to index local 'self' (a nil value)
1. unknown - ...t tool/lua/weapons/gmod_tool/stools/smart_constraint.lua:121
Timer Failed! [Simple][@addons/smart constraint tool/lua/weapons/gmod_tool/stools/smart_constraint.lua (line 204)]
[ERROR] ...t tool/lua/weapons/gmod_tool/stools/smart_constraint.lua:46: attempt to index local 'Ent1' (a nil value)
1. unknown - ...t tool/lua/weapons/gmod_tool/stools/smart_constraint.lua:46
Timer Failed! [Simple][@addons/smart constraint tool/lua/weapons/gmod_tool/stools/smart_constraint.lua (line 194)]
[ERROR] ...t tool/lua/weapons/gmod_tool/stools/smart_constraint.lua:46: attempt to index local 'Ent1' (a nil value)
1. unknown - ...t tool/lua/weapons/gmod_tool/stools/smart_constraint.lua:46
Timer Failed! [Simple][@addons/smart constraint tool/lua/weapons/gmod_tool/stools/smart_constraint.lua (line 194)]
[/CODE]
Here is some of smart_constraint.lua
[lua]
--line 45
function TOOL:DoConstraint(Weld, Nocollide, Ent1, Ent2)
if(!Ent1:IsValid() || !Ent2:IsValid()) then
return
end
if(Weld == 1) then
local WeldConstraint = constraint.Weld(Ent1, Ent2, 0, 0, 0)
if(WeldConstraint) then
undo.AddEntity(WeldConstraint)
self:GetOwner():AddCleanup("smart_constraints", WeldConstraint)
end
--Error("Weld Created...\n")
end
if(Nocollide == 1) then
local NocollideConstraint = constraint.NoCollide(Ent1, Ent2, 0, 0)
if(NocollideConstraint) then
undo.AddEntity(NocollideConstraint)
self:GetOwner():AddCleanup("smart_constraints", NocollideConstraint)
end
--Error("NoCollide Created...\n")
end
-- if(Weld == 1 && Nocollide == 1) then
-- self:GetOwner():PrintMessage(HUD_PRINTCENTER, "Welds/Nocollides Placed: "..self.ConstraintedPropsTotalFix)
-- elseif(Weld == 1) then
-- self:GetOwner():PrintMessage(HUD_PRINTCENTER, "Welds Placed: "..self.ConstraintedPropsTotalFix)
-- elseif(Nocollide == 1) then
-- self:GetOwner():PrintMessage(HUD_PRINTCENTER, "Nocollides Placed: "..self.ConstraintedPropsTotalFix)
-- end
self.ConstraintedPropsTotalFix = self.ConstraintedPropsTotalFix + 1
end
function TOOL:CheckFinish(Table, Weld, Nocollide, Unfreeze)
local ConstraintDone = nil
if(Weld == 1 || Nocollide == 1) then
if(self.ConstraintedPropsTotal == self.ConstraintedPropsTotalFix) then
ConstraintDone = true
else
ConstraintDone = false
end
end
if(ConstraintDone == nil || ConstraintDone == true) then
self:Finish(Table, Unfreeze) --line 121
else
timer.Simple(1, self.CheckFinish, self, Table, Weld, Nocollide, Unfreeze)
end
end
[/lua]
How can I fix the error?
Sorry, you need to Log In to post a reply to this thread.